fluxflow-cli 4.44.0 → 4.45.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-5NWQNNMC.js +1 -0
- package/dist/chunks/app-KYCCN4ZF.js +333 -0
- package/dist/chunks/{auto_completion-FSSLSASK.js → auto_completion-MS7UGN4H.js} +1 -1
- package/dist/chunks/{chunk-VHCXFHUU.js → chunk-5UIG3YUH.js} +1 -1
- package/dist/chunks/{chunk-UFLKOWYM.js → chunk-EIJ6AAGK.js} +1 -1
- package/dist/chunks/chunk-HTOLY3HR.js +1 -0
- package/dist/chunks/{chunk-3HU67EUI.js → chunk-KYQFLMZE.js} +11 -11
- package/dist/chunks/chunk-MKC4AVAL.js +44 -0
- package/dist/chunks/chunk-OECY2H5A.js +943 -0
- package/dist/chunks/{chunk-2SMAZY6E.js → chunk-TPUNXYGC.js} +1 -1
- package/dist/chunks/chunk-TQOQHYJ6.js +33 -0
- package/dist/chunks/chunk-UXLD7KTZ.js +1 -0
- package/dist/chunks/chunk-YEVCTH3B.js +1 -0
- package/dist/chunks/chunk-YSMPGXV3.js +1 -0
- package/dist/chunks/{click-C4LULADR.js → click-TFBIMVSS.js} +2 -2
- package/dist/chunks/{computer_action-HG5P5DOG.js → computer_action-DM2RWE3G.js} +1 -1
- package/dist/chunks/{drag-CIAOFEBD.js → drag-VXALN3P3.js} +1 -1
- package/dist/chunks/{exec_command-GXJWBNEI.js → exec_command-BDFXJQZJ.js} +1 -1
- package/dist/chunks/{generate_image-RAFSX2PO.js → generate_image-ABIDYET4.js} +1 -1
- package/dist/chunks/getProgress-J34K43Y7.js +24 -0
- package/dist/chunks/{invoke-K5DKH37G.js → invoke-7HHBCMTV.js} +2 -2
- package/dist/chunks/{invokeSync-U5FLY2AB.js → invokeSync-AULNCDC5.js} +2 -2
- package/dist/chunks/{key_press-3MUADXYA.js → key_press-YIUO27XG.js} +1 -1
- package/dist/chunks/{keyboard_typing-RDYAUO2I.js → keyboard_typing-Q5CUT6YK.js} +1 -1
- package/dist/chunks/{mistral-KIAEM23F.js → mistral-YTTOZB2J.js} +1 -1
- package/dist/chunks/{model_config-Q3PYM77Y.js → model_config-JTMSQGKH.js} +1 -1
- package/dist/chunks/{nvidia-2N7GMNVP.js → nvidia-ON4Q6Q26.js} +1 -1
- package/dist/chunks/{recapture_screen-CGAT4ZDO.js → recapture_screen-ILVFVUJF.js} +1 -1
- package/dist/chunks/{screen_grid-PAVYL4U2.js → screen_grid-MSVBHIGV.js} +1 -1
- package/dist/chunks/{scroll-V3SVOZW6.js → scroll-5XSQ6ZBZ.js} +1 -1
- package/dist/chunks/{search_keyword-OHDFK7MO.js → search_keyword-VY5KXDOB.js} +1 -1
- package/dist/chunks/secrets-HXB3H4UI.js +1 -0
- package/dist/chunks/secrets_v2-AEJNZCOS.js +1 -0
- package/dist/chunks/{settings-PADKHNGC.js → settings-XLD5ZEHD.js} +1 -1
- package/dist/chunks/{update_file-XM5PHLQU.js → update_file-VOCN7OPY.js} +1 -1
- package/dist/chunks/{usage-PVC3CXDR.js → usage-TNW22X3Y.js} +1 -1
- package/dist/chunks/{usageServer-SMP52LUG.js → usageServer-TAVWXYT6.js} +1 -1
- package/dist/chunks/{write_file-NTWH4NCN.js → write_file-R6BAMSDH.js} +1 -1
- package/dist/cli.js +5 -5
- package/dist/package.json +2 -2
- package/package.json +2 -2
- package/dist/chunks/ai-3J4SUC3U.js +0 -1
- package/dist/chunks/app-JSYMH7WB.js +0 -332
- package/dist/chunks/chunk-BB5UISPJ.js +0 -1
- package/dist/chunks/chunk-H3IDSRDO.js +0 -1
- package/dist/chunks/chunk-JDSDLNHL.js +0 -1
- package/dist/chunks/chunk-NN5WVXEF.js +0 -938
- package/dist/chunks/chunk-SML2NARF.js +0 -44
- package/dist/chunks/chunk-TXMOUQPV.js +0 -33
- package/dist/chunks/getProgress-FXNG2ISE.js +0 -26
- package/dist/chunks/secrets-FRPTIOJI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as f}from"./chunk-
|
|
1
|
+
import{h as f}from"./chunk-5UIG3YUH.js";import{mouse as c,keyboard as i,Button as u,Key as e,Point as l,clipboard as g}from"@nut-tree-fork/nut-js";c.config.autoDelayMs=50;i.config.autoDelayMs=50;async function w(){try{await i.releaseKey(e.LeftControl,e.RightControl,e.LeftAlt,e.RightAlt,e.LeftShift,e.RightShift,e.LeftSuper,e.RightSuper)}catch{}}async function h(n,t,s={}){let r=await f(t);if(!r&&(n==="move"||n==="click"||n==="drag"))return`ERROR: Invalid target location specified: ${JSON.stringify(t)}`;try{switch(n.toLowerCase()){case"move":return await c.setPosition(new l(r.x,r.y)),`Moved mouse to grid target ${typeof t=="string"?t:`(${r.x}, ${r.y})`}`;case"click":{await c.setPosition(new l(r.x,r.y));let a=s.button==="right"?u.RIGHT:s.button==="middle"?u.MIDDLE:u.LEFT;return s.clickType==="double"?await c.doubleClick(a):await c.click(a),`${s.clickType||"Single"} clicked ${s.button||"left"} button at ${typeof t=="string"?t:`(${r.x}, ${r.y})`}`}case"drag":{let a=await f(s.from||t),o=await f(s.to);return!a||!o?'ERROR: Drag requires valid "from" and "to" target coordinates/grid codes.':(await c.setPosition(new l(a.x,a.y)),await c.pressButton(u.LEFT),await c.setPosition(new l(o.x,o.y)),await c.releaseButton(u.LEFT),`Dragged mouse from (${a.x}, ${a.y}) to (${o.x}, ${o.y})`)}case"scroll":{let a=r||await f({x:640,y:360});a&&(await c.setPosition(new l(a.x,a.y)),await new Promise(d=>setTimeout(d,60)));let o=parseInt(s.amount,10);(isNaN(o)||o<=0)&&(o=5);let y=o>50?Math.min(20,Math.max(1,Math.round(o/100))):Math.min(20,o),R=s.direction==="up";for(let d=0;d<y;d++)R?await c.scrollUp(120):await c.scrollDown(120),await new Promise(L=>setTimeout(L,20));return`Scrolled ${s.direction||"down"} (${y} notches${r?` at target (${r.x}, ${r.y})`:" at screen center"})`}default:return`ERROR: Unsupported mouse action "${n}"`}}catch(a){return`ERROR: Mouse action failed: ${a.message}`}}var m={enter:e.Enter,return:e.Return,escape:e.Escape,esc:e.Escape,backspace:e.Backspace,tab:e.Tab,space:e.Space,up:e.Up,down:e.Down,left:e.Left,right:e.Right,ctrl:e.LeftControl,control:e.LeftControl,alt:e.LeftAlt,shift:e.LeftShift,cmd:e.LeftCmd,win:e.LeftWin,meta:e.LeftWin,super:e.LeftSuper,a:e.A,b:e.B,c:e.C,d:e.D,e:e.E,f:e.F,g:e.G,h:e.H,i:e.I,j:e.J,k:e.K,l:e.L,m:e.M,n:e.N,o:e.O,p:e.P,q:e.Q,r:e.R,s:e.S,t:e.T,u:e.U,v:e.V,w:e.W,x:e.X,y:e.Y,z:e.Z,0:e.Num0,1:e.Num1,2:e.Num2,3:e.Num3,4:e.Num4,5:e.Num5,6:e.Num6,7:e.Num7,8:e.Num8,9:e.Num9,f1:e.F1,f2:e.F2,f3:e.F3,f4:e.F4,f5:e.F5,f6:e.F6,f7:e.F7,f8:e.F8,f9:e.F9,f10:e.F10,f11:e.F11,f12:e.F12},p=n=>{if(!n)return;let t=String(n).toLowerCase().trim();if(m[t]!==void 0)return m[t];if(e[n]!==void 0)return e[n];if(e[t.toUpperCase()]!==void 0)return e[t.toUpperCase()]};async function E(n,t,s={}){try{switch(n.toLowerCase()){case"type":{if(typeof t!="string")return"ERROR: Type action requires a valid string input";await w(),await g.setContent(t);let a=process.platform==="darwin"?e.LeftSuper:e.LeftControl;return await i.pressKey(a,e.V),await i.releaseKey(a,e.V),await w(),s.autoPressEnter?(await new Promise(o=>setTimeout(o,50)),await i.type(e.Enter),`Typed text input ("${t.length>20?t.substring(0,20)+"...":t}") and pressed Enter`):`Typed text input ("${t.length>20?t.substring(0,20)+"...":t}")`}case"key_press":{let r=p(t);return r===void 0?`ERROR: Unknown key name "${t}"`:(await i.type(r),`Pressed key ${t}`)}case"key_combination":{if(!Array.isArray(t))return'ERROR: key_combination requires an array of keys (e.g. ["ctrl", "c"])';let r=t.map(a=>p(a)).filter(a=>a!==void 0);return r.length===0?"ERROR: Invalid key combination":(await i.pressKey(...r),await i.releaseKey(...r),`Executed key combination [${t.join(" + ")}]`)}case"clear_input":return await i.pressKey(e.LeftControl,e.A),await i.releaseKey(e.LeftControl,e.A),await i.type(e.Backspace),"Cleared active text input (Select All + Backspace)";case"browser_back":{let r=process.platform==="darwin";return r?(await i.pressKey(e.LeftSuper,e.Left),await i.releaseKey(e.LeftSuper,e.Left)):(await i.pressKey(e.LeftAlt,e.Left),await i.releaseKey(e.LeftAlt,e.Left)),await w(),`Browser back navigation (${r?"Cmd+Left":"Alt+Left"})`}default:return`ERROR: Unsupported keyboard action "${n}"`}}catch(r){return`ERROR: Keyboard action failed: ${r.message}`}}export{h as a,E as b};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{a as E,d as $,e as D}from"./chunk-KYQFLMZE.js";import{a as j}from"./chunk-Y5JU726N.js";import{spawn as S}from"child_process";var v=null;try{let u=await import("node-pty");v=u.default||u}catch{}var M=!!v,y=u=>typeof u!="string"?u:u.replace(/(?:\u001b][\s\S]*?(?:\u0007|\u001b\\))|(?:[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><])/g,""),L=u=>{if(!u)return"";let p=[[]],t=0,o=0,m=/\x1b\[([0-9;]*?)([a-zA-Z])/g,g=0,d,h=x=>{for(let e=0;e<x.length;e++){let s=x[e];if(s===`
|
|
2
|
+
`)for(t++,o=0;t>=p.length;)p.push([]);else if(s==="\r")o=0;else{for(;t>=p.length;)p.push([]);let n=p[t];for(;o>n.length;)n.push(" ");n[o]=s,o++}}};for(;(d=m.exec(u))!==null;){h(u.substring(g,d.index));let x=d[1],e=d[2],s=x?x.split(";").map(Number):[];if(e==="A"){let n=s[0]||1;t=Math.max(0,t-n)}else if(e==="B"){let n=s[0]||1;for(t=t+n;t>=p.length;)p.push([])}else if(e==="C"){let n=s[0]||1;o=o+n}else if(e==="D"){let n=s[0]||1;o=Math.max(0,o-n)}else if(e==="G"){let n=(s[0]||1)-1;o=Math.max(0,n)}else if(e==="H"||e==="f"){let n=(s[0]||1)-1,l=(s[1]||1)-1;for(t=Math.max(0,n),o=Math.max(0,l);t>=p.length;)p.push([])}else if(e==="K"){let n=s[0]||0;if(t<p.length){let l=p[t];if(n===0)l.length=o;else if(n===1)for(let c=0;c<o&&c<l.length;c++)l[c]=" ";else n===2&&(l.length=0)}}else if(e==="J"){let n=s[0]||0;(n===2||n===3)&&(p.length=0,p.push([]),t=0,o=0)}g=m.lastIndex}h(u.substring(g));let w=p.map(x=>x.join(""));for(;w.length>0&&w[w.length-1]==="";)w.pop();return w.join(`
|
|
3
|
+
`)},b=null,C=!1,F=u=>{try{b&&(C&&typeof b.write=="function"?b.write(u):b.stdin&&b.stdin.writable&&b.stdin.write(u))}catch{}},q=()=>{if(b){try{C&&typeof b.destroy=="function"?b.destroy():typeof b.kill=="function"&&(process.platform==="win32"?S("taskkill",["/pid",b.pid,"/f","/t"]):b.kill("SIGKILL"))}catch{}b=null,C=!1}},A=(u,p=!1)=>{if(process.platform!=="win32"||process.env.ADJUST_WINDOWS_COMMAND!=="true")return u;let t=[],o="",m=null,g=!1;for(let e=0;e<u.length;e++){let s=u[e];if(g){o+=s,g=!1;continue}if(s==="\\"){if(!m&&u[e+1]===" "){o+=" ",e++;continue}o+=s,g=!0;continue}m?(s===m&&(m=null),o+=s):s==='"'||s==="'"?(m=s,o+=s):s===";"&&!o.includes("://")?(o.length>0&&(t.push(o),o=""),t.push(p?";":"&")):s==="&"&&!o.includes("://")?u[e+1]==="&"?(o.length>0&&(t.push(o),o=""),t.push("&&"),e++):o.endsWith("2>")&&u[e+1]==="1"?(t.push("2>&1"),o="",e++):(o.length>0&&(t.push(o),o=""),t.push("&")):s==="|"&&!o.includes("://")?(o.length>0&&(t.push(o),o=""),t.push("|")):(s===">"||s==="<")&&(e===0||/\s|['"]/.test(u[e-1]||""))?(o.length>0&&(t.push(o),o=""),s===">"&&u[e+1]===">"?(t.push(">>"),e++):t.push(s)):/\s/.test(s)?o.length>0&&(t.push(o),o=""):o+=s}o.length>0&&t.push(o);let d=e=>!(!e.includes("/")||/^(https?|file|ftp):\/\//i.test(e)||e.startsWith("@")||e.startsWith("/")&&(e.match(/\//g)||[]).length===1||/\s\/|\/\s/.test(e)||/[\(\)\{\}\;\<\>\=\'\"]/.test(e)),h=[];for(let e=0;e<t.length;e++){let s=t[e];if(s==="mkdir"&&p&&$()){let n=[],l=e+1;for(;l<t.length;){let c=t[l];if([">",">>","<","&","&&","|","||",";"].includes(c))break;c!=="-p"&&c!=="--parents"&&c!=="-v"&&c!=="--verbose"&&n.push(c),l++}if(n.length>0){let c=n.map(a=>{let i=a.replace(/^['"]|['"]$/g,""),r=a;return d(i)&&(r=a.replace(/\//g,"\\")),r});h.push("New-Item","-ItemType","Directory","-Force","-Path",c.join(","))}else h.push("New-Item","-ItemType","Directory","-Force");e=l-1;continue}if(s==="rm"&&p&&$()){let n=[],l=!1,c=!1,a=e+1;for(;a<t.length;){let r=t[a];if([">",">>","<","&","&&","|","||",";"].includes(r))break;r==="-rf"||r==="-fr"?(l=!0,c=!0):r==="-r"||r==="-R"||r==="--recursive"?l=!0:r==="-f"||r==="--force"?c=!0:n.push(r),a++}let i=["Remove-Item"];if(l&&i.push("-Recurse"),c&&i.push("-Force"),n.length>0){let r=n.map(f=>{let P=f.replace(/^['"]|['"]$/g,""),O=f;return d(P)&&(O=f.replace(/\//g,"\\")),O});i.push("-Path",r.join(","))}h.push(...i),e=a-1;continue}if(s==="cp"&&p&&$()){let n=[],l=!1,c=!1,a=e+1;for(;a<t.length;){let r=t[a];if([">",">>","<","&","&&","|","||",";"].includes(r))break;r==="-r"||r==="-R"||r==="--recursive"?l=!0:r==="-f"||r==="--force"?c=!0:n.push(r),a++}let i=["Copy-Item"];if(l&&i.push("-Recurse"),c&&i.push("-Force"),n.length>0){let r=n.map(f=>{let P=f.replace(/^['"]|['"]$/g,""),O=f;return d(P)&&(O=f.replace(/\//g,"\\")),O});if(r.length>1){let f=r.pop();i.push("-Path",r.join(","),"-Destination",f)}else i.push("-Path",r[0])}h.push(...i),e=a-1;continue}if(s==="touch"&&p&&$()){let n=[],l=e+1;for(;l<t.length;){let c=t[l];if([">",">>","<","&","&&","|","||",";"].includes(c))break;n.push(c),l++}if(n.length>0){let a=`(${n.map(i=>{let r=i.replace(/^['"]|['"]$/g,""),f=i;return d(r)&&(f=i.replace(/\//g,"\\")),f}).join(", ")}) | ForEach-Object { if (Test-Path $_) { (Get-Item $_).LastWriteTime = [System.DateTime]::Now } else { $null | Out-File -FilePath $_ } }`;h.push(a)}e=l-1;continue}if(s==="|"&&t[e+1]==="tee"){t[e+2]==="-a"?(h.push(">>"),e+=2):(h.push(">"),e+=1);continue}if(s==="|"&&t[e+1]==="cat"&&t[e+2]===">"){h.push(">"),e+=2;continue}if(s==="|"){let n=t[e+1];if(n){let l=n.replace(/^['"]|['"]$/g,""),c=/\.(txt|md|json|log|csv|html|css|py|js|xml|yaml|yml|pdf|docx|pptx|xlsx)$/i.test(l);if(d(l)&&c){h.push(">");continue}}}h.push(s)}let w=!1,x=h.map(e=>{if(e==="echo")return w=!0,e;[">",">>","<","&","&&","|","||",";"].includes(e)&&(w=!1);let n=/^['"]|['"]$/.test(e),l=e;w&&n&&(l=e.replace(/^['"]|['"]$/g,""));let c=/^['"]|['"]$/.test(l),a=l.replace(/^['"]|['"]$/g,"");d(a)&&(l=l.replace(/\//g,"\\"));let i=l.replace(/^['"]|['"]$/g,"");return i.includes(" ")&&!c&&(l=`"${i}"`),l});if(p){let e="",s=0;for(let n=0;n<x.length;n++){let l=x[n];l==="&&"?(e+="; if ($?) {",s++):l===";"?(e+=" }".repeat(s)+";",s=0):(e&&!e.endsWith(" ")&&!e.endsWith("{")&&(e+=" "),e+=l)}return e+=" }".repeat(s),e}return x.join(" ")},B=async(u,p={})=>{let t=j(u),o=t.command,{onChunk:m}=p;if(!o)return'ERROR: Missing "command" argument for Run.';let g=t.usePowershell===!0||t.usePowershell==="true"||t.usePowershell===1||t.forcePowershell===!0||t.forcePowershell==="true"||t.forcePowershell===1||t.useCwd===!0||t.useCwd==="true"||t.useCwd===1||t.useCmd===!0||t.useCmd==="true"||t.useCmd===1||t.forceCwd===!0||t.forceCwd==="true"||t.forceCwd===1||t.forceCmd===!0||t.forceCmd==="true"||t.forceCmd===1,d=process.platform==="win32",h=p.systemSettings||{},w={};return h.networkAccess===!1&&(w.HTTP_PROXY="http://127.0.0.1:9999",w.HTTPS_PROXY="http://127.0.0.1:9999",w.ALL_PROXY="socks5://127.0.0.1:9999",w.http_proxy="http://127.0.0.1:9999",w.https_proxy="http://127.0.0.1:9999",w.all_proxy="socks5://127.0.0.1:9999",w.NO_PROXY="localhost,127.0.0.1"),new Promise(x=>{let e=s=>{let n=s==="pwsh"||s==="powershell",l=s==="bash",c=l?o:A(o,n),a;d?s==="bash"?a=E()||"bash.exe":s==="pwsh"?a="pwsh.exe":s==="powershell"?a="powershell.exe":a="cmd.exe":a=process.env.SHELL||"bash";let i=d?l?["-c",c]:n?["-NoProfile","-Command",c]:["/c",c]:["-c",c];if(h.networkAccess===!1&&!d){let r=a,f=[...i];if(process.platform==="linux")a="unshare",i=["-n","-r",r,...f];else if(process.platform==="darwin"){let P=`(version 1)
|
|
4
|
+
(allow default)
|
|
5
|
+
(deny network-outbound)
|
|
6
|
+
(allow network-outbound (remote ip "localhost:*"))
|
|
7
|
+
(allow network-outbound (remote ip "127.0.0.1:*"))
|
|
8
|
+
`;a="sandbox-exec",i=["-p",P,r,...f]}}if(v)try{let r=v.spawn(a,i,{name:"xterm-256color",cols:p.cols||120,rows:p.rows||30,cwd:process.cwd(),env:{...process.env,CI:"false",TERM:"xterm-256color",FORCE_COLOR:"1",...w}});b=r,C=!0;let f="",P=!1;return r.onData(O=>{if(!P){f+=O,m&&m(O);let R=y(f);/(?:Network:\s+use\s+--host\s+to|Network:\s+Type\s+--host\s+to|Local:\s+http:\/\/localhost:\d+|ready in \d+\s*ms|Compiled successfully|Development server is running|Listening on:)/i.test(R)&&(P=!0,setTimeout(()=>x(`Dev server started successfully in background.
|
|
9
|
+
|
|
10
|
+
${R}`),500))}}),r.onExit(({exitCode:O})=>{if(P)return;b=null;let R=L(f||""),N=y(R).replace(/\n{3,}/g,`
|
|
11
|
+
|
|
12
|
+
`)||"Command executed with no output.";x(O!==0?`ERROR: Command [${o}] failed with exit code [${O}].
|
|
13
|
+
|
|
14
|
+
${N}`:`Command [${o}] completed.
|
|
15
|
+
|
|
16
|
+
${N}`)}),!0}catch(r){return d&&(s==="bash"||s==="pwsh"||s==="powershell")&&r.code==="ENOENT"?!1:(k(x,c,o,w,m,s,h),!0)}else return k(x,c,o,w,m,s,h),!0};if(d){let s=!g&&h.preferBash!==!1,n=D(s);e(n)||(n==="bash"?e("pwsh")||e("powershell")||e("cmd"):n==="pwsh"?e("powershell")||e("cmd"):n==="powershell"&&e("cmd"))}else e("bash")})},k=(u,p,t,o,m,g="powershell",d={})=>{let h=process.platform==="win32",w=g==="pwsh"||g==="powershell",x=g==="bash",e;h?g==="bash"?e=E()||"bash.exe":g==="pwsh"?e="pwsh.exe":g==="powershell"?e="powershell.exe":e="cmd.exe":e=process.env.SHELL||"bash";let s=h?x?["-c",p]:w?["-NoProfile","-Command",p]:["/c",p]:["-c",p];if(d.networkAccess===!1&&!h){let i=e,r=[...s];if(process.platform==="linux")e="unshare",s=["-n","-r",i,...r];else if(process.platform==="darwin"){let f=`(version 1)
|
|
17
|
+
(allow default)
|
|
18
|
+
(deny network-outbound)
|
|
19
|
+
(allow network-outbound (remote ip "localhost:*"))
|
|
20
|
+
(allow network-outbound (remote ip "127.0.0.1:*"))
|
|
21
|
+
`;e="sandbox-exec",s=["-p",f,i,...r]}}let n=h?S(e,s,{cwd:process.cwd(),env:{...process.env,...o}}):S(e,s,{cwd:process.cwd(),env:{...process.env,CI:"false",TERM:"xterm-256color",FORCE_COLOR:"1",...o}});b=n,C=!1,n.stdin&&n.stdin.on("error",()=>{b=null});let l="",c="",a=!1;n.stdout.on("data",i=>{if(!a){let r=i.toString();l+=r,m&&m(r);let f=y(l);/(?:Network:\s+use\s+--host\s+to|Network:\s+Type\s+--host\s+to|Local:\s+http:\/\/localhost:\d+|ready in \d+\s*ms|Compiled successfully|Development server is running|Listening on:)/i.test(f)&&(a=!0,setTimeout(()=>u(`Dev server started successfully in background.
|
|
22
|
+
|
|
23
|
+
${f}`),500))}}),n.stderr.on("data",i=>{if(!a){let r=i.toString();c+=r,m&&m(r)}}),n.on("close",i=>{if(a)return;b=null;let r=[],f=L(l),P=L(c);f&&r.push(`STDOUT:
|
|
24
|
+
${f}`),P&&r.push(`STDERR:
|
|
25
|
+
${P}`),i!==0&&r.push(`EXIT CODE: ${i}`);let O=r.join(`
|
|
26
|
+
|
|
27
|
+
`)||"Command executed with no output.",R=y(O).replace(/\n{3,}/g,`
|
|
28
|
+
|
|
29
|
+
`);u(i!==0?`ERROR: Command [${t}] failed with exit code [${i}].
|
|
30
|
+
|
|
31
|
+
${R}`:`Command [${t}] completed.
|
|
32
|
+
|
|
33
|
+
${R}`)}),n.on("error",i=>{if(h&&i.code==="ENOENT"){if(g==="bash"){let f=A(t,!0);return k(u,f,t,o,m,"pwsh",d)}else if(g==="pwsh"){let f=A(t,!0);return k(u,f,t,o,m,"powershell",d)}else if(g==="powershell"){let f=A(t,!1);return k(u,f,t,o,m,"cmd",d)}}b=null;let r=i instanceof Error?i.message:String(i);u(`ERROR: Failed to start command [${t}]: ${r}`)})};export{M as a,y as b,L as c,b as d,C as e,F as f,q as g,A as h,B as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as P,h as c,i as K,t as u}from"./chunk-YEVCTH3B.js";import{c as E,d as l}from"./chunk-P5HBJA23.js";import{e as A}from"./chunk-26BQ45XP.js";import o from"fs-extra";import f from"path";c();var s=f.join(A,"secrets.json"),N=async()=>{try{let t=E(s,{});if(t.API_KEY)return t.API_KEY}catch{}return null},m=async(t,e={})=>{try{let n=await u(t,e);if(n)return n}catch{}try{let n=E(s,{});if(t==="Google")return n.GOOGLE_API_KEY||n.API_KEY||null;if(t==="DeepSeek")return n.DEEPSEEK_API_KEY||null;if(t==="OpenRouter")return n.OPENROUTER_API_KEY||null;if(t==="Mistral")return n.MISTRAL_API_KEY||null;if(t==="NVIDIA")return n.NVIDIA_API_KEY||null;if(t==="Ollama")return n.OLLAMA_API_KEY||"LOCAL";if(t==="InferX")return n.INFERX_API_KEY||null;if(t==="SenseNova"||t==="Sensenova")return n.SENSENOVA_API_KEY||null;if(t==="Poolside"||t==="poolside")return n.POOLSIDE_API_KEY||null;if(t==="9router"||t==="9Router")return n["9ROUTER_API_KEY"]||"LOCAL";if(t==="ExpLabs"||t==="ExperientialLabs"||t==="ExperimentalLabs"||t==="explabs")return n.EXPLABS_API_KEY||n.EXPERIENTIALLABS_API_KEY||null;if(t==="TokenHarbor"||t==="Token Harbor"||t==="tokenharbor"||t==="token_harbor"||t==="thk")return n.TOKENHARBOR_API_KEY||n.TOKEN_HARBOR_API_KEY||null;if(t==="Infron"||t==="infron")return n.INFRON_API_KEY||null;if(t==="APInex"||t==="apinex"||t==="apx")return n.APINEX_API_KEY||null;if(t==="xKiro"||t==="xkiro"||t==="kiro")return n.XKIRO_API_KEY||null;if(t==="c_openai"||t==="Custom (OpenAI)")return n.CUSTOM_OPENAI_API_KEY||n.C_OPENAI_API_KEY||null}catch{}return null},w=async(t,e)=>{try{let{addProviderKey:n}=await import("./secrets_v2-AEJNZCOS.js"),I=P(t)||t;K(I).some(_=>_&&(typeof _=="string"?_.trim():_.key))?await n(I,e):await n(I,e,{index:0});return}catch{}t==="Google"?(await a("GOOGLE_API_KEY",e),await a("API_KEY",e)):t==="DeepSeek"?await a("DEEPSEEK_API_KEY",e):t==="OpenRouter"?await a("OPENROUTER_API_KEY",e):t==="Mistral"?await a("MISTRAL_API_KEY",e):t==="NVIDIA"?await a("NVIDIA_API_KEY",e):t==="Ollama"?await a("OLLAMA_API_KEY",e):t==="InferX"?await a("INFERX_API_KEY",e):t==="SenseNova"||t==="Sensenova"?await a("SENSENOVA_API_KEY",e):t==="Poolside"||t==="poolside"?await a("POOLSIDE_API_KEY",e):t==="9router"||t==="9Router"?await a("9ROUTER_API_KEY",e):t==="ExpLabs"||t==="ExperientialLabs"||t==="ExperimentalLabs"||t==="explabs"?await a("EXPLABS_API_KEY",e):t==="TokenHarbor"||t==="Token Harbor"||t==="tokenharbor"||t==="token_harbor"||t==="thk"?await a("TOKENHARBOR_API_KEY",e):t==="Infron"||t==="infron"?await a("INFRON_API_KEY",e):t==="APInex"||t==="apinex"||t==="apx"?await a("APINEX_API_KEY",e):t==="xKiro"||t==="xkiro"||t==="kiro"?await a("XKIRO_API_KEY",e):(t==="c_openai"||t==="Custom (OpenAI)")&&await a("CUSTOM_OPENAI_API_KEY",e)},h=async t=>{try{return E(s,{})[t]||null}catch{return null}},a=async(t,e)=>{await o.ensureDir(A);let n=E(s,{});n[t]=e,l(s,n,!0)},T=async()=>{try{let t=E(s,{});return{key:t.GOOGLE_API_KEY||t.API_KEY,cx:t.SEARCH_ID}}catch{}return{key:null,cx:null}},y=async t=>a("API_KEY",t),b=async t=>a("GOOGLE_API_KEY",t),D=async t=>a("SEARCH_ID",t),O=async t=>{try{let e=E(s,{});delete e[t],l(s,e,!0)}catch{}},g=async()=>O("API_KEY");export{N as a,m as b,w as c,h as d,a as e,T as f,y as g,b as h,D as i,O as j,g as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as N,d as L}from"./chunk-P5HBJA23.js";import{e as E}from"./chunk-26BQ45XP.js";import b from"fs-extra";import D from"path";var R=D.join(E,"secrets_v2.json"),y=10,j=new Set(["9router","c_openai"]),H=new Set(["c_openai"]),w=[{canonical:"Google",secret:["GOOGLE_API_KEY","API_KEY"],aliases:["gemini"]},{canonical:"DeepSeek",secret:["DEEPSEEK_API_KEY"],aliases:["deepseek-ai","deepseekai"]},{canonical:"OpenRouter",secret:["OPENROUTER_API_KEY"],aliases:["open router","open_router"]},{canonical:"NVIDIA",secret:["NVIDIA_API_KEY"],aliases:["nvidia nim"]},{canonical:"Mistral",secret:["MISTRAL_API_KEY"],aliases:[]},{canonical:"Ollama",secret:["OLLAMA_API_KEY"],aliases:[]},{canonical:"InferX",secret:["INFERX_API_KEY"],aliases:["infer x","inferx"]},{canonical:"SenseNova",secret:["SENSENOVA_API_KEY"],aliases:["sensenova","sense nova"]},{canonical:"AIHubMix",secret:["AIHUBMIX_API_KEY"],aliases:["aihubmix","ai hub mix"]},{canonical:"Poolside",secret:["POOLSIDE_API_KEY"],aliases:[]},{canonical:"9router",secret:["9ROUTER_API_KEY"],aliases:["9router","9-router","nine router"]},{canonical:"ExpLabs",secret:["EXPLABS_API_KEY","EXPERIENTIALLABS_API_KEY"],aliases:["explabs","experientiallabs","experimentallabs","experiential labs"]},{canonical:"TokenHarbor",secret:["TOKENHARBOR_API_KEY","TOKEN_HARBOR_API_KEY"],aliases:["tokenharbor","token harbor","token_harbor","thk"]},{canonical:"Infron",secret:["INFRON_API_KEY"],aliases:["infron"]},{canonical:"APInex",secret:["APINEX_API_KEY"],aliases:["apinex","apx"]},{canonical:"xKiro",secret:["XKIRO_API_KEY"],aliases:["xkiro","kiro"]},{canonical:"c_openai",secret:["CUSTOM_OPENAI_API_KEY","C_OPENAI_API_KEY"],aliases:["custom","custom (openai)","custom openai"]}],O=new Map;for(let e of w){O.set(e.canonical.toLowerCase(),e.canonical);for(let t of e.aliases)O.set(t.toLowerCase(),e.canonical)}var m=e=>!e||typeof e!="string"?null:O.get(e.trim().toLowerCase())||null,V=()=>w.map(e=>e.canonical),S=e=>H.has(e),ee=e=>j.has(e);var te=e=>{let t=m(e)||e;return t==="c_openai"?"custom":t},Y=()=>new Array(y).fill(null),f=e=>e?typeof e=="string"?e.trim().length>0:typeof e=="object"?!!(e.key&&String(e.key).trim()):!1:!1,I=e=>e?typeof e=="string"?e:typeof e=="object"&&e.key?e.key:null:null,A=e=>{let t=Y();if(Array.isArray(e))for(let s=0;s<y&&s<e.length;s++)t[s]=e[s]??null;else typeof e=="string"&&e.trim()&&(t[0]=e);return t},k=()=>{try{return N(R,{})||{}}catch{return{}}},g=e=>{try{b.existsSync(E)||b.mkdirSync(E,{recursive:!0}),L(R,e,!0)}catch{}},T=!1,ne=async()=>{if(!T){T=!0;try{await b.pathExists(R);let e=D.join(E,"secrets.json");if(!await b.pathExists(e))return;let t=N(e,{})||{},s=k(),o=!1;for(let r of w){let a=A(s[r.canonical]);if(a.some(f)){s[r.canonical]=a;continue}let n=null;for(let c of r.secret)if(t[c]){n=t[c];break}n&&(S(r.canonical)?a[0]={key:n,baseUrl:""}:a[0]=n,s[r.canonical]=a,o=!0)}o&&g(s)}catch{}}},K=e=>{let t=m(e)||e,s=k();return A(s[t])},X=e=>K(e).filter(f).length,se=()=>w.filter(e=>!j.has(e.canonical)).map(e=>{let t=X(e.canonical);return{provider:e.canonical,count:t,hasKeys:t>0}}),C=async()=>{try{let{loadSettings:e}=await import("./settings-XLD5ZEHD.js"),t=await e();return t&&t.activeKeyIndex||{}}catch{return{}}},G=async e=>{try{let{loadSettings:t,saveSettings:s}=await import("./settings-XLD5ZEHD.js"),o=await t();o.activeKeyIndex=e,await s(o)}catch{}},_=async e=>{let t=m(e)||e,o=(await C())[t];return Number.isInteger(o)?o:null},h=async(e,t)=>{let s=m(e)||e,o=await C();return o[s]=t,await G(o),t},x=new Map,oe=(e,t,s=void 0)=>{let o=m(e)||e,r={key:t};s!==void 0&&(r.baseUrl=s),x.set(o,r)},re=e=>{let t=m(e)||e;return x.get(t)||null},ae=e=>x.has(m(e)||e),ce=()=>x.clear(),ie=e=>x.delete(m(e)||e),U=null,le=e=>{U=typeof e=="function"?e:null},z=e=>{try{U&&U(e)}catch{}},v=async()=>{try{let{loadSettings:e}=await import("./settings-XLD5ZEHD.js"),t=await e();return t.systemSettings&&t.systemSettings.customOpenAIBaseUrl||""}catch{return""}},ue=async(e,t={})=>{let s=m(e)||e,o=t.silent===!0,r=x.get(s);if(r&&r.key)return r.key;let a=K(s),n=await _(s);if(Number.isInteger(n)&&n>=0&&n<y&&f(a[n]))return I(a[n]);let c=a.findIndex(f);return c!==-1?(o||(await h(s,c),z(`No active key set for ${s}. Auto-selected slot ${c+1}.`)),I(a[c])):null},fe=async e=>{let t=m(e)||e;if(!S(t))return null;let s=x.get(t);if(s&&s.key)return s.baseUrl!==void 0?s.baseUrl:await v();let o=K(t),r=await _(t);if(Number.isInteger(r)&&r>=0&&r<y){let n=o[r];if(n&&typeof n=="object"&&n.key)return n.baseUrl||""}let a=o.findIndex(f);if(a!==-1){let n=o[a];if(n&&typeof n=="object")return n.baseUrl||""}return await v()},$=async(e,t,s)=>{if(S(e)){let o=s!==void 0?s:await v();return{key:t,baseUrl:o}}return t},F=(e,t)=>{let s=String(t),o=[],r=[];return e.forEach((a,n)=>{let c=I(a);c&&(c===s?o.push(n):c.includes(s)&&r.push(n))}),o.length?o:r},me=async(e,t,s={})=>{let o=m(e)||e;if(!t||!String(t).trim())return{ok:!1,error:"Empty key."};let r=String(t).trim(),a=k(),n=A(a[o]);if(n.some(l=>I(l)===r))return{ok:!1,error:`Key already exists in slot ${n.findIndex(u=>I(u)===r)+1}.`};if(Number.isInteger(s.index)){let l=s.index;if(l<0||l>=y)return{ok:!1,error:`Index must be between 1 and ${y}.`};let u=n[l]&&typeof n[l]=="object"?n[l].baseUrl:void 0;return n[l]=await $(o,r,u),a[o]=n,g(a),{ok:!0,index:l}}let c=n.findIndex(l=>!f(l));return c===-1?{ok:!1,error:"All slots full. Specify an index to overwrite.",full:!0}:(n[c]=await $(o,r),a[o]=n,g(a),{ok:!0,index:c})},pe=async(e,t,s={})=>{let o=m(e)||e,r=k(),a=A(r[o]);if(s.all||t==="--all"||t==="__all__")return r[o]=Y(),g(r),await h(o,null),{ok:!0,all:!0,remaining:0,needsNewKey:!0};let n=-1;if(t==null){let i=await _(o);if(n=Number.isInteger(i)&&f(a[i])?i:a.findIndex(f),n===-1)return{ok:!1,error:"No keys to remove."}}else if(Number.isInteger(t)){if(n=t,n<0||n>=y)return{ok:!1,error:`Index must be between 1 and ${y}.`};if(!f(a[n]))return{ok:!1,error:`Slot ${n+1} is already empty.`}}else{let i=F(a,t);if(i.length===0)return{ok:!1,error:"No matching key found."};if(i.length>1)return{ok:!1,error:`Duplicate match (slots ${i.map(d=>d+1).join(", ")}). Be more specific.`};n=i[0]}let c=I(a[n]),l=await _(o)===n;a[n]=null,r[o]=a,g(r);let u=a.filter(f).length;if(l){let i=a.findIndex(f);await h(o,i===-1?null:i)}return{ok:!0,removed:c,removedIndex:n,remaining:u,needsNewKey:u===0}},ye=async(e,t)=>{let s=m(e)||e,o=K(s),r=-1;if(Number.isInteger(t)){if(r=t,r<0||r>=y)return{ok:!1,error:`Index must be between 1 and ${y}.`};if(!f(o[r]))return{ok:!1,error:`Slot ${r+1} is empty.`}}else{let n=F(o,t);if(n.length===0)return{ok:!1,error:"No matching key found."};if(n.length>1)return{ok:!1,error:`Duplicate match (slots ${n.map(c=>c+1).join(", ")}). Be more specific.`};r=n[0]}await h(s,r);let a=null;if(S(s)){let n=o[r],c=n&&typeof n=="object"&&n.baseUrl?n.baseUrl.trim():"";if(c)try{let{loadSettings:l,saveSettings:u}=await import("./settings-XLD5ZEHD.js"),i=await l();if((i.systemSettings&&i.systemSettings.customOpenAIBaseUrl?i.systemSettings.customOpenAIBaseUrl.trim():"")!==c){let p={...i.systemSettings||{},customOpenAIBaseUrl:c,memory:!1};await u({...i,systemSettings:p}),a=c}}catch{}}return{ok:!0,index:r,key:I(o[r]),switchedBaseUrl:a}},de=async(e=null)=>{let t=k(),s=e?[m(e)||e]:V(),o=0;for(let r of s){let a=A(t[r]),n=a.filter(f);if(n.length===0){t[r]=a;continue}let c=await _(r),l=Number.isInteger(c)&&f(a[c])?a[c]:null,u=Y();n.forEach((d,p)=>{u[p]=d});let i=Number.isInteger(c)?c:null;if(l){let d=a.slice(0,y).map((p,P)=>({s:p,i:P})).filter(p=>f(p.s)).findIndex(p=>p.i===c);i=d===-1?null:d}t[r]=u,i!==c&&await h(r,i),o++}return g(t),{ok:!0,providers:s.length,touched:o}},M=e=>{if(!e)return"";let t=String(e),s=t.length;if(s<=3)return"...";let o=Math.floor(s/3),r=t.slice(0,o),a=t.slice(s-o);return r+"..."+a},J=e=>{if(!e)return"";let t=String(e).replace(/\/+$/,"");return t.length<=28?t:"..."+t.replace(/^https?:\/\//i,"").slice(-24)},Ie=async(e,t={})=>{let s=t.unmask===!0,o=m(e)||e,r=K(o),a=await _(o),n=x.get(o),c=[];n&&n.key&&c.push(`Temporary: ${s?n.key:M(n.key)}`);for(let l=0;l<y;l++){let u=r[l],i=I(u),d=i&&!s?M(i):i,p;if(!i)p="Empty";else if(S(o)){let B=u&&typeof u=="object"?J(u.baseUrl):"";p=B?`${d} (Saved: ${B})`:d}else p=d;let P=l===a&&i?" \u2190 active":"";c.push(`${l+1}: ${p}${P}`)}return c};export{j as a,w as b,m as c,V as d,S as e,ee as f,te as g,ne as h,K as i,X as j,se as k,_ as l,h as m,oe as n,re as o,ae as p,ce as q,ie as r,le as s,ue as t,fe as u,me as v,pe as w,ye as x,de as y,M as z,J as A,Ie as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as m,f as c}from"./chunk-P5HBJA23.js";import{b as s}from"./chunk-26BQ45XP.js";import r from"fs-extra";import p from"path";var o={mode:"Flux",display:0,thinkingLevel:"Medium",aiProvider:"",activeModel:"",activeKeyIndex:{},showFullThinking:!0,apiTier:"Free",quotas:{agentLimit:999999,backgroundLimit:999999,searchLimit:100,customModelId:"",customLimit:0,providerTiers:{Google:"Free",DeepSeek:"Free",NVIDIA:"Free",OpenRouter:"Free",InferX:"Free",SenseNova:"Free",Poolside:"Free",ExpLabs:"Free",TokenHarbor:"Free",Infron:"Free",APInex:"Free",xKiro:"Free",c_openai:"Free"}},systemSettings:{customOpenAIBaseUrl:"",memory:!1,theme:"Dark",compression:0,autoExec:!0,allowExternalAccess:!1,advanceRollback:!1,autoDeleteHistory:"7d",useExternalData:!1,externalDataPath:"",preserveThinking:!0,loadingPhrases:!1,progressiveRendering:!0,showTPMEstimate:!0,subAgents:!1,CustomSubAgent:!1,SubAgentModel:"Default",SubAgentProvider:"",dynamicDirAwareness:!1,indentationTree:!0,ollamaEndpoint:"Cloud",compressToolResults:!1,autoTruncateResults:!0,agentFinishSound:!1,imageHistoryCU:"Standard",contextLength:"256k",keepReasoningContext:!1,autoExcludeMetadata:!1,disableTodo:!1,preferBash:!1,clipboardContext:!1,cacheCalculateMode:"Session",alwaysAskFiles:".env, .env.*, *.env"},profileData:{preset:"Default",name:null,nickname:null,instructions:null},imageSettings:{keyType:"Default",quality:"Low-High",apiKey:""},autoCompletion:{enabled:!1,model:"Default",provider:"",baseUrl:""}},I={Mistral:"https://api.mistral.ai/v1/chat/completions",DeepSeek:"https://api.deepseek.com/chat/completions",OpenRouter:"https://openrouter.ai/api/v1/chat/completions",NVIDIA:"https://integrate.api.nvidia.com/v1",Ollama:"https://ollama.com/v1",InferX:"https://model.inferx.net/endpoints/v1/chat/completions",SenseNova:"https://token.sensenova.ai/v1/chat/completions",Poolside:"https://inference.poolside.ai/v1/chat/completions",ExpLabs:"https://api.experientiallabs.ai/v1/chat/completions",TokenHarbor:"https://tokenharbor.ai/v1/chat/completions",Infron:"https://llm.onerouter.pro/v1/chat/completions",APInex:"https://api.apinex.bond/v1/chat/completions",xKiro:"https://api.xkiro.com/v1/chat/completions",AIHubMix:"https://aihubmix.com/v1/chat/completions",Google:"https://generativelanguage.googleapis.com/v1beta/openai/chat/completions"},g=async()=>{let t={...o};try{if(await r.exists(s)){let e=m(s);if(e.imageSettings&&e.imageSettings.apiKey)try{let a=e.imageSettings.apiKey,{saveSecret:i}=await import("./secrets-HXB3H4UI.js");await i("POLLINATIONS_API_KEY",a),e.imageSettings.apiKey="",c(s,e)}catch{}t={...o,...e,quotas:{...o.quotas,...e.quotas,providerTiers:{...o.quotas.providerTiers,...e.quotas?.providerTiers||{}}},systemSettings:{...o.systemSettings,...e.systemSettings},profileData:{...o.profileData,...e.profileData},imageSettings:{...o.imageSettings,...e.imageSettings},autoCompletion:{...o.autoCompletion,...e.autoCompletion}}}}catch(e){console.error("Failed to load settings:",e)}try{let{getSecret:e}=await import("./secrets-HXB3H4UI.js"),a=await e("POLLINATIONS_API_KEY");a&&(t.imageSettings.apiKey=a)}catch{}if(t.showFullThinking===!1){t.showFullThinking=!0;try{c(s,t)}catch{}}return t},d=async t=>{let{FLUXFLOW_DIR:e}=await import("./paths-RQRI2XRY.js"),a=["logs","secret"];for(let i of a){let l=p.join(e,i),n=p.join(t,i);try{await r.exists(l)&&(await r.ensureDir(n),await r.copy(l,n,{overwrite:!0}))}catch(u){console.error(`Migration failed for ${i}:`,u)}}},D=async t=>{try{let e=await g();if(!e.systemSettings.useExternalData&&t.systemSettings?.useExternalData&&t.systemSettings?.externalDataPath&&await d(t.systemSettings.externalDataPath),t.imageSettings&&t.imageSettings.apiKey!==void 0){let{saveSecret:i,removeSecret:l}=await import("./secrets-HXB3H4UI.js"),n=t.imageSettings.apiKey;n?await i("POLLINATIONS_API_KEY",n):await l("POLLINATIONS_API_KEY")}let a={...e,...t};a.systemSettings&&(a.systemSettings.dynamicDirAwareness=!1),a.imageSettings&&(a.imageSettings={...a.imageSettings,apiKey:""}),await r.ensureDir(p.dirname(s)),c(s,a);try{let{invalidateCachedBaseUrl:i}=await import("./usage-TNW22X3Y.js");i()}catch{}return!0}catch(e){return console.error("Failed to save settings:",e),!1}};export{I as a,g as b,D as c};
|
|
@@ -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 C=null;async function tt(){return C||(C=(async()=>{let{createWorker:t}=await import("tesseract.js"),o=await import("fs-extra"),{CU_CACHE_DIR:e}=await import("./paths-RQRI2XRY.js");return o.ensureDirSync(e),t("eng",1,{cachePath:e,logger:()=>{}})})().catch(t=>{throw C=null,t})),C}var I=null,F=null;async function et(){let{getActiveDisplay:t}=await import("./screen_grid-
|
|
1
|
+
import{a as W}from"./chunk-TPUNXYGC.js";import{g as B,i as S}from"./chunk-5UIG3YUH.js";import{a as P}from"./chunk-Y5JU726N.js";import X from"screenshot-desktop";import O from"sharp";import j from"fs-extra";import G from"path";import"@nut-tree-fork/nut-js";async function U(t,o,e){if(!(!process.env.SHOW_DEBUG_GRID&&!process.env.DEBUG_OCR))try{let s=G.resolve(process.cwd(),"screenshots",t);await j.ensureDir(s),await j.writeFile(G.join(s,o),e)}catch{}}function K(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Q(t,o,e=1/0){if(t===o)return 0;if(t.length===0)return o.length;if(o.length===0)return t.length;if(Math.abs(t.length-o.length)>e)return e+1;let s=Array.from({length:o.length+1},(r,i)=>i);for(let r=1;r<=t.length;r++){let i=[r],a=r;for(let n=1;n<=o.length;n++){let c=t[r-1]===o[n-1]?0:1,l=Math.min(i[n-1]+1,s[n]+1,s[n-1]+c);i.push(l),l<a&&(a=l)}if(s=i,a>e)return e+1}return s[o.length]}function V(t){return t<=4?0:t<=8?1:2}async function H(t,o=3){let e=await O(t).metadata();return O(t).resize(Math.round(e.width*o),Math.round(e.height*o),{kernel:"lanczos3"}).greyscale().normalise().toBuffer()}function Y(t){if(!t)return{words:[],lines:[]};let o=[],e=new Map;for(let r of t.split(`
|
|
2
|
+
`)){let i=r.split(" ");if(i.length<12||parseInt(i[0])!==5)continue;let n=i[2],c=i[3],l=i[4],w=parseInt(i[6]),x=parseInt(i[7]),R=parseInt(i[8]),M=parseInt(i[9]),f=parseFloat(i[10]),h=i.slice(11).join(" ").trim();if(!h||f<0)continue;let p={x0:w,y0:x,x1:w+R,y1:x+M},g={text:h,confidence:f,bbox:p};o.push(g);let u=`${n}_${c}_${l}`;e.has(u)||e.set(u,{words:[],bbox:{x0:1/0,y0:1/0,x1:-1/0,y1:-1/0}});let d=e.get(u);d.words.push(g),d.bbox.x0=Math.min(d.bbox.x0,p.x0),d.bbox.y0=Math.min(d.bbox.y0,p.y0),d.bbox.x1=Math.max(d.bbox.x1,p.x1),d.bbox.y1=Math.max(d.bbox.y1,p.y1)}let s=[];for(let r of e.values())r.words.length>0&&s.push({text:r.words.map(i=>i.text).join(" "),bbox:r.bbox,words:r.words});return{words:o,lines:s}}function Z(t){if(!(t.words&&t.words.length>0)){if(t.blocks&&t.blocks.length>0){t.words=[],t.lines=[];for(let o of t.blocks)for(let e of o.paragraphs||[])for(let s of e.lines||[]){s.bbox&&t.lines.push(s);for(let r of s.words||[])r.bbox&&t.words.push(r)}if(t.words.length>0)return}if(t.tsv){let o=Y(t.tsv);t.words=o.words,t.lines=o.lines}}}function L(t,o,e=0,s=0,r=1){Z(t);let i=n=>({x0:Math.round(n.x0/r)+e,y0:Math.round(n.y0/r)+s,x1:Math.round(n.x1/r)+e,y1:Math.round(n.y1/r)+s}),a=[];if(t.lines&&t.lines.length>0)for(let n of t.lines){let c=n.text?n.text.toLowerCase().trim():"";if(!c||!n.bbox||!(c===o||new RegExp(`\\b${K(o)}\\b`,"i").test(c)))continue;let w=n.words||(t.words?t.words.filter(f=>f.bbox&&f.bbox.x0>=n.bbox.x0-5&&f.bbox.x1<=n.bbox.x1+5&&f.bbox.y0>=n.bbox.y0-5&&f.bbox.y1<=n.bbox.y1+5):[]),x=o.split(/\s+/),R=x.map(f=>f.replace(/[^a-z0-9]/g,"")).join(" "),M=!1;if(w.length>0)for(let f=0;f<=w.length-x.length;f++){let h=w.slice(f,f+x.length),p=h.map(g=>(g.text||"").toLowerCase().trim().replace(/[^a-z0-9]/g,"")).join(" ");if(p===R||p.includes(R)){let g={x0:Math.min(...h.map(u=>u.bbox.x0)),y0:Math.min(...h.map(u=>u.bbox.y0)),x1:Math.max(...h.map(u=>u.bbox.x1)),y1:Math.max(...h.map(u=>u.bbox.y1))};a.push(i(g)),M=!0}}M||a.push(i(n.bbox))}if(a.length===0&&t.words&&t.words.length>0)for(let n of t.words){let c=n.text?n.text.toLowerCase().trim().replace(/[^a-z0-9]/g,""):"",l=o.replace(/[^a-z0-9]/g,"");c===l&&n.bbox&&a.push(i(n.bbox))}if(a.length===0&&t.words&&t.words.length>0){let n=V(o.length);for(let c of t.words){let l=c.text?c.text.toLowerCase().trim():"";l.length>=3&&Math.abs(l.length-o.length)<=n&&Q(l,o,n)<=n&&c.bbox&&a.push(i(c.bbox))}}return a}function N(t,o){let e=null,s=1/0;for(let r of t){let i=Math.round((r.x0+r.x1)/2),a=Math.round((r.y0+r.y1)/2),n=o.x>=r.x0&&o.x<=r.x1&&o.y>=r.y0&&o.y<=r.y1,c=Math.hypot(i-o.x,a-o.y),l=n?0:c;l<s&&(s=l,e={x:i,y:a,dist:c,containsPoint:n,bbox:r})}return e}var C=null;async function tt(){return C||(C=(async()=>{let{createWorker:t}=await import("tesseract.js"),o=await import("fs-extra"),{CU_CACHE_DIR:e}=await import("./paths-RQRI2XRY.js");return o.ensureDirSync(e),t("eng",1,{cachePath:e,logger:()=>{}})})().catch(t=>{throw C=null,t})),C}var I=null,F=null;async function et(){let{getActiveDisplay:t}=await import("./screen_grid-MSVBHIGV.js"),o=await t();if(I&&F===o)return I;F=o,I={format:"png"};try{let e=await X.listDisplays();e&&e.length>0&&(I={format:"png",screen:(e[o]||e[0]).id})}catch{}return I}var pt=async(t,o={})=>{let e=P(t),s=e.gridId||e.grid||e.coordinate||e.target||e.id,r=(e.type||e.clickType||"single").toLowerCase(),i=(e.button||"left").toLowerCase(),a=e.intendedClickText||e.text||"",n=e.ocrCorrection!==void 0?e.ocrCorrection===!0||e.ocrCorrection==="true":e.useOCR!==void 0?e.useOCR===!0||e.useOCR==="true":!1;if(!s&&!a)return'ERROR: Missing required "gridId" parameter for Click tool.';let c=s;if(n&&a)try{let x=s?B(s):null,R=await et(),M=await X(R),f=await O(M).metadata(),h=f.width||1920,p=f.height||1080,g=x?{x:Math.round(x.x*(h/1280)),y:Math.round(x.y*(p/720))}:{x:h/2,y:p/2},u=a.toLowerCase().trim(),d=await tt(),D=null,T="",q=x?320:500;if(x){let m=Math.min(Math.round(h/2),h),y=Math.min(Math.round(p/2),p),b=Math.max(0,Math.min(h-m,g.x-Math.floor(m/2))),k=Math.max(0,Math.min(p-y,g.y-Math.floor(y/2))),_=await O(M).extract({left:b,top:k,width:m,height:y}).toBuffer(),z=2,A=await H(_,z),J=u.replace(/[^a-z0-9]/g,"_");await U("cropped",`crop_${Date.now()}_${J}.png`,A),await d.setParameters({tessedit_pageseg_mode:"11"});let{data:v}=await d.recognize(A,{},{tsv:!0,blocks:!0});if(v&&v.text){let E=L(v,u,b,k,z);if(E.length>0){let $=N(E,g);$&&($.containsPoint||$.dist<=q)&&(D=$,T="centered target crop OCR")}}}if(!D){let m=await H(M,2),y=u.replace(/[^a-z0-9]/g,"_");await U("fullscreen",`full_${Date.now()}_${y}.png`,m),await d.setParameters({tessedit_pageseg_mode:"3"});let{data:b}=await d.recognize(m,{},{tsv:!0,blocks:!0});if(b&&b.text){let k=L(b,u,0,0,2);if(k.length>0){let _=N(k,g);_&&(D=_,T="full-screen OCR")}}}if(D){let m={x:Math.round(D.x*(1280/h)),y:Math.round(D.y*(720/p))},y=await W("click",m,{button:i,clickType:r});if(typeof y=="string"&&y.startsWith("ERROR:"))return y;let b=S(m),k=`${r==="double"?"Double":"Single"} clicked ${i} button`;return s&&b&&String(s)!==String(b)?`${k}. Tried clicking grid ${s}, but OCR corrected to grid ${b} (${T} for "${a}"). If the click landed unintended, try with ocr correction off.`:`${k} on grid ${b||s} (${T} for "${a}").`}}catch{}let l=await W("click",c,{button:i,clickType:r});if(typeof l=="string"&&l.startsWith("ERROR:"))return l;let w=s||(typeof c=="object"?S(c):c);return`${r==="double"?"Double":"Single"} clicked ${i} button on grid ${w}.`};export{pt as click};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i,b as s}from"./chunk-
|
|
1
|
+
import{a as i,b as s}from"./chunk-TPUNXYGC.js";import"./chunk-5UIG3YUH.js";import{a as c}from"./chunk-Y5JU726N.js";var d=async(a,p={})=>{let e=c(a),r=e.action||e.type||e.cmd,n=e.target||e.grid||e.gridCode||e.location||e.input;if(!r)return'ERROR: Missing required "action" argument for computer_action (e.g. move, click, drag, scroll, type, key_press, key_combination).';let t=r.toLowerCase();if(t.startsWith("mouse_")||["move","click","drag","scroll"].includes(t)){let o=t.replace("mouse_","");return await i(o,n,{button:e.button,clickType:e.clickType||e.type,from:e.from,to:e.to,direction:e.direction,amount:e.amount?parseInt(e.amount,10):void 0})}if(t.startsWith("key_")||t==="type"||t==="press"){let o=t;t==="press"&&(o="key_press");let u=e.autoPressEnter===!0||e.autoPressEnter==="true"||e.enter===!0||e.enter==="true";return await s(o,n||e.text||e.keys,{...e,autoPressEnter:u})}return`ERROR: Unrecognized action "${r}". Supported actions: move, click, drag, scroll, type, key_press, key_combination.`};export{d as computer_action};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-TPUNXYGC.js";import"./chunk-5UIG3YUH.js";import{a as d}from"./chunk-Y5JU726N.js";var m=async(a,i={})=>{let r=d(a),o=r.fromGridId||r.from||r.start,t=r.toGridId||r.to||r.end;return!o||!t?'ERROR: Drag requires both "fromGridId" and "toGridId" parameters.':await e("drag",o,{from:o,to:t})};export{m as drag};
|
|
@@ -1 +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-TQOQHYJ6.js";import"./chunk-KYQFLMZE.js";import"./chunk-Y5JU726N.js";export{d as activeChildProcess,h as adjustWindowsCommand,c as cleanTerminalOutput,i as exec_command,e as isActiveCommandPty,a as isPtyAvailable,b as stripAnsi,g as terminateActiveCommand,f as writeToActiveCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-6EYQQ7GQ.js";import{a as b}from"./chunk-Y5JU726N.js";import{t as B,u as T,v as $}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-6EYQQ7GQ.js";import{a as b}from"./chunk-Y5JU726N.js";import{t as B,u as T,v as $}from"./chunk-EIJ6AAGK.js";import{b as I}from"./chunk-YSMPGXV3.js";import"./chunk-HTOLY3HR.js";import"./chunk-P5HBJA23.js";import"./chunk-26BQ45XP.js";import C from"fs-extra";import x from"path";var F=(a,y={})=>{try{if(a.length<8||a[0]!==137||a[1]!==80||a[2]!==78||a[3]!==71)return a;let s=[],c=[];for(let r=0;r<256;r++){let e=r;for(let n=0;n<8;n++)e&1?e=3988292384^e>>>1:e=e>>>1;c[r]=e}let l=r=>{let e=4294967295;for(let n=0;n<r.length;n++)e=c[(e^r[n])&255]^e>>>8;return(e^4294967295)>>>0},f=(r,e)=>{let n=Buffer.from(r,"ascii"),i=Buffer.from(e,"utf-8"),u=n.length+1+i.length,o=Buffer.alloc(8+u+4);o.writeUInt32BE(u,0),o.write("tEXt",4,"ascii"),n.copy(o,8),o[8+n.length]=0,i.copy(o,8+n.length+1);let w=l(o.subarray(4,8+u));return o.writeUInt32BE(w,8+u),o};for(let[r,e]of Object.entries(y))e!=null&&s.push(f(r,String(e)));if(s.length===0)return a;if(a.subarray(12,16).toString("ascii")==="IHDR"){let e=a.subarray(0,33),n=a.subarray(33);return Buffer.concat([e,...s,n])}return a}catch{return a}},N=async(a,y={})=>{let s=b(a),c=s.prompt||s.text,l=s.path||s.outputPath||s.output||"generated_image.png",f=s.ratio;if(!c)return'ERROR: Missing "prompt" argument for generate_image.';let r=["nsfw","naked","nudity","nude","porn","sex","xxx","erotic","gore","bloody","violence","abuse","suicide","murder","hentai","pedophile","rape"],e=c.toLowerCase();if(r.some(i=>e.includes(i)))return"ERROR: Prompt blocked by system safety filter (inappropriate or unsafe content detected).";try{let i=await I();if(!await B(i))return`ERROR: Insufficient Quota for selected quality. Either tell user reduce quality or wait for next refresh cycle (${(await T()).nextResetMin||60}m).`;let o=i.imageSettings||{keyType:"Default",quality:"Low-High",apiKey:""},w=o.keyType==="Custom"&&o.apiKey?o.apiKey:FALLBACK_IMAGE_KEY,E={Low:"flux","Low-High":"zimage",Medium:"gptimage","Medium-High":"gptimage",High:"qwen-image",Ultra:"gptimage-large",Premium:"nanobanana-pro"}[o.quality]||"zimage",g=1024,m=1024;if(f){let t=f.replace(/\s+/g,"");t==="16:9"?(g=1024,m=576):t==="9:16"?(g=576,m=1024):t==="4:3"?(g=1024,m=768):t==="3:4"?(g=768,m=1024):t==="1:1"&&(g=1024,m=1024)}let M=Math.floor(Math.random()*1e7),S=`https://gen.pollinations.ai/image/${encodeURIComponent(c)}?model=${E}&width=${g}&height=${m}&seed=${M}&enhance=true&reasoning=high&quality=high&negative=${encodeURIComponent("deformed, distorted, disfigured, poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, disconnected limbs, mutation, mutated hands and fingers, blurry, low quality, low resolution, extra fingers, censored, watermarks, signatures")}`,d=await fetch(S,{method:"GET",headers:{Authorization:`Bearer ${w}`}});if(!d.ok){let t=d.status,h="";try{h=await d.text()}catch{}return t===402||h.includes("Insufficient balance")||h.includes("PAYMENT_REQUIRED")?"ERROR: Image Generation Currently unavailable. Try again later.":`ERROR: Image Generation failed with status [${t}]: ${h||"Unknown API Error"}`}if((d.headers.get("content-type")||"").includes("application/json")){let t=await d.json();return t.status===402||t.error&&t.error.code==="PAYMENT_REQUIRED"?"ERROR: Image Generation Currently unavailable. Try again later.":`ERROR: Image Generation failed: ${t.error?.message||JSON.stringify(t)}`}let O=await d.arrayBuffer(),p=Buffer.from(O),P={Title:c,Description:"Generated via FluxFlow CLI",Software:"FluxFlow CLI",Author:"FluxFlow","Creation Time":new Date().toISOString(),Prompt:c,Model:`Fluxflow:${E}`,Ratio:f||"1:1",Seed:String(M)};p=F(p,P);let R=x.resolve(process.cwd(),l);await C.ensureDir(x.dirname(R)),await k.recordFileChange(R),await C.writeFile(R,p),await $(i);let v=x.extname(l).toLowerCase(),L={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp"}[v]||"image/png";return y.isMultiModal!==!1?{text:`Image successfully generated from prompt [${c}] and saved to [${l}]. Output attached to multimodal part`,binaryPart:{inlineData:{data:p.toString("base64"),mimeType:L}}}:`Image successfully generated from prompt [${c}] and saved to [${l}].`}catch(i){return`ERROR: Failed during image generation: ${i instanceof Error?i.message:String(i)}`}};export{N as generate_image};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{a as k}from"./chunk-56EJGQU3.js";import{a as w}from"./chunk-Y5JU726N.js";var q=async(E,x={})=>{let d=w(E).id;if(!d)return'ERROR: Missing "id" argument for getProgress.';let t=k.find(r=>r.id===d);if(!t)return`ERROR: Subagent task with ID [${d}] not found.`;let s=`Subagent Task Status: ${t.status.toUpperCase()}
|
|
2
|
+
`;if(s+=`Title: ${t.title}
|
|
3
|
+
`,s+=`Task: ${t.task}
|
|
4
|
+
`,t.startedAt){let r=Math.floor((Date.now()-t.startedAt)/1e3);s+=`Elapsed Time: ${r}s
|
|
5
|
+
`}if(s+=`Turns Completed: ${t.progress.length}
|
|
6
|
+
`,t.status==="running"||t.status==="waiting"){t.currentTool&&(s+=`Current Tool: ${t.currentTool}
|
|
7
|
+
`);let i=(t.lastChunkTime?Date.now()-t.lastChunkTime:9999)<1e3&&t.wps>0?Math.round(t.wps):0;i>0&&(s+=`tok/s: ${i}
|
|
8
|
+
`)}if(t.questions&&t.questions.length>0){let r=t.questions.filter(i=>!i.answered);r.length>0&&(s+=`
|
|
9
|
+
**PENDING QUESTION**
|
|
10
|
+
`,r.forEach(i=>{s+=`"${i.question}"
|
|
11
|
+
`}),s+=`Respond using action: [action:Answer(id="${t.id}", answer="...")]
|
|
12
|
+
|
|
13
|
+
`)}return s+=`
|
|
14
|
+
Progress Log:
|
|
15
|
+
`,t.progress.forEach((r,i)=>{s+=`--- Turn ${i+1} ---
|
|
16
|
+
`;let R=r.filter(o=>!o.startsWith("[SUBAGENT SUCCESS]")).map(o=>{if(o.startsWith("[Subagent Response]")){let m="[Subagent Response]",e=o.substring(m.length),$=["action:","tool:"];for(;;){let C=e.toLowerCase(),c=-1,L="";for(let n of $){let f=C.indexOf(n);f!==-1&&(c===-1||f<c)&&(c=f,L=n)}if(c===-1)break;let h=c,p=h,S=!1,u=h-1;for(;u>=0&&/\s/.test(e[u]);)u--;u>=0&&e[u]==="["&&(p=u,S=!0);let T=0,b=!1,a=null,l=h;for(;l<e.length;){let n=e[l];if(!a&&(n==="'"||n==='"'||n==="`")?a=n:a&&n===a&&e[l-1]!=="\\"&&(a=null),a||(n==="("?(T++,b=!0):n===")"&&T--),b&&T===0&&!a){let f=l;if(S){let g=l+1;for(;g<e.length&&/\s/.test(e[g]);)g++;g<e.length&&e[g]==="]"&&(f=g)}e=e.substring(0,p)+e.substring(f+1);break}if(l++,l===e.length){e=e.substring(0,p);break}}}return m+`
|
|
17
|
+
`+e.trim()}return o.startsWith("[Executing Tool]")&&o.length>256?o.substring(0,256)+"...[truncated from logs]":o});s+=R.join(`
|
|
18
|
+
`)+`
|
|
19
|
+
|
|
20
|
+
`}),t.status==="failed"&&t.error&&(s+=`Failure Error: ${t.error}
|
|
21
|
+
`),s.replace(/\r\n/g,`
|
|
22
|
+
`).replace(/\n{3,}/g,`
|
|
23
|
+
|
|
24
|
+
`).trim().replace(/\[(?:TOOL|ACTION) RESULT\]/gi,"ACTION RESULT:")};export{q as getProgress};
|
|
@@ -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-5NWQNNMC.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-5NWQNNMC.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-5NWQNNMC.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-5NWQNNMC.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-TPUNXYGC.js";import"./chunk-5UIG3YUH.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-TPUNXYGC.js";import"./chunk-5UIG3YUH.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,2 +1,2 @@
|
|
|
1
|
-
import{a as O,b as j,c as f}from"./chunk-PTFCY2D5.js";import{a as N}from"./chunk-HFTI3R3Q.js";import"./chunk-
|
|
1
|
+
import{a as O,b as j,c as f}from"./chunk-PTFCY2D5.js";import{a as N}from"./chunk-HFTI3R3Q.js";import"./chunk-HTOLY3HR.js";import"./chunk-26BQ45XP.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-HTOLY3HR.js";import"./chunk-26BQ45XP.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-PTFCY2D5.js";import{a as W}from"./chunk-HFTI3R3Q.js";import{l as K}from"./chunk-
|
|
1
|
+
import{a as j}from"./chunk-PTFCY2D5.js";import{a as W}from"./chunk-HFTI3R3Q.js";import{l as K}from"./chunk-HTOLY3HR.js";import"./chunk-26BQ45XP.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,n=e.includes("kimi"),s=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"},ne={Fast:"64",Low:"64",Medium:"4096",Standard:"4096",High:"16384",xHigh:"16384"},se={Fast:"none",Low:"minimal",Medium:"medium",Standard:"medium",High:"max",xHigh:"max"},U=P||h||B||C?16384:32768;U=process.env.NVIDIA_BASE_URL?1024:U;let a={model:e,messages:A,max_tokens:U,stream:!0,stream_options:{include_usage:!0},temperature:H,tool_choice:"none",...J&&{thinking:te[g]||"high"}};if(!(process.env.NVIDIA_BASE_URL||ee))if(n)a.chat_template_kwargs={thinking:o};else if(s)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(ne[t]??"4096")}):B?a.chat_template_kwargs={enable_thinking:o}:C&&(a.reasoning_effort=se[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=n=>{if(k.push(n),c){let s=c;c=null,s()}},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(n=>H.map(s=>`${n}/${s}`)),L=!1,t=null,o=async()=>{try{let s=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(s&&s.queues&&s.queues[0]&&typeof s.queues[0].queueDepth=="number"){let h=s.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 n=M[Symbol.asyncIterator]();for(;;){let{value:s,done:h}=await n.next();if(h)break;L=!0,t&&(clearInterval(t),t=null),w({value:s,done:!1})}g=!0,w(null)}catch(n){if(D=n,t&&(clearInterval(t),t=null),c){let s=c;c=null,s()}}})();try{for(;;){if(D)throw D;if(k.length>0){let n=k.shift();if(n===null&&g)break;yield n.value}else{if(g)break;await new Promise(n=>{c=n})}}}finally{t&&(clearInterval(t),t=null)}};export{ue as getNVIDIAStream,he as wrapNvidiaStreamWithQueueDepth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as n}from"./chunk-
|
|
1
|
+
import{f as n}from"./chunk-5UIG3YUH.js";import{a as c}from"./chunk-Y5JU726N.js";var m=async(r,o={})=>{let t=typeof r=="string"?c(r):r||{},a=t.canvasMode===!0||t.canvasMode==="true"||t.canvas_mode===!0||t.canvas_mode==="true";try{let e=await n({canvasMode:a});if(e&&e.base64)return{text:`Screen recaptured${a?" (static canvas grid mode)":""}.`,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-5UIG3YUH.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-TPUNXYGC.js";import"./chunk-5UIG3YUH.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Y}from"./chunk-Y5JU726N.js";import{b as Q}from"./chunk-
|
|
1
|
+
import{a as Y}from"./chunk-Y5JU726N.js";import{b as Q}from"./chunk-YSMPGXV3.js";import"./chunk-HTOLY3HR.js";import"./chunk-P5HBJA23.js";import{w as V,x as q,y as J}from"./chunk-26BQ45XP.js";import K from"fs/promises";import E from"path";import j from"fast-glob";import{Minimatch as tt}from"minimatch";async function A(f,o,n=f,p=1){if(p>12)return[];let h=[],s;try{s=await K.readdir(f,{withFileTypes:!0})}catch{return[]}for(let t of s){let a=E.join(f,t.name),y=E.relative(n,a),L=y.split(E.sep).map(w=>w.toLowerCase()),O=t.name.toLowerCase();if(!o.some(w=>{let F=w.toLowerCase();return F.startsWith(".")&&O.endsWith(F)?!0:L.some(M=>M===F||M.startsWith(".pnpm"))}))if(t.isDirectory()){let w=await A(a,o,n,p+1);h=h.concat(w)}else t.isFile()&&h.push({fullPath:a,relativePath:y})}return h}function rt(f,o,n=1/0){if(f===o)return 0;if(f.length===0)return o.length;if(o.length===0)return f.length;if(Math.abs(f.length-o.length)>n)return n+1;let p=Array.from({length:o.length+1},(h,s)=>s);for(let h=1;h<=f.length;h++){let s=[h],t=h;for(let a=1;a<=o.length;a++){let y=f[h-1]===o[a-1]?0:1,L=Math.min(s[a-1]+1,p[a]+1,p[a-1]+y);s.push(L),L<t&&(t=L)}if(p=s,t>n)return n+1}return p[o.length]}function nt(f,o){if(!f||!o)return!1;let n=f.toLowerCase(),p=o.toLowerCase();if(n.includes(p))return!0;let h=n.split(/[^a-z0-9]+/).filter(t=>t.length>0),s=p.split(/[^a-z0-9]+/).filter(t=>t.length>1||p.length===1&&t.length>0);return s.length===0?!1:s.every(t=>{let a=t.length<=2?0:t.length<=5?1:2;for(let y of h)if(y.includes(t)||t.length>=3&&y.length>=3&&Math.abs(y.length-t.length)<=a&&rt(t,y,a)<=a)return!0;return!1})}var gt=async f=>{let{keyword:o,path:n,fuzzy:p,subString:h,regex:s}=Y(f);if(o==null)return'ERROR: Missing "keyword" argument.';let t=String(o);if(n){let e=n.trim().toLowerCase();if(e==="#docs"||e==="#doc"||e==="#documentation"||e.includes("#skill/global/fluxflow")||e.startsWith("#skill"))return"ERROR: Cannot search in reserved VFS '#skill' namespace. Use 'ReadFile' to read specific skills."}let a=e=>e===!0||e==="true"||e===1||e==="1"||e==="yes",y=s===!1||s==="false"||s===0||s==="0"||s==="no",L=s===!0||s==="true"||s===1||s==="1"||s==="yes",O=a(p)||a(h),G=null,w=null;if(y)O||(w=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i"));else{try{G=new RegExp(t,"i")}catch(e){if(L)return`ERROR: Invalid regex pattern "${t}": ${e.message}`}w=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i")}let F=Array.from(new Set([...V,...q(process.cwd())])),M=150;try{let e=[],P=process.cwd(),u=null;if(n){let i=r=>r.startsWith("!")||!r.startsWith("-")?r:"!"+r.replace(/^-+/,""),g=n.split(";").map(r=>r.trim()).filter(Boolean).map(i).filter(r=>r!=="!"),c=g.some(r=>r.startsWith("!"));if(g.some(r=>j.isDynamicPattern(r)||/[*?{}[\]()|+]/.test(r))){u="glob";let r=n.replace(/\\/g,"/"),l=g.map(m=>m.replace(/\\/g,"/")),z=F.map(m=>m.startsWith(".")?`**/*${m}`:`**/${m}/**`);if(c&&!g.some(m=>!m.startsWith("!"))){let m=await A(P,F,P),R=$=>$.endsWith("/")?$+"**":$,d=l.filter($=>$.startsWith("!")).map($=>R($.slice(1))),v=l.filter($=>!$.startsWith("!")).map(R);e=m.filter($=>{let x=$.relativePath.replace(/\\/g,"/"),_=v.length===0||v.some(b=>{try{return new tt(b).match(x)}catch{return!1}}),Z=d.some(b=>{try{return new tt(b).match(x)}catch{return!1}});return _&&!Z})}else{let m=l.some(d=>/[\(\)\|]|\.\*/.test(d)),R=[];if(!m)try{R=await j(l,{cwd:P,ignore:z,dot:!0,onlyFiles:!0,absolute:!1})}catch{R=[]}if(R.length===0&&(m||j.isDynamicPattern(r))){let d=r.match(/^([^\*\?\(\)\|\[\]\s]+)\//),v=d&&!/[\*\?\(\)\|\[\]]/.test(d[1])?E.resolve(P,d[1]):P,$=await A(v,F,P);try{let x=r.replace(/^\.\//,"");x=x.replace(/\.\*\/(\\.|[^\/])/g,".*$1"),!x.startsWith("^")&&!x.startsWith(".*")&&(x=`.*${x}`);let _=new RegExp(x.endsWith("$")?x:`${x}$`,"i");e=$.filter(Z=>{let b=Z.relativePath.replace(/\\/g,"/");return _.test(b)})}catch{e=[]}}else e=R.map(d=>({fullPath:E.resolve(P,d),relativePath:d}))}}else{let r=[],l=!1,z=!1;for(let k of g){let m=k.replace(/[\/\\]+$/,""),R=E.resolve(P,m);try{let d=await K.stat(R);if(d.isDirectory()){z=!0;let v=await A(R,F,P);r.push(...v)}else if(d.isFile())l=!0,r.push({fullPath:R,relativePath:E.relative(P,R)});else return`ERROR: Path is neither a file nor a directory: ${k}`}catch{return`ERROR: Path not found: ${k}`}}e=r,l&&!z?u="file":u="dir"}}else e=await A(P,F);let et=e.map(async i=>{try{let g=await K.readFile(i.fullPath,"utf-8");if(g.includes("\0"))return[];let c=g.split(/\r?\n/),W=[];for(let l=0;l<c.length;l++)(O?c[l].toLowerCase().includes(t.toLowerCase())||nt(c[l],t):y?w&&w.test(c[l]):G&&G.test(c[l])||w&&w.test(c[l]))&&W.push({line:l+1,content:c[l].trim()});return W.length===0?null:{path:i.relativePath.replace(/\\/g,"/"),matches:W}}catch{return[]}}),st=await Promise.all(et),S=[],D=0;for(let i of st){if(!i||!i.matches)continue;if(D>=M)break;let g=M-D,c=i.matches.slice(0,g);S.push({path:i.path,matches:c}),D+=c.length}typeof global.gc=="function"&&global.gc();let I=null;if(S.length===0){let i=u==="file"?` in '${n}'`:u==="dir"||u==="glob"?` in '${n}'`:". Try to specify files",g=u==="dir"?"[DIR]":u==="glob"?"[GLOB]":"";return`${g}${g?" ":""}Found 0 matches of '${t}'${i}${I?` ${I}`:""}`}let B=I?` ${I}`:"",T=`${S.length} file${S.length===1?"":"s"}`,U=`${D} match${D===1?"":"es"}`,N;u==="file"?N=`Found ${U} of '${t}' in '${n}'${B}:`:u==="dir"||u==="glob"?N=`Found ${U} of '${t}' in '${n}' across ${T}${B}:`:N=`Found ${U} of '${t}' across ${T}${B}:`;let X=u==="dir"?"[DIR]":u==="glob"?"[GLOB]":"",C=`${X}${X?" ":""}${N}
|
|
2
2
|
|
|
3
3
|
`,H="";try{let i=await Q();i?.systemSettings?.alwaysAskFiles&&(H=i.systemSettings.alwaysAskFiles)}catch{}for(let i of S)if(C+=`${i.path}:
|
|
4
4
|
`,J(i.path,H)){let c=i.matches.map(W=>`Line ${W.line}`).join(", ");C+=` ${c}. Line snapshot not available due to file restriction policy. ReadFile if needed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-UXLD7KTZ.js";import"./chunk-YEVCTH3B.js";import"./chunk-P5HBJA23.js";import"./chunk-26BQ45XP.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A,B,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-YEVCTH3B.js";import"./chunk-P5HBJA23.js";import"./chunk-26BQ45XP.js";export{a as HIDDEN_FROM_SUMMARY,b as PROVIDER_DEFS,v as addProviderKey,B as buildListLines,y as cleanProviderKeys,q as clearAllTempKeys,r as clearTempKey,j as countProviderKeys,A as formatBaseUrl,l as getActiveIndex,d as getCanonicalProviders,g as getProviderLabel,i as getProviderSlots,k as getProviderSummary,o as getTempKey,p as hasTempKey,f as isHiddenFromSummary,e as isUrlBearing,z as maskKey,h as migrateFromLegacy,c as normalizeProvider,w as removeProviderKey,t as resolveAPIKey,u as resolveBaseUrl,m as setActiveIndex,s as setNoticeHandler,n as setTempKey,x as useProviderKey};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-
|
|
1
|
+
import{a,b,c}from"./chunk-YSMPGXV3.js";import"./chunk-HTOLY3HR.js";import"./chunk-P5HBJA23.js";import"./chunk-26BQ45XP.js";export{a as PROVIDER_BASE_URLS,b as loadSettings,c as saveSettings};
|
|
@@ -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-MKC4AVAL.js";import{a as F}from"./chunk-6EYQQ7GQ.js";import{a as $}from"./chunk-Y5JU726N.js";import{b as g}from"./chunk-YSMPGXV3.js";import"./chunk-HTOLY3HR.js";import"./chunk-P5HBJA23.js";import"./chunk-26BQ45XP.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-EIJ6AAGK.js";import"./chunk-YSMPGXV3.js";import"./chunk-HTOLY3HR.js";import"./chunk-P5HBJA23.js";import"./chunk-26BQ45XP.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};
|