fluxflow-cli 5.8.4 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{ai-2DFW5U6C.js → ai-CCVRDJ5Y.js} +1 -1
- package/dist/chunks/{app-RQ57KYK7.js → app-5NONP3DN.js} +186 -186
- package/dist/chunks/{auto_completion-6UFMQKFR.js → auto_completion-X5BQ67LH.js} +1 -1
- package/dist/chunks/chunk-2GG7YBNM.js +1 -0
- package/dist/chunks/{chunk-3XJQTYIL.js → chunk-4KFOL3UU.js} +1 -1
- package/dist/chunks/{chunk-EXFLTC37.js → chunk-B3TQ7NL3.js} +5 -5
- package/dist/chunks/{chunk-E3RSSW5O.js → chunk-BA3CAHVB.js} +1 -1
- package/dist/chunks/{chunk-JWB2S22X.js → chunk-QPUQJOH3.js} +1 -1
- package/dist/chunks/{chunk-VDQPTW23.js → chunk-R325MU5U.js} +1 -1
- package/dist/chunks/{chunk-S62UXLFZ.js → chunk-RQYLBV33.js} +1 -1
- package/dist/chunks/{click-VXWUG5T3.js → click-UEI5LVOE.js} +2 -2
- package/dist/chunks/{computer_action-SI6AMRJ6.js → computer_action-5SFGUE7P.js} +1 -1
- package/dist/chunks/{custom_openai-EYI4WXHZ.js → custom_openai-ACLWXYRS.js} +1 -1
- package/dist/chunks/{drag-6XCBUY73.js → drag-L7GQYYL3.js} +1 -1
- package/dist/chunks/{generate_image-5ZVJ7ELI.js → generate_image-7SELLJ3D.js} +1 -1
- package/dist/chunks/{invoke-DSLXMUB7.js → invoke-Y5UH42ZS.js} +2 -2
- package/dist/chunks/{invokeSync-ZFZDDS77.js → invokeSync-B72TXIKL.js} +2 -2
- package/dist/chunks/{key_press-ISGXEO42.js → key_press-7KZSEFAE.js} +1 -1
- package/dist/chunks/{keyboard_typing-TK55ZAVR.js → keyboard_typing-56IA2FB3.js} +1 -1
- package/dist/chunks/{ollama-22NU2XBD.js → ollama-7OZHJOT7.js} +1 -1
- package/dist/chunks/{recapture_screen-BY4Q4D5X.js → recapture_screen-OXAETNVY.js} +1 -1
- package/dist/chunks/{screen_grid-3FHYFJVG.js → screen_grid-RN2WVT2W.js} +1 -1
- package/dist/chunks/{scroll-6SPRL73L.js → scroll-JYIYNVSL.js} +1 -1
- package/dist/chunks/{search_keyword-CBP3ULUI.js → search_keyword-HIPJ7GZH.js} +1 -1
- package/dist/chunks/{secrets-GLYKU2YR.js → secrets-UJX3AM5H.js} +1 -1
- package/dist/chunks/secrets_v2-4W2S23QC.js +1 -0
- package/dist/chunks/{settings-YRMZZJ3F.js → settings-FYL7TNA2.js} +1 -1
- package/dist/chunks/{update_file-VIKPZENG.js → update_file-EM4ZG6UL.js} +1 -1
- package/dist/chunks/{usage-23Z3SVXU.js → usage-NXEZ6F7E.js} +1 -1
- package/dist/chunks/{usageServer-7KEKAGPH.js → usageServer-R4WIRTGA.js} +1 -1
- package/dist/chunks/{write_file-O3YKZSFP.js → write_file-A6R4JKA3.js} +1 -1
- package/dist/cli.js +4 -4
- package/dist/package.json +2 -2
- package/package.json +2 -2
- package/dist/chunks/chunk-F36PAVKE.js +0 -1
- package/dist/chunks/secrets_v2-ZSQLFEIS.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as W}from"./chunk-
|
|
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 $=null;async function tt(){return $||($=(async()=>{let{createWorker:t}=await import("tesseract.js"),o=await import("fs-extra"),{CU_CACHE_DIR:e}=await import("./paths-4NQOSFLK.js");return o.ensureDirSync(e),t("eng",1,{cachePath:e,logger:()=>{}})})().catch(t=>{throw $=null,t})),$}var I=null,F=null;async function et(){let{getActiveDisplay:t}=await import("./screen_grid-
|
|
1
|
+
import{a as W}from"./chunk-R325MU5U.js";import{g as B,i as S}from"./chunk-RQYLBV33.js";import{a as P}from"./chunk-6LM3YRRE.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 $=null;async function tt(){return $||($=(async()=>{let{createWorker:t}=await import("tesseract.js"),o=await import("fs-extra"),{CU_CACHE_DIR:e}=await import("./paths-4NQOSFLK.js");return o.ensureDirSync(e),t("eng",1,{cachePath:e,logger:()=>{}})})().catch(t=>{throw $=null,t})),$}var I=null,F=null;async function et(){let{getActiveDisplay:t}=await import("./screen_grid-RN2WVT2W.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,["gridId","grid","coordinate","target","id","type","clickType","button","intendedClickText","text","ocrCorrection","useOCR","words","lines"]),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(),C=null,T="",q=x?320:500;if(x){let y=Math.min(Math.round(h/2),h),m=Math.min(Math.round(p/2),p),b=Math.max(0,Math.min(h-y,g.x-Math.floor(y/2))),k=Math.max(0,Math.min(p-m,g.y-Math.floor(m/2))),D=await O(M).extract({left:b,top:k,width:y,height:m}).toBuffer(),z=2,A=await H(D,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)&&(C=_,T="centered target crop OCR")}}}if(!C){let y=await H(M,2),m=u.replace(/[^a-z0-9]/g,"_");await U("fullscreen",`full_${Date.now()}_${m}.png`,y),await d.setParameters({tessedit_pageseg_mode:"3"});let{data:b}=await d.recognize(y,{},{tsv:!0,blocks:!0});if(b&&b.text){let k=L(b,u,0,0,2);if(k.length>0){let D=N(k,g);D&&(C=D,T="full-screen OCR")}}}if(C){let y={x:Math.round(C.x*(1280/h)),y:Math.round(C.y*(720/p))},m=await W("click",y,{button:i,clickType:r});if(typeof m=="string"&&m.startsWith("ERROR:"))return m;let b=S(y),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-R325MU5U.js";import"./chunk-RQYLBV33.js";import{a as c}from"./chunk-6LM3YRRE.js";var l=async(a,p={})=>{let t=c(a,["action","type","cmd","target","grid","gridCode","location","input","button","clickType","from","to","direction","amount","autoPressEnter","enter","text","keys"]),r=t.action||t.type||t.cmd,n=t.target||t.grid||t.gridCode||t.location||t.input;if(!r)return'ERROR: Missing required "action" argument for computer_action (e.g. move, click, drag, scroll, type, key_press, key_combination).';let e=r.toLowerCase();if(e.startsWith("mouse_")||["move","click","drag","scroll"].includes(e)){let o=e.replace("mouse_","");return await i(o,n,{button:t.button,clickType:t.clickType||t.type,from:t.from,to:t.to,direction:t.direction,amount:t.amount?parseInt(t.amount,10):void 0})}if(e.startsWith("key_")||e==="type"||e==="press"){let o=e;e==="press"&&(o="key_press");let u=t.autoPressEnter===!0||t.autoPressEnter==="true"||t.enter===!0||t.enter==="true";return await s(o,n||t.text||t.keys,{...t,autoPressEnter:u})}return`ERROR: Unrecognized action "${r}". Supported actions: move, click, drag, scroll, type, key_press, key_combination.`};export{l as computer_action};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m,d as B}from"./chunk-H6ZSIWYH.js";import{a as W}from"./chunk-UM5SNZ6X.js";import{
|
|
1
|
+
import{a as m,d as B}from"./chunk-H6ZSIWYH.js";import{a as W}from"./chunk-UM5SNZ6X.js";import{q as R}from"./chunk-2GG7YBNM.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";var ot=async function*(d,S,F,N,O,Z,J,_,K=1,Y=""){let T=[];N&&T.push({role:"system",content:N});for(let t of F){let e=t.role==="user"?"user":"assistant",n=[];if(Array.isArray(t.parts)){for(let o of t.parts)if(o.text)n.push({type:"text",text:o.text});else if(o.inlineData&&J){let l=o.inlineData.mimeType,u=o.inlineData.data;l.startsWith("image/")&&n.push({type:"image_url",image_url:{url:`data:${l};base64,${u}`}})}}else{let o=t.text||"";o&&n.push({type:"text",text:o})}T.push({role:e,content:n.length===1&&n[0].type==="text"?n[0].text:n})}let D=W("c_openai",S,O),y=D!==null?D:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"xhigh"}[O],i={model:S,messages:T,stream:!0,stream_options:{include_usage:!0},temperature:K,tools:[],tool_choice:"none"};y&&y!=="none"&&(i.reasoning_effort=y,i.reasoning={effort:y});let L=(Y||process.env.CUSTOM_OPENAI_URL||process.env.C_OPENAI_URL||"").trim();if(!L)throw new Error("Custom OpenAI Base URL is not configured. Please set Base URL in /settings -> Providers.");let f=L.replace(/\/+$/,"");f.endsWith("/chat/completions")||(f.endsWith("/v1")?f=`${f}/chat/completions`:f=`${f}/chat/completions`);let g={"Content-Type":"application/json",Accept:"text/event-stream, application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow"},I=d===R,C=I?"":d&&d!=="LOCAL"?d:process.env.CUSTOM_OPENAI_API_KEY||process.env.C_OPENAI_API_KEY||"";if(!I&&C&&C.trim()!==""){let t=C.trim();g.Authorization=t.startsWith("Bearer ")?t:`Bearer ${t}`,g["api-key"]=t}let r=await m(f,{method:"POST",headers:g,body:JSON.stringify(i),signal:_});if(!r.ok&&(r.status===400||r.status===422)&&(i.reasoning||i.reasoning_effort)){if(console.info(`
|
|
2
2
|
`),i.reasoning&&i.reasoning_effort){let t={...i};delete t.reasoning_effort;let e=await m(f,{method:"POST",headers:g,body:JSON.stringify(t),signal:_}).catch(()=>null);e&&e.ok&&(r=e)}if(!r.ok&&i.reasoning_effort){let t={...i};delete t.reasoning;let e=await m(f,{method:"POST",headers:g,body:JSON.stringify(t),signal:_}).catch(()=>null);e&&e.ok&&(r=e)}if(!r.ok){let t={...i};delete t.reasoning,delete t.reasoning_effort;let e=await m(f,{method:"POST",headers:g,body:JSON.stringify(t),signal:_}).catch(()=>null);e&&e.ok&&(r=e)}}if(!r.ok){let t=await r.json().catch(()=>({})),e=t.error?.metadata?.raw||t.error?.message||(typeof t.error=="string"?t.error:"")||t.message||r.statusText||"Unknown error";throw new Error(`Custom OpenAI Error (${r.status}): ${e}`)}let b=r.body.getReader(),q=new TextDecoder,w="",s=[],h=null,k=Date.now(),c=!1,x=[],M=0,z=5,U=!0,E=()=>{x.length>0&&(s.push(...x),x=[],c=!0),U=!1},X=(t,e)=>{if(!t&&!e)return null;if(t){if(typeof t.reasoning_content=="string"&&t.reasoning_content)return t.reasoning_content;if(typeof t.reasoning=="string"&&t.reasoning)return t.reasoning;if(typeof t.thinking=="string"&&t.thinking)return t.thinking;if(typeof t.thought=="string"&&t.thought)return t.thought;if(typeof t.reasoning_text=="string"&&t.reasoning_text)return t.reasoning_text;if(Array.isArray(t.reasoning_details)&&t.reasoning_details.length>0){let n=t.reasoning_details.map(o=>typeof o=="string"?o:o?.text||o?.content||"").filter(Boolean).join("");if(n)return n}}if(e){if(typeof e.reasoning_content=="string"&&e.reasoning_content)return e.reasoning_content;if(typeof e.reasoning=="string"&&e.reasoning)return e.reasoning}return null},G=(t,e)=>{if(t){if(typeof t.content=="string"&&t.content)return t.content;if(typeof t.text=="string"&&t.text)return t.text;if(Array.isArray(t.content))return t.content.map(n=>typeof n=="string"?n:n?.text||"").join("")}return e&&typeof e.text=="string"&&e.text?e.text:""},Q=t=>{let e=t.usage||t.usageMetadata||t.choices?.[0]?.usage||null;if(!e)return null;let n=e.prompt_tokens||e.promptTokenCount||e.input_tokens||0,o=e.completion_tokens||e.candidatesTokenCount||e.output_tokens||0,l=e.total_tokens||e.totalTokenCount||n+o,u=e.prompt_tokens_details?.cached_tokens||e.prompt_tokens_details?.cache_read_input_tokens||e.cachedContentTokenCount||e.cache_read_input_tokens||0,p=e.completion_tokens_details?.reasoning_tokens||e.thoughtsTokenCount||e.reasoning_tokens||0;return{totalTokenCount:l,promptTokenCount:n,candidatesTokenCount:o,cachedContentTokenCount:u,thoughtsTokenCount:p}};for(;;){let{done:t,value:e}=await b.read();if(t){E(),c&&(s.length>0||h)&&(yield{candidates:s.length>0?[{content:{parts:s}}]:[],usageMetadata:h});break}w+=q.decode(e,{stream:!0});let{lines:n,uncompleted:o}=B(w);w=o;for(let l of n){let u=l.trim();if(!u||!u.startsWith("data: "))continue;let p=!1;if(u==="data: [DONE]")p=!0,E();else try{let a=JSON.parse(u.substring(6));if(a.error){let V=a.error.metadata?.raw||a.error.message||(typeof a.error=="string"?a.error:JSON.stringify(a.error));throw new Error(`Custom OpenAI Stream Error: ${V}`)}let A=a.choices?.[0],v=A?.delta,$=Q(a);$&&(h=$,c=!0);let H=X(v,A);H&&(s.push({text:H,thought:!0}),c=!0);let P=G(v,A);P&&(U?(x.push({text:P}),M++,M>=z&&E()):(s.push({text:P}),c=!0))}catch(a){if(a.message&&a.message.startsWith("Custom OpenAI Stream Error:"))throw a}if((p||Date.now()-k>=150)&&c&&(yield{candidates:s.length>0?[{content:{parts:[...s]}}]:[],usageMetadata:h},s=[],k=Date.now(),c=!1),p)break}Date.now()-k>=150&&c&&(yield{candidates:s.length>0?[{content:{parts:[...s]}}]:[],usageMetadata:h},s=[],k=Date.now(),c=!1)}};export{ot as getCustomOpenAIStream};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-R325MU5U.js";import"./chunk-RQYLBV33.js";import{a as d}from"./chunk-6LM3YRRE.js";var n=async(i,a={})=>{let r=d(i,["fromGridId","from","start","toGridId","to","end"]),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{n as drag};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-2RTYI6K3.js";import{a as b}from"./chunk-6LM3YRRE.js";import{v as B,w as T,x as $}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-2RTYI6K3.js";import{a as b}from"./chunk-6LM3YRRE.js";import{v as B,w as T,x as $}from"./chunk-QPUQJOH3.js";import{b as I}from"./chunk-4KFOL3UU.js";import"./chunk-2Q6KKC74.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.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},p=(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(p(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,["prompt","text","path","outputPath","output","ratio"]),c=s.prompt||s.text,l=s.path||s.outputPath||s.output||"generated_image.png",p=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(p){let t=p.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(),f=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:p||"1:1",Seed:String(M)};f=F(f,P);let R=x.resolve(process.cwd(),l);await C.ensureDir(x.dirname(R)),await k.recordFileChange(R),await C.writeFile(R,f),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:f.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,6 +1,6 @@
|
|
|
1
|
-
import{a as b,c as p}from"./chunk-56EJGQU3.js";import{a as D}from"./chunk-6LM3YRRE.js";var q=async(_,s={})=>{let{runSubagent:y}=await import("./ai-
|
|
1
|
+
import{a as b,c as p}from"./chunk-56EJGQU3.js";import{a as D}from"./chunk-6LM3YRRE.js";var q=async(_,s={})=>{let{runSubagent:y}=await import("./ai-CCVRDJ5Y.js"),a=D(_,["task","instruction","prompt","model","title","tools","id"]),u=a.task||a.instruction||a.prompt,A=a.model||null,g=a.title||null,w=a.tools||null,m=a.id&&a.id!=="null"&&a.id!=="undefined"&&a.id!==""?String(a.id).trim():null;if(!u)return'ERROR: Missing "task" argument for invoke.';let d=null,U="";m&&(d=b.find(e=>e.id===m));let f=!!d,r=f?d.id:m||`subagent-${Date.now()}-${Math.floor(Math.random()*1e3)}`,I=f?d.history||[]:[],C=null;if(w)try{let e=w.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.substring(1,e.length-1)),C=e.split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let h=null,S=null,E=new Promise((e,n)=>{h=e,S=n}),t=d;t?(t.status="running",t.task=u,g&&(t.title=g),t.startedAt=Date.now(),t.lastChunkTime=Date.now(),t.completionPromise=E,t._resolveCompletion=h,t._rejectCompletion=S):(t={id:r,title:g||u.substring(0,30),task:u,status:"running",startedAt:Date.now(),lastChunkTime:Date.now(),wps:0,questions:[],pendingSteerMessages:[],steer:e=>{e&&t.pendingSteerMessages.push(e)},completionPromise:E,_resolveCompletion:h,_rejectCompletion:S,progress:[],history:[]},b.push(t));let l={chunks:[],totalWords:0};s.onSubagentUpdate&&s.onSubagentUpdate();let i=[],M={...s,taskId:r,onHistoryUpdate:e=>{t.history=[...e]},onAskMain:async e=>{let n=`q-${Date.now()}-${Math.floor(Math.random()*1e3)}`,o=null,k=new Promise(T=>{o=T}),c={id:n,question:e,answered:!1,answer:null,askedAt:Date.now(),_resolve:o};return t.questions.push(c),t.status="waiting",s.onSubagentUpdate&&s.onSubagentUpdate(),p(`[SYSTEM] Background subagent "${t.title}" is WAITING FOR YOUR INPUT: "${e}"
|
|
2
2
|
Respond using tool: [action:Answer(id="${r}", answer="...")]
|
|
3
3
|
[/SYSTEM]`),await k},onVisualFeedback:e=>{t.lastChunkTime=Date.now();let n=e.replace(/\x1b\[[0-9;]*m/g,""),o=n.match(/[✔✘✗✖🔍📖→➕↻•]\s*([A-Za-z0-9\s-]+)/);o?t.currentTool=o[1].trim():t.currentTool=n,s.onSubagentUpdate&&s.onSubagentUpdate()},onTokenChunk:(e,n)=>{let o=Date.now();if(t.lastChunkTime=o,t.currentTool="Thinking",typeof n=="number"&&n>0){l.totalWords+=n,l.chunks.push({time:o,words:n});let k=o-400;if(l.chunks=l.chunks.filter(c=>c.time>=k),l.chunks.length>0){let c=l.chunks.reduce((v,R)=>v+R.words,0),$=l.chunks[0].time,T=Math.max(.4,(o-$)/1e3);t.wps=Math.round(c/T)}}s.onSubagentUpdate&&s.onSubagentUpdate()}};return y(u,M,A,C,null,e=>{if(t.status==="cancelled")return;if(e.startsWith("[Subagent Turn")&&i.length>0&&(t.progress.push([...i]),i=[]),e.includes("[Executing Tool]")){let o=e.match(/\[Executing Tool\]\s*([a-zA-Z0-9_]+)/);o&&(!t.currentTool||t.currentTool==="Thinking")&&(t.currentTool=o[1])}let n=e;if(n.startsWith("[Tool Result]")||n.startsWith("[Action Result]")){let o=n.split(`
|
|
4
4
|
`);o.length>5&&(n=o.slice(0,4).join(`
|
|
5
5
|
`)+`
|
|
6
|
-
... [Content/Diff Truncated from Logs] ...`)}i.push(n),s.onSubagentUpdate&&s.onSubagentUpdate()},!0,I).then(e=>{if(t.status==="cancelled"){t._resolveCompletion&&t._resolveCompletion(e);return}i.length>0&&(t.progress.push([...i]),i=[]),t.status="completed",t.finalAnswer=e,s.onSubagentUpdate&&s.onSubagentUpdate(),p(`[SYSTEM] Background subagent "${t.title}" (id: ${r}) has FINISHED. Call GetProgress(id="${r}") to see the final result. [/SYSTEM]`),t._resolveCompletion&&t._resolveCompletion(e)}).catch(async e=>{let{isTerminationSignaled:n}=await import("./ai-
|
|
6
|
+
... [Content/Diff Truncated from Logs] ...`)}i.push(n),s.onSubagentUpdate&&s.onSubagentUpdate()},!0,I).then(e=>{if(t.status==="cancelled"){t._resolveCompletion&&t._resolveCompletion(e);return}i.length>0&&(t.progress.push([...i]),i=[]),t.status="completed",t.finalAnswer=e,s.onSubagentUpdate&&s.onSubagentUpdate(),p(`[SYSTEM] Background subagent "${t.title}" (id: ${r}) has FINISHED. Call GetProgress(id="${r}") to see the final result. [/SYSTEM]`),t._resolveCompletion&&t._resolveCompletion(e)}).catch(async e=>{let{isTerminationSignaled:n}=await import("./ai-CCVRDJ5Y.js");if(e.message==="Subagent task was cancelled."||t.status==="cancelled"||n()){t.status="cancelled",i.push("[SUBAGENT CANCELLED] Task was cancelled."),t.progress.push([...i]),s.onSubagentUpdate&&s.onSubagentUpdate(),t._resolveCompletion&&t._resolveCompletion(null);return}i.push(`[SUBAGENT FAILURE] Error: ${e.message}`),t.progress.push([...i]),t.status="failed",t.error=e.message,s.onSubagentUpdate&&s.onSubagentUpdate(),p(`[SYSTEM] Background subagent "${t.title}" (id: ${r}) FAILED with error: ${e.message}. [/SYSTEM]`),t._rejectCompletion&&t._rejectCompletion(e)}),f?`Background subagent ${r} resumed.`:U?`Background subagent started. Task ID: ${r}.${U}`:`Background subagent started. Task ID: ${r}`};export{q as invoke};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as m}from"./chunk-56EJGQU3.js";import{a as g}from"./chunk-6LM3YRRE.js";var A=async(p,a={})=>{let{runSubagent:f}=await import("./ai-
|
|
1
|
+
import{a as m}from"./chunk-56EJGQU3.js";import{a as g}from"./chunk-6LM3YRRE.js";var A=async(p,a={})=>{let{runSubagent:f}=await import("./ai-CCVRDJ5Y.js"),e=g(p,["task","instruction","prompt","model","tools","title","id"]),l=e.task||e.instruction||e.prompt,k=e.model||null,c=e.tools||null,u=e.id&&e.id!=="null"&&e.id!=="undefined"&&e.id!==""?String(e.id).trim():null;if(!l)return'ERROR: Missing "task" argument for invokeSync.';let n=null,d="";u&&(n=m.find(t=>t.id===u));let o=n?n.id:u||`subagent-sync-${Date.now()}-${Math.floor(Math.random()*1e3)}`,$=n?.history||[],b=null;if(c)try{let t=c.trim();t.startsWith("[")&&t.endsWith("]")&&(t=t.substring(1,t.length-1)),b=t.split(",").map(i=>i.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let r=e.title||(n?n.title:l.substring(0,30)),s=n;s?(s.status="running",s.task=l):(s={id:o,title:r,task:l,status:"running",startedAt:Date.now(),progress:[],history:[]},m.push(s));let y={...a,taskId:o,onHistoryUpdate:t=>{s.history=[...t]}};try{a.onVisualFeedback&&a.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${r}${n?" (Resumed)":""}`);let t=await f(l,y,k,b,null,null,!1,$);s.status="completed",s.finalAnswer=`Subagent task completed. (ID: ${o})
|
|
2
2
|
Final Answer:
|
|
3
3
|
${t}`,a.onVisualFeedback&&a.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${r} [COMPLETED]
|
|
4
4
|
`);let i=`Subagent task completed. (ID: ${o})
|
|
5
5
|
Final Answer:
|
|
6
|
-
${t}`;return d?`${i}${d}`:i}catch(t){s.status="failed",s.error=t.message;let{isTerminationSignaled:i}=await import("./ai-
|
|
6
|
+
${t}`;return d?`${i}${d}`:i}catch(t){s.status="failed",s.error=t.message;let{isTerminationSignaled:i}=await import("./ai-CCVRDJ5Y.js"),h=t.message==="Subagent task was cancelled by user."||i();if(a.onVisualFeedback){let S=h?"[CANCELLED]":"[FAILED]";a.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${r} ${S}
|
|
7
7
|
`)}return`ERROR: Subagent execution failed: ${t.message}${d}`}};export{A as invokeSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"./chunk-
|
|
1
|
+
import{b as e}from"./chunk-R325MU5U.js";import"./chunk-RQYLBV33.js";import{a as i}from"./chunk-6LM3YRRE.js";var k=async(a,c={})=>{let t=i(a,["key","keys","input","shortcut"]),s=t.key||t.keys||t.input||t.shortcut;if(!s)return'ERROR: Missing required "key" parameter for KeyPress tool.';let r=String(s).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-R325MU5U.js";import"./chunk-RQYLBV33.js";import{a as r}from"./chunk-6LM3YRRE.js";var p=async(o,u={})=>{let t=r(o,["text","input","value","autoPressEnter"]),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,3 +1,3 @@
|
|
|
1
|
-
import{a as L}from"./chunk-UM5SNZ6X.js";import{
|
|
1
|
+
import{a as L}from"./chunk-UM5SNZ6X.js";import{q as A}from"./chunk-2GG7YBNM.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";import{Ollama as b}from"ollama";var _=new Map;async function D(a,e,n){let o=`${e}::${n}`;if(_.has(o))return _.get(o);try{let u=(await a.show({model:n}))?.thinking||null;return _.set(o,u),u}catch{return _.set(o,null),null}}function E(a,e){let n=a?.values,o=Array.isArray(n)&&n.some(d=>typeof d=="boolean"),m=Array.isArray(n)&&n.some(d=>typeof d=="string");if(o)switch(e){case"Fast":return!1;case"Low":case"Medium":case"Standard":case"High":case"xHigh":return!0;default:return!0}if(m)switch(e){case"Fast":return n.includes("low")?"low":!1;case"Low":return"low";case"Medium":case"Standard":return"medium";case"High":case"xHigh":return"high";default:return"medium"}let u={Fast:!1,Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"};return u[e]!==void 0?u[e]:!0}var $=async function*(a,e,n,o,m,u,d,x,O=1,H="Cloud"){let s=[];o&&s.push({role:"system",content:o});for(let t of n){let r=t.role==="user"?"user":"assistant",c="",w=[];if(Array.isArray(t.parts)){c=t.parts.map(l=>l.text||"").filter(Boolean).join(`
|
|
2
2
|
`);for(let l of t.parts){let k=l.inlineData||l.inline_data;k&&k.data&&w.push(k.data)}}else c=t.text||"";if(c||w.length>0){let l={role:r,content:c};w.length>0&&(l.images=w),s.push(l)}}let C=a===A||H==="Local"||!a||a==="LOCAL",y=C?process.env.OLLAMA_HOST||"http://127.0.0.1:11434":process.env.OLLAMA_HOST||"https://ollama.com",M={host:y};!C&&a&&(M.headers={Authorization:"Bearer "+a});let T=new b(M),i=[],g=null,v=Date.now(),h=!1,f=L("Ollama",e,m),p;if(f!==null)p=f==="false"||f===!1?!1:f==="true"||f===!0?!0:f;else{let t=await D(T,y,e);p=E(t,m)}if(p&&e&&e.toLowerCase().includes("gemma4")){let t=s.findIndex(r=>r.role==="system");t!==-1?s[t].content.includes("<|think|>")||(s[t].content=`<|think|>
|
|
3
3
|
${s[t].content}`):s.unshift({role:"system",content:"<|think|>"})}let S={model:e,messages:s,stream:!0,think:p,keep_alive:"10m",tools:[],tool_choice:"none",options:{temperature:O}},N=await T.chat(S);for await(let t of N){if(x?.aborted)throw new DOMException("The user aborted a request.","AbortError");if(t.message?.thinking&&(i.push({text:t.message.thinking,thought:!0}),h=!0),t.message?.content&&(i.push({text:t.message.content}),h=!0),t.done){let r=t.prompt_eval_cached_count||0;if(!r&&t.prompt_eval_count){let c=t.prompt_eval_duration||0;c>0&&c<5e7&&(r=t.prompt_eval_count)}g={totalTokenCount:(t.prompt_eval_count||0)+(t.eval_count||0),promptTokenCount:t.prompt_eval_count||0,candidatesTokenCount:t.eval_count||0,cachedContentTokenCount:r,thoughtsTokenCount:0},h=!0}(t.done||Date.now()-v>=150&&h)&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:g},i=[],v=Date.now(),h=!1)}h&&(i.length>0||g)&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:g})};export{$ as getOllamaStream};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as o}from"./chunk-
|
|
1
|
+
import{f as o}from"./chunk-RQYLBV33.js";import{a as n}from"./chunk-6LM3YRRE.js";var m=async(r,c={})=>{let t=typeof r=="string"?n(r,["canvasMode","canvas_mode"]):r||{},a=t.canvasMode===!0||t.canvasMode==="true"||t.canvas_mode===!0||t.canvas_mode==="true";try{let e=await o({canvasMode:a});if(e&&e.base64)return{text:`Screen recaptured${a?" (static canvas grid mode). New action if needed: Drag(fromGridId=int, toGridId=int). Drag mouse from start grid number to target grid number":""}`,binaryPart:{inlineData:{mimeType:e.mimeType,data:e.base64}}}}catch{}return"Screen recaptured."};export{m as recapture_screen};
|
|
@@ -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-RQYLBV33.js";export{b as CANVAS_GRID_CONFIG,a as GRID_CONFIG,f as captureGriddedScreenshot,i as coordinates720pToGridId,e as getActiveDisplay,h as gridToNativeCoordinates,g as parseGridCodeTo720p,d as rawModelOnly,c as useModel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-R325MU5U.js";import"./chunk-RQYLBV33.js";import{a as t}from"./chunk-6LM3YRRE.js";var g=async(n,c={})=>{let o=t(n,["direction","amount","gridId","grid","coordinate","target","id"]),e=(o.direction||"down").toLowerCase(),i=o.amount?parseInt(o.amount,10):6,d=o.gridId||o.grid||o.coordinate||o.target||o.id||null;return await r("scroll",d,{direction:e,amount:i})};export{g as scroll};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as lt}from"./chunk-6LM3YRRE.js";import{b as ot}from"./chunk-
|
|
1
|
+
import{a as lt}from"./chunk-6LM3YRRE.js";import{b as ot}from"./chunk-4KFOL3UU.js";import"./chunk-2Q6KKC74.js";import"./chunk-ZGORMZE5.js";import{w as st,x as rt,y as nt,z as it}from"./chunk-NPXJIGAI.js";import T from"fs/promises";import E from"path";import V from"fast-glob";import{Minimatch as at}from"minimatch";async function B(g,f,R=g,p=1){if(p>12)return[];let d=[],o;try{o=await T.readdir(g,{withFileTypes:!0})}catch{return[]}for(let e of o){let n=E.join(g,e.name),x=E.relative(R,n),v=x.split(E.sep).map(W=>W.toLowerCase()),G=e.name.toLowerCase();if(!f.some(W=>{let z=W.toLowerCase();return z.startsWith(".")&&G.endsWith(z)?!0:v.some(L=>L===z||L.startsWith(".pnpm"))}))if(e.isDirectory()){let W=await B(n,f,R,p+1);d=d.concat(W)}else e.isFile()&&d.push({fullPath:n,relativePath:x})}return d}function ut(g,f,R=1/0){if(g===f)return 0;if(g.length===0)return f.length;if(f.length===0)return g.length;if(Math.abs(g.length-f.length)>R)return R+1;let p=Array.from({length:f.length+1},(d,o)=>o);for(let d=1;d<=g.length;d++){let o=[d],e=d;for(let n=1;n<=f.length;n++){let x=g[d-1]===f[n-1]?0:1,v=Math.min(o[n-1]+1,p[n]+1,p[n-1]+x);o.push(v),v<e&&(e=v)}if(p=o,e>R)return R+1}return p[f.length]}function gt(g,f){if(!g||!f)return!1;let R=g.toLowerCase(),p=f.toLowerCase();if(R.includes(p))return!0;let d=R.split(/[^a-z0-9]+/).filter(e=>e.length>0),o=p.split(/[^a-z0-9]+/).filter(e=>e.length>1||p.length===1&&e.length>0);return o.length===0?!1:o.every(e=>{let n=e.length<=2?0:e.length<=5?1:2;for(let x of d)if(x.includes(e)||e.length>=3&&x.length>=3&&Math.abs(x.length-e.length)<=n&&ut(e,x,n)<=n)return!0;return!1})}var Pt=async g=>{let{keyword:f,path:R,fuzzy:p,subString:d,regex:o}=lt(g,["keyword","path"]);if(f==null)return'ERROR: Missing "keyword" argument.';let e=String(f),n=R,x=!1;if(n){let{resolvedPath:t,isTildeResolved:c}=it(n);n=t,x=c;let i=n.trim().toLowerCase();if(i==="#docs"||i==="#doc"||i==="#documentation"||i.includes("#skill/global/fluxflow")||i.startsWith("#skill"))return"ERROR: Cannot search in reserved VFS '#skill' namespace. Use 'ReadFile' to read specific skills."}let v=t=>t===!0||t==="true"||t===1||t==="1"||t==="yes",G=o===!1||o==="false"||o===0||o==="0"||o==="no",A=o===!0||o==="true"||o===1||o==="1"||o==="yes",W=v(p)||v(d),z=null,L=null,q=t=>{let c=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=/^\w/.test(t)?"(?<![\\w])":"",k=/\w$/.test(t)?"(?![\\w])":"";return new RegExp(`${i}${c}${k}`,"i")};if(G)W||(L=q(e));else{try{let t=A?e:e.replace(/\(\?i\)/g,"");if(!A&&t.includes("||")&&(t=t.replace(/\|\|/g,"|")),!A&&t.includes("|")){let c=t.split("|").map(i=>i.trim()).filter(Boolean);t=c.length>0?c.join("|"):t}if(!A&&t.trim()==="")throw new Error("empty regex after (?i) cleanup");z=new RegExp(t,"i")}catch(t){if(A)return`ERROR: Invalid regex pattern "${e}": ${t.message}`}L=q(e)}let M=Array.from(new Set([...st,...rt(process.cwd())])),J=150;try{let t=[],c=process.cwd(),i=null;if(n){let l=s=>s.startsWith("!")||!s.startsWith("-")?s:"!"+s.replace(/^-+/,""),h=n.split(/[;,]/).map(s=>s.trim()).filter(Boolean).map(l).filter(s=>s!=="!"),u=s=>{let y=s.startsWith("!"),P=y?s.slice(1):s;return/^(\*\.)?\.[A-Za-z0-9][A-Za-z0-9._-]*$/.test(P)||/^\*\.[A-Za-z0-9][A-Za-z0-9._-]*$/.test(P)?(y?"!":"")+`**/*.${P.replace(/^(\*\.|\.)/,"")}`:s};h=h.map(u);let b=h.some(s=>s.startsWith("!")),K=s=>V.isDynamicPattern(s)||/[*?{}[\]()|+]/.test(s),$=h.filter(s=>!K(s));if(h.some(K)){i="glob";let s=n.replace(/\\/g,"/"),y=null;if($.length>0&&$.length<h.length){y={};for(let r of $){let a=r.replace(/[\\/]+$/,"").replace(/\\/g,"/");try{let m=await T.stat(E.resolve(c,a));y[r]=m.isDirectory()?`${a}/**`:a}catch{y[r]=`${a}/**`}}}let P=h.map(r=>y&&y[r]!==void 0?y[r]:r.replace(/\\/g,"/")),_=M.map(r=>r.startsWith(".")?`**/*${r}`:`**/${r}/**`);if(b&&!h.some(r=>!r.startsWith("!"))){let r=await B(c,M,c),a=w=>w.endsWith("/")?w+"**":w,m=P.filter(w=>w.startsWith("!")).map(w=>a(w.slice(1))),S=P.filter(w=>!w.startsWith("!")).map(a);t=r.filter(w=>{let F=w.relativePath.replace(/\\/g,"/"),X=S.length===0||S.some(N=>{try{return new at(N).match(F)}catch{return!1}}),H=m.some(N=>{try{return new at(N).match(F)}catch{return!1}});return X&&!H})}else{let r=P.some(m=>/[\(\)\|]|\.\*/.test(m)),a=[];if(!r)try{a=await V(P,{cwd:c,ignore:_,dot:!0,onlyFiles:!0,absolute:!1})}catch{a=[]}if(a.length===0&&(r||V.isDynamicPattern(s))){let m=s.match(/^([^\*\?\(\)\|\[\]\s]+)\//),S=m&&!/[\*\?\(\)\|\[\]]/.test(m[1])?E.resolve(c,m[1]):c,w=await B(S,M,c);try{let F=s.replace(/^\.\//,"");F=F.replace(/\.\*\/(\\.|[^\/])/g,".*$1"),!F.startsWith("^")&&!F.startsWith(".*")&&(F=`.*${F}`);let X=new RegExp(F.endsWith("$")?F:`${F}$`,"i");t=w.filter(H=>{let N=H.relativePath.replace(/\\/g,"/");return X.test(N)})}catch{t=[]}}else t=a.map(m=>({fullPath:E.resolve(c,m),relativePath:m}))}}else{let s=[],y=!1,P=!1,_=h.map(r=>({raw:r,fullPath:E.resolve(c,r.replace(/[\/\\]+$/,""))})),et=_.filter(r=>!_.some(a=>a!==r&&(r.fullPath+E.sep).startsWith(a.fullPath+E.sep)));for(let{raw:r,fullPath:a}of et)try{let m=await T.stat(a);if(m.isDirectory()){P=!0;let S=await B(a,M,c);s.push(...S)}else if(m.isFile())y=!0,s.push({fullPath:a,relativePath:E.relative(c,a)});else return`ERROR: Path is neither a file nor a directory: ${r}`}catch{return`ERROR: Path not found: ${r}`}t=s,y&&!P?i="file":i="dir"}}else t=await B(c,M);let k=t.map(async l=>{try{let h=await T.readFile(l.fullPath,"utf-8");if(h.includes("\0"))return[];let u=h.split(/\r?\n/),b=[];for(let $=0;$<u.length;$++)(W?u[$].toLowerCase().includes(e.toLowerCase())||gt(u[$],e):G?L&&L.test(u[$]):z&&z.test(u[$])||L&&L.test(u[$]))&&b.push({line:$+1,content:u[$].trim()});return b.length===0?null:{path:l.relativePath.replace(/\\/g,"/"),matches:b}}catch{return[]}}),ct=await Promise.all(k),D=[],C=0;for(let l of ct){if(!l||!l.matches)continue;if(C>=J)break;let h=J-C,u=l.matches.slice(0,h);D.push({path:l.path,matches:u}),C+=u.length}typeof global.gc=="function"&&global.gc();let I=null;if(D.length===0){let l=i==="file"?` in '${n}'`:i==="dir"||i==="glob"?` in '${n}'`:". Try to specify files",h=i==="dir"?"[DIR]":i==="glob"?"[GLOB]":"";return`${h}${h?" ":""}Found 0 matches of '${e}'${l}${I?` ${I}`:""}`}let U=I?` ${I}`:"",Q=`${D.length} file${D.length===1?"":"s"}`,j=`${C} match${C===1?"":"es"}`,Z;i==="file"?Z=`Found ${j} of '${e}' in '${n}'${U}:`:i==="dir"||i==="glob"?Z=`Found ${j} of '${e}' in '${n}' across ${Q}${U}:`:Z=`Found ${j} of '${e}' across ${Q}${U}:`;let Y=i==="dir"?"[DIR]":i==="glob"?"[GLOB]":"",O=`${Y}${Y?" ":""}${Z}
|
|
2
2
|
|
|
3
3
|
`,tt="";try{let l=await ot();l?.systemSettings?.alwaysAskFiles&&(tt=l.systemSettings.alwaysAskFiles)}catch{}for(let l of D)if(O+=`${l.path}:
|
|
4
4
|
`,nt(l.path,tt)){let u=l.matches.map(b=>`Line ${b.line}`).join(", ");O+=` ${u}. Line snapshot not available due to file restriction policy. ReadFile if needed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m}from"./chunk-
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m}from"./chunk-BA3CAHVB.js";import{q as a}from"./chunk-2GG7YBNM.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";export{a as NULL_KEY_SENTINEL,b as getAPIKey,c as getProviderAPIKey,h as getSearchSecrets,f as getSecret,m as removeAPIKey,l as removeSecret,e as replaceActiveProviderKey,i as saveAPIKey,d as saveProviderAPIKey,k as saveSearchId,j as saveSearchKey,g as saveSecret};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A,B,C,D,E,F,G,H,I,J,K,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,z}from"./chunk-2GG7YBNM.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";export{a as HIDDEN_FROM_SUMMARY,q as NULL_KEY_SENTINEL,b as PROVIDER_DEFS,D as addProviderKey,K as buildListLines,H as cleanProviderKeys,x as clearAllTempKeys,y as clearTempKey,j as countProviderKeys,J as formatBaseUrl,o as getActiveIndex,d as getCanonicalProviders,k as getMaxSlots,g as getProviderLabel,i as getProviderSlots,n as getProviderSummary,v as getTempKey,w as hasTempKey,l as hasUnlockedSlots,f as isHiddenFromSummary,s as isNullMode,e as isUrlBearing,m as markRepoStarred,I as maskKey,h as migrateFromLegacy,c as normalizeProvider,F as removeProviderKey,E as replaceActiveProviderKey,A as resolveAPIKey,B as resolveBaseUrl,p as setActiveIndex,z as setNoticeHandler,t as setNullMode,u as setTempKey,r as supportsNullKey,G as useProviderKey,C as validateOpenAIBaseUrl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-
|
|
1
|
+
import{a,b,c}from"./chunk-4KFOL3UU.js";import"./chunk-2Q6KKC74.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";export{a as PROVIDER_BASE_URLS,b as loadSettings,c as saveSettings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as F,h as C,i as y,j as P}from"./chunk-OO34QR3O.js";import{a as E}from"./chunk-2RTYI6K3.js";import{a as M}from"./chunk-6LM3YRRE.js";import{o as w}from"./chunk-
|
|
1
|
+
import{g as F,h as C,i as y,j as P}from"./chunk-OO34QR3O.js";import{a as E}from"./chunk-2RTYI6K3.js";import{a as M}from"./chunk-6LM3YRRE.js";import{o as w}from"./chunk-QPUQJOH3.js";import{b as $}from"./chunk-4KFOL3UU.js";import"./chunk-2Q6KKC74.js";import"./chunk-ZGORMZE5.js";import{z as R}from"./chunk-NPXJIGAI.js";import p from"fs";import N from"path";var q=async(S,v={})=>{let n=M(S,["path","allowMultiple","searchContent*","replaceContent*","newContent*"]),e=n.path;if(!e)return'ERROR: Missing "path" argument for PatchFile.';let{resolvedPath:O,isTildeResolved:T}=R(e);e=O;let{patchPairs:i,allowMultiple:b,error:d}=F(n);if(d)return`ERROR: ${d}`;if(i.length===0)return"ERROR: No valid replacement pairs found. Use searchContent1, newContent1, etc.";let k=n.allowMultiple!==void 0?n.allowMultiple===!0||String(n.allowMultiple).toLowerCase()==="true":b,l=N.resolve(process.cwd(),e);try{if(!p.existsSync(l))return`ERROR: File [${e}] does not exist. Use WriteFile instead.`;let t=v.forcedContent||p.readFileSync(l,"utf8");t.startsWith("\uFEFF")&&(t=t.slice(1));let o=t.replace(/\r\n/g,`
|
|
2
2
|
`).replace(/\r/g,`
|
|
3
3
|
`),{content:a,results:s}=C(o,i,{allowMultiple:k}),c=s.filter(r=>!r.success),u=s.filter(r=>r.success);if(u.length===0)return`ERROR: Patch Failed to apply to [${e}].
|
|
4
4
|
${c.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,x,y}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,x,y}from"./chunk-QPUQJOH3.js";import"./chunk-4KFOL3UU.js";import"./chunk-2Q6KKC74.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";export{p as addToUsage,c as calculateTokenCost,v as checkImageQuota,s as checkQuota,r as checkQuotaDetailed,e as forceFlushUsage,y as getAllUsageData,q as getCustomPeriodUsage,j as getDailyUsage,t as getImageQuotaBuckets,u as getImageQuotaLimit,w as getImageQuotaStats,k as getMonthlyUsage,h as getTimedUsage,l as incrementUsage,i as initUsage,d as invalidateCachedBaseUrl,n as onCodeChange,g as purgeTimedUsage,o as recordCodeChange,x as recordImageGeneration,f as recordTimedUsage,m as runtimeSession,b as sendUsageFinalize,a as sendUsageHeartbeat};
|