fluxflow-cli 4.25.2 → 4.25.4
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-6SB4O4DO.js → ai-OPCGIZAK.js} +1 -1
- package/dist/chunks/{app-KVUS23IW.js → app-D33R52FZ.js} +1 -1
- package/dist/chunks/chunk-2AUIP6N5.js +5 -0
- package/dist/chunks/{chunk-NQTRYK6U.js → chunk-BM3FXMTK.js} +1 -1
- package/dist/chunks/{chunk-QOJ6XJXD.js → chunk-SXRQ4ACF.js} +138 -139
- package/dist/chunks/{click-RDFFRPIN.js → click-5I5YOSNC.js} +2 -2
- package/dist/chunks/{computer_action-OQ3CWQU3.js → computer_action-RTEC7VUX.js} +1 -1
- package/dist/chunks/{drag-RLRC6JFF.js → drag-6TRBT2C3.js} +1 -1
- package/dist/chunks/{invoke-5AQ2YC64.js → invoke-G5IJ3VPK.js} +2 -2
- package/dist/chunks/{invokeSync-GFU7T7UY.js → invokeSync-PAOUTNOW.js} +2 -2
- package/dist/chunks/{key_press-7F6CAPZD.js → key_press-Z3OXF74E.js} +1 -1
- package/dist/chunks/{keyboard_typing-RPPKNVTA.js → keyboard_typing-F2SAZLI2.js} +1 -1
- package/dist/chunks/{screen_grid-3F55Z22R.js → screen_grid-RAKJUJQA.js} +1 -1
- package/dist/chunks/{scroll-QVQD7I6A.js → scroll-7JYRU34H.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/package.json +2 -2
- package/package.json +2 -2
- package/dist/chunks/chunk-A73HW6DI.js +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as p,B as q,C as r,D as s,E as t,m as b,n as c,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-
|
|
1
|
+
import{A as p,B as q,C as r,D as s,E as t,m as b,n as c,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-SXRQ4ACF.js";import"./chunk-56EJGQU3.js";import"./chunk-7SFAWGE2.js";import"./chunk-U2NRX2PX.js";import"./chunk-VYTQ6J56.js";import"./chunk-RZTZPIC5.js";import"./chunk-6NWU3ML6.js";import"./chunk-FQBBOFNP.js";import"./chunk-Y5JU726N.js";import"./chunk-3CZWTXIR.js";import"./chunk-4XXLWMY6.js";import"./chunk-GRQ7JZZP.js";import{k as a}from"./chunk-OSDQRSY6.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";export{c as RE_LEADING_THINK,q as compressHistory,b as convertChannelThinkTags,r as deleteChatSummary,e as findGenuineThinkClose,p as generateSimpleContent,s as getAIStream,j as getCleanGroupedLength,m as getGoogleClient,f as getLeadingThinkBlock,o as initAI,d as isInsideBacktick,a as isModelMultimodal,l as isTerminationSignaled,n as runJanitorTask,t as runSubagent,k as signalTermination,g as stripLeadingThinking,h as stripNakedXmlTags,i as stripTrailingFluffAfterTools};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as sl,C as il,D as ll,a as Yi,b as Je,c as nt,d as Cr,e as Ht,f as Ki,g as qi,h as vr,i as zi,j as Ms,k as Jo,l as Br,v as nl,y as rl,z as Kn}from"./chunk-
|
|
1
|
+
import{B as sl,C as il,D as ll,a as Yi,b as Je,c as nt,d as Cr,e as Ht,f as Ki,g as qi,h as vr,i as zi,j as Ms,k as Jo,l as Br,v as nl,y as rl,z as Kn}from"./chunk-SXRQ4ACF.js";import{b as Ri,c as el,d as tl}from"./chunk-SZYN3VHU.js";import{a as ol}from"./chunk-56EJGQU3.js";import"./chunk-7SFAWGE2.js";import{c as Vi,e as Sn,f as jt,g as ji}from"./chunk-RTT7P5KS.js";import"./chunk-U2NRX2PX.js";import{a as Zi}from"./chunk-A73NNVCZ.js";import{a as Fo,b as Cn,d as Er,e as ys,f as Qi,h as Ji,i as jn}from"./chunk-VYTQ6J56.js";import"./chunk-RZTZPIC5.js";import{a as Et,b as xt,d as Xi,e as ht,f as Wi,j as Ts,k as ws,l as Gn,n as Gi,o as Co}from"./chunk-6NWU3ML6.js";import{a as Vn}from"./chunk-FQBBOFNP.js";import{a as Yn}from"./chunk-Y5JU726N.js";import{b as Mn,c as xs,k as Ni}from"./chunk-3CZWTXIR.js";import{b as bs}from"./chunk-AF7LASZ3.js";import{a as Fi,b as Ui,f as $i,g as Mr,h as Sr,j as vt,k as Qo,l as ps,r as _i}from"./chunk-4XXLWMY6.js";import{a as hs,b as Pt}from"./chunk-GRQ7JZZP.js";import{d as Di,e as ki,f as Ii,g as Ai,h as Li,i as Pi,k as yr,m as No,n as go,o as Oi}from"./chunk-OSDQRSY6.js";import{c as Tr,d as Bi,e as wr}from"./chunk-L3W2X74K.js";import{e as Hi}from"./chunk-NYIPDIEQ.js";import{a as ro,b as zo,c as mo,d as gs,e as fs,k as Wn}from"./chunk-DSVLWYIT.js";import Ys from"os";import e,{useState as J,useEffect as rt,useRef as Ke,useMemo as kn}from"react";import{Box as c,Text as l,useInput as Kd,useStdout as qd,Static as zd}from"ink";import Qd from"ink-spinner";import et from"fs-extra";import St from"path";import{exec as wo}from"child_process";import{fileURLToPath as Jd}from"url";import Ut,{useState as Dr,useEffect as Ss,useMemo as qn,useCallback as ba,useRef as vo}from"react";import{Box as Ta,Text as so,useInput as wa}from"ink";function ya(t,m){return t.replace(/\t/g," ".repeat(m))}function kr(t){return t==null?"":t.replace(/\r\n/g,`
|
|
2
2
|
`).replace(/\r/g,`
|
|
3
3
|
`)}function Zo(t,m,h){let y=t,T=[...m].sort((s,D)=>s.start-D.start),b=0;for(let s of T){let D=s.start-b,f=kr(s.text).split(`
|
|
4
4
|
`).length,I=s.text.length,A=(f>3?`[Pasted ${f} lines]`:`[Pasted ${I} chars]`).length,H=D+A;if(t<=D)break;if(t<H){y=s.end;break}else{let S=s.text.length-A;y+=S,b+=S}}return Math.min(y,h.length)}function Cs(t,m,h,y,T=[]){let b=(t||"").slice(0,m),s=y(b).length,D=y(t||""),f=[...T].sort((N,L)=>L.start-N.start);for(let N of f){let L=y(t.slice(0,N.start)).length,_=y(N.text),Q=L+_.length,ge=kr(N.text).split(`
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{screen as V}from"@nut-tree-fork/nut-js";import P from"screenshot-desktop";import Z from"sharp";import K from"fs-extra";import Q from"path";var M={TARGET_WIDTH:1280,TARGET_HEIGHT:720,COLS:40,ROWS:30},st=process.env.USE_UI_MODEL!=="false"&&!0,nt=process.env.RAW_MODEL_ONLY==="true"||!1,F=[];async function z(e,o=!1){try{let{data:b,info:T}=await Z(e).resize(M.TARGET_WIDTH,M.TARGET_HEIGHT,{fit:"fill"}).greyscale().raw().toBuffer({resolveWithObject:!0}),s=T.width,h=T.height,d=M.COLS,Y=M.ROWS,m=s/d,r=h/Y,H=[],x=1;for(let n=0;n<Y;n++)for(let c=0;c<d;c++){let u=Math.floor(c*m),p=Math.floor(n*r),w=Math.floor((c+1)*m),a=Math.floor((n+1)*r),t=Math.floor((a-p)/3),y=0,O=0,D=0,E=0,g=0,f=0;for(let W=p;W<a;W+=2)for(let S=u;S<w;S+=2){let q=b[W*s+S];W<p+t?(D+=q,E++):W>a-t?(g+=q,f++):(y+=q,O++)}let A=(D+y+g)/(E+O+f),X=0,v=0,G=0;for(let W=p;W<a;W+=2)for(let S=u;S<w;S+=2){let $=b[W*s+S]-A;W<p+t?v+=$*$:W>a-t?G+=$*$:X+=$*$}let N=Math.sqrt(X/(O||1)),I=Math.sqrt(v/(E||1)),R=Math.sqrt(G/(f||1)),_=Math.sqrt((v+X+G)/(E+O+f||1)),L=3;I>R+3?L=10:(R>I+3||N>12)&&(L=-8),_>18&&H.push({cellNum:x,cx:Math.floor(u+m/2),cy:Math.floor(p+r/2),cellW:m,cellH:r,startX:u,startY:p,yOffset:L,mean:A,stdDev:_}),x++}let i=Array.from({length:Y},()=>Array(d).fill(null));for(let n of H){let c=Math.floor((n.cellNum-1)/d),u=(n.cellNum-1)%d;i[c][u]=n}let C=Array.from({length:Y},()=>Array(d).fill(!1)),l=[];for(let n=0;n<Y;n++)for(let c=0;c<d;c++)if(i[n][c]&&!C[n][c]){let u=n,p=n,w=c,a=c,t=[[n,c]],y=[i[n][c]],O=Array.from({length:Y},()=>Array(d).fill(!1));for(O[n][c]=!0;t.length>0;){let[g,f]=t.shift();u=Math.min(u,g),p=Math.max(p,g),w=Math.min(w,f),a=Math.max(a,f);let A=[[g-1,f],[g+1,f],[g,f-1],[g,f+1],[g-1,f-1],[g-1,f+1],[g+1,f-1],[g+1,f+1]];for(let[X,v]of A)X>=0&&X<Y&&v>=0&&v<d&&i[X][v]&&!O[X][v]&&(O[X][v]=!0,t.push([X,v]),y.push(i[X][v]))}let D=p-u+1,E=a-w+1;if(D<=4&&E<=4){for(let I of y){let R=Math.floor((I.cellNum-1)/d),_=(I.cellNum-1)%d;C[R][_]=!0}let g=Math.floor(w*m),f=Math.floor(u*r),A=Math.floor((a+1)*m),X=Math.floor((p+1)*r),v=A-g,G=X-f,N=3;if(G>r){let I=y.filter(W=>W.startY<f+G/2),R=y.filter(W=>W.startY>=f+G/2),_=I.reduce((W,S)=>W+S.stdDev,0)/(I.length||1),L=R.reduce((W,S)=>W+S.stdDev,0)/(R.length||1);L>_+2?N=-Math.floor(G/4):_>L+2?N=Math.floor(G/4):N=-12}else N=(y.find(R=>R.yOffset!==3)||y[0]).yOffset;l.push({cellNum:y[0].cellNum,cx:Math.floor(g+v/2),cy:Math.floor(f+G/2),cellW:v,cellH:G,startX:g,startY:f,yOffset:N})}else{C[n][c]=!0;let g=i[n][c],f=n+1<Y?i[n+1][c]:null;if(f&&!C[n+1][c]){C[n+1][c]=!0;let A=Math.floor(c*m),X=Math.floor(n*r),v=Math.floor((c+1)*m),G=Math.floor((n+2)*r),N=v-A,I=G-X,R=Math.floor(r*.25),_=Math.floor(X+r-R),L=Math.floor(X+r+R),W=0,S=0;for(let B=_;B<L;B+=2)for(let k=A;k<v;k+=2)W+=b[B*s+k],S++;let q=W/(S||1),$=0;for(let B=_;B<L;B+=2)for(let k=A;k<v;k+=2){let J=b[B*s+k]-q;$+=J*J}let ot=Math.sqrt($/(S||1)),U;if(ot<14)U=Math.floor(X+r)+4;else{let B=g.stdDev||0,k=f.stdDev||0;B<k?U=Math.floor(X+r/2)+(g.yOffset!==3?g.yOffset:-4):U=Math.floor(X+r+r/2)+(f.yOffset!==3?f.yOffset:4)}U=Math.max(X+11,Math.min(X+I-2,U)),l.push({cellNum:g.cellNum,cx:Math.floor(A+N/2),cy:U,cellW:N,cellH:I,startX:A,startY:X,yOffset:0,isCustomY:!0})}else l.push(g)}}if(o){let n=[],c=l.filter(w=>w.isCustomY||w.cellH>r*1.5),u=l.filter(w=>!(w.isCustomY||w.cellH>r*1.5)),p=new Map;for(let w of c){let a=w.startY;p.has(a)||p.set(a,[]),p.get(a).push(w)}for(let[w,a]of p.entries()){a.sort((y,O)=>y.startX-O.startX);let t=[];for(let y=0;y<a.length;y++){let O=a[y];if(t.length===0)t.push(O);else{let D=t[t.length-1];if(Math.abs(D.startX+D.cellW-O.startX)<=3)t.push(O);else{if(t.length>=3){let E=t[0].startX,f=t[t.length-1].startX+t[t.length-1].cellW-E,A=t[0].cellH;n.push({cellNum:t[0].cellNum,cx:Math.floor(E+f/2),cy:t[0].cy,cellW:f,cellH:A,startX:E,startY:w,yOffset:0,isCustomY:!0})}else n.push(...t);t=[O]}}}if(t.length>=3){let y=t[0].startX,D=t[t.length-1].startX+t[t.length-1].cellW-y,E=t[0].cellH;n.push({cellNum:t[0].cellNum,cx:Math.floor(y+D/2),cy:t[0].cy,cellW:D,cellH:E,startX:y,startY:w,yOffset:0,isCustomY:!0})}else n.push(...t)}l.length=0,l.push(...n,...u)}return l.forEach((n,c)=>{n.badgeId=c+1}),F=l,l}catch(b){return console.error("UI Element Detection error:",b),[]}}function rt(e,o,b,T,s=[]){let h=e/b,d=o/T,Y="";for(let m of s){let{badgeId:r,cellNum:H,startX:x,startY:i,cellW:C,cellH:l,cx:n,cy:c}=m,u=r!==void 0?r:H;Y+=`
|
|
2
|
+
<rect x="${x+1}" y="${i+1}" width="${C-2}" height="${l-2}" fill="rgba(0, 255, 255, 0.015)" stroke="rgba(255, 255, 0, 0.3)" stroke-width="1.1" rx="2"/>
|
|
3
|
+
`;let p=s.some(t=>t!==m&&t.startY+t.cellH>=i-6&&t.startY<i&&Math.max(0,Math.min(x+C,t.startX+t.cellW)-Math.max(x,t.startX))>10),w=s.some(t=>t!==m&&t.startY<=i+l+6&&t.startY>i&&Math.max(0,Math.min(x+C,t.startX+t.cellW)-Math.max(x,t.startX))>10),a;if(m.isCustomY)a=c,!p&&a<i+11&&(a=Math.max(10,Math.min(a,i+4)));else{let t=m.yOffset!==void 0?m.yOffset:3;!p&&t<0&&(t=Math.min(t,-12));let y=c+t,O=!p&&(t<0||y<i+11)?Math.max(10,i+4):i+11,D=!w&&(t>0||y>i+l-2)?Math.min(o-2,i+l+6):i+l+3;a=Math.max(O,Math.min(D,y))}Y+=`
|
|
4
|
+
<text x="${n}" y="${a}" font-family="'Segoe UI', Roboto, sans-serif" font-size="14" font-weight="600" fill="#FFFF00" stroke="#000000" stroke-width="2" paint-order="stroke fill" stroke-linejoin="round" opacity="0.8" text-anchor="middle">${u}</text>
|
|
5
|
+
`}return`<svg width="${e}" height="${o}" xmlns="http://www.w3.org/2000/svg">${Y}</svg>`}var tt=1,j=e=>new Promise(o=>setTimeout(o,e));async function et(){try{let{loadSettings:e}=await import("./settings-KKYNW25D.js"),o=await e();return Number(o.display||0)}catch{return 0}}async function lt(){let e=await et();try{let o=await P.listDisplays();if(o&&o.length>0)return{format:"png",screen:(o[e]||o[0]).id}}catch{}return{format:"png"}}async function ct(){let e=0,o=await lt();for(;e<2;){let b=await P(o);await j(500);let T=await P(o);if(b.equals(T))return T;e++,e<2&&await j(3e3)}return await j(3e3),await P(o)}function at(e=[],o=[]){if(!e||e.length===0)return o||[];if(!o||o.length===0)return e;let b=[...e],T=typeof e.getModelConfidence=="function"?e.getModelConfidence.bind(e):null;for(let s of o){if(T&&T(s.startX,s.startY,s.cellW,s.cellH)<.01)continue;let h=s.startX,d=s.startX+s.cellW,Y=s.startY,m=s.startY+s.cellH;for(let u of e){let p=u.startX,w=u.startY,a=u.startX+u.cellW,t=u.startY+u.cellH;if(Math.max(0,Math.min(m,t)-Math.max(Y,w))>s.cellH*.4&&p<d&&a>h){let O=(p+a)/2,D=(h+d)/2;O<=D?h=Math.max(h,a):d=Math.min(d,p)}}let r=d-h;if(r<18)continue;let H=h,x=Y,i=d,C=m,l=Math.floor(h+r/2),n=s.cy,c=!1;for(let u of e){let p=u.startX,w=u.startY,a=u.startX+u.cellW,t=u.startY+u.cellH;if(l>=p&&l<=a&&n>=w&&n<=t){c=!0;break}let y=Math.max(H,p),O=Math.max(x,w),D=Math.min(i,a),E=Math.min(C,t),g=Math.max(0,D-y)*Math.max(0,E-O),f=(i-H)*(C-x);if(g/(f||1)>=.25){c=!0;break}}c||b.push({...s,startX:H,cellW:r,cx:l})}return b.sort((s,h)=>Math.abs(s.startY-h.startY)>18?s.startY-h.startY:s.startX-h.startX),b.forEach((s,h)=>{s.badgeId=h+1}),b}async function pt(){try{let e=await ct(),o=null;if(st){let m=(async()=>{try{let{detectUIBoxesONNX:r}=await import("./ui_detector_onnx-YGGFMOK5.js");return await r(e,M.TARGET_WIDTH,M.TARGET_HEIGHT)}catch{return null}})();if(nt)o=await m||[];else{let r=z(e,!0),[H,x]=await Promise.all([m,r]);o=H&&H.length>0?at(H,x):await z(e,!1)}}else o=await z(e,!1);F=o;let b=rt(M.TARGET_WIDTH,M.TARGET_HEIGHT,M.COLS,M.ROWS,o),T=await Z(e).resize(M.TARGET_WIDTH,M.TARGET_HEIGHT,{fit:"fill"}).composite([{input:Buffer.from(b),top:0,left:0}]).png({quality:100}).toBuffer();if(process.env.SHOW_DEBUG_GRID)try{let m=Q.resolve(process.cwd(),"screenshots");await K.ensureDir(m);let r=Q.join(m,`${tt}.png`);await K.writeFile(r,T),tt++}catch{}let s=T.toString("base64"),h=o.length,d=e,Y=T;return d=null,Y=null,{base64:s,mimeType:"image/png",width:M.TARGET_WIDTH,height:M.TARGET_HEIGHT,detectedCount:h}}catch(e){return console.error("Failed to capture gridded screenshot:",e),null}}function it(e){if(e==null)return null;let o=null;if(typeof e=="number")o=e;else if(typeof e=="string"){let H=e.trim();if(/^\d+$/.test(H))o=parseInt(H,10);else{let x=H.match(/^([A-Z])([0-9]{1,2})$/i);if(x){let i=x[1].toUpperCase().charCodeAt(0)-65,C=parseInt(x[2],10)-1;o=i*M.COLS+C+1}}}if(o===null||isNaN(o))return null;if(F&&F.length>0){let H=F.find(x=>x.badgeId===o)||F.find(x=>x.cellNum===o);if(H){let x=Math.floor((H.cellNum-1)%M.COLS),i=Math.floor((H.cellNum-1)/M.COLS);return{x:H.cx,y:H.cy,colIdx:x>=0?x:0,rowIdx:i>=0?i:0,cellNum:o}}}let b=M.COLS*M.ROWS;if(o<1||o>b)return null;let T=o-1,s=Math.floor(T/M.COLS),h=T%M.COLS,d=M.TARGET_WIDTH/M.COLS,Y=M.TARGET_HEIGHT/M.ROWS,m=Math.floor(h*d+d/2),r=Math.floor(s*Y+Y/2);return{x:m,y:r,colIdx:h,rowIdx:s,cellNum:o}}async function yt(e,o,b){let T=null;if(typeof e=="number"||typeof e=="string"?T=it(e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(T=e),!T)return null;let s=o,h=b,d=0,Y=0,m=await et();try{let C=await P.listDisplays();if(C&&C.length>0){let l=C[m]||C[0];l.width&&l.height&&(s=l.width,h=l.height),l.left!==void 0&&(d=l.left),l.top!==void 0&&(Y=l.top)}}catch{}if(!s||!h)try{let C=await P({}),l=await Z(C).metadata();l&&l.width&&l.height?(s=l.width,h=l.height):(s=await V.width(),h=await V.height())}catch{(!s||!h)&&(s=await V.width(),h=await V.height())}let r=s/M.TARGET_WIDTH,H=h/M.TARGET_HEIGHT,x=Math.round(T.x*r)+d,i=Math.round(T.y*H)+Y;return{x,y:i,screenW:s,screenH:h,offsetX:d,offsetY:Y}}export{M as a,st as b,nt as c,et as d,pt as e,it as f,yt as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as f}from"./chunk-
|
|
1
|
+
import{g as f}from"./chunk-2AUIP6N5.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};
|