agentiqa 1.1.7-staging.7150afd → 1.1.7-staging.fc9ac4f

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.
Files changed (2) hide show
  1. package/dist/cli.js +1 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  var Qb=Object.create;var vu=Object.defineProperty;var Xb=Object.getOwnPropertyDescriptor;var Zb=Object.getOwnPropertyNames;var e_=Object.getPrototypeOf,t_=Object.prototype.hasOwnProperty;var Fr=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Ut=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var r_=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Zb(e))!t_.call(r,s)&&s!==t&&vu(r,s,{get:()=>e[s],enumerable:!(n=Xb(e,s))||n.enumerable});return r};var Ln=(r,e,t)=>(t=r!=null?Qb(e_(r)):{},r_(e||!r||!r.__esModule?vu(t,"default",{value:r,enumerable:!0}):t,r));var Du=Ut((sL,ra)=>{var Nu=Nu||function(r){return Buffer.from(r).toString("base64")};function A_(r){var e=this,t=Math.round,n=Math.floor,s=new Array(64),o=new Array(64),a=new Array(64),i=new Array(64),l,c,u,h,f=new Array(65535),p=new Array(65535),m=new Array(64),d=new Array(64),y=[],v=0,_=7,b=new Array(64),S=new Array(64),w=new Array(64),k=new Array(256),x=new Array(2048),I,M=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],R=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],N=[0,1,2,3,4,5,6,7,8,9,10,11],j=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],A=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],F=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],W=[0,1,2,3,4,5,6,7,8,9,10,11],Y=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],H=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function B(q){for(var he=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],xe=0;xe<64;xe++){var we=n((he[xe]*q+50)/100);we<1?we=1:we>255&&(we=255),s[M[xe]]=we}for(var Ee=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],Te=0;Te<64;Te++){var Re=n((Ee[Te]*q+50)/100);Re<1?Re=1:Re>255&&(Re=255),o[M[Te]]=Re}for(var De=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],He=0,Ve=0;Ve<8;Ve++)for(var re=0;re<8;re++)a[He]=1/(s[M[He]]*De[Ve]*De[re]*8),i[He]=1/(o[M[He]]*De[Ve]*De[re]*8),He++}function se(q,he){for(var xe=0,we=0,Ee=new Array,Te=1;Te<=16;Te++){for(var Re=1;Re<=q[Te];Re++)Ee[he[we]]=[],Ee[he[we]][0]=xe,Ee[he[we]][1]=Te,we++,xe++;xe*=2}return Ee}function ue(){l=se(R,N),c=se(F,W),u=se(j,A),h=se(Y,H)}function ne(){for(var q=1,he=2,xe=1;xe<=15;xe++){for(var we=q;we<he;we++)p[32767+we]=xe,f[32767+we]=[],f[32767+we][1]=xe,f[32767+we][0]=we;for(var Ee=-(he-1);Ee<=-q;Ee++)p[32767+Ee]=xe,f[32767+Ee]=[],f[32767+Ee][1]=xe,f[32767+Ee][0]=he-1+Ee;q<<=1,he<<=1}}function X(){for(var q=0;q<256;q++)x[q]=19595*q,x[q+256>>0]=38470*q,x[q+512>>0]=7471*q+32768,x[q+768>>0]=-11059*q,x[q+1024>>0]=-21709*q,x[q+1280>>0]=32768*q+8421375,x[q+1536>>0]=-27439*q,x[q+1792>>0]=-5329*q}function L(q){for(var he=q[0],xe=q[1]-1;xe>=0;)he&1<<xe&&(v|=1<<_),xe--,_--,_<0&&(v==255?(O(255),O(0)):O(v),_=7,v=0)}function O(q){y.push(q)}function P(q){O(q>>8&255),O(q&255)}function ae(q,he){var xe,we,Ee,Te,Re,De,He,Ve,re=0,ve,ke=8,rt=64;for(ve=0;ve<ke;++ve){xe=q[re],we=q[re+1],Ee=q[re+2],Te=q[re+3],Re=q[re+4],De=q[re+5],He=q[re+6],Ve=q[re+7];var be=xe+Ve,Oe=xe-Ve,Fe=we+He,_e=we-He,Ue=Ee+De,Ie=Ee-De,Ze=Te+Re,At=Te-Re,Ye=be+Ze,ct=be-Ze,Me=Fe+Ue,bt=Fe-Ue;q[re]=Ye+Me,q[re+4]=Ye-Me;var Gt=(bt+ct)*.707106781;q[re+2]=ct+Gt,q[re+6]=ct-Gt,Ye=At+Ie,Me=Ie+_e,bt=_e+Oe;var Lr=(Ye-bt)*.382683433,an=.5411961*Ye+Lr,er=1.306562965*bt+Lr,yr=Me*.707106781,ln=Oe+yr,cn=Oe-yr;q[re+5]=cn+an,q[re+3]=cn-an,q[re+1]=ln+er,q[re+7]=ln-er,re+=8}for(re=0,ve=0;ve<ke;++ve){xe=q[re],we=q[re+8],Ee=q[re+16],Te=q[re+24],Re=q[re+32],De=q[re+40],He=q[re+48],Ve=q[re+56];var Rs=xe+Ve,vr=xe-Ve,Nn=we+He,Bo=we-He,Cs=Ee+De,Ho=Ee-De,Vo=Te+Re,Wi=Te-Re,$r=Rs+Vo,Pe=Rs-Vo,_t=Nn+Cs,Ur=Nn-Cs;q[re]=$r+_t,q[re+32]=$r-_t;var jr=(Ur+Pe)*.707106781;q[re+16]=Pe+jr,q[re+48]=Pe-jr,$r=Wi+Ho,_t=Ho+Bo,Ur=Bo+vr;var Ms=($r-Ur)*.382683433,Os=.5411961*$r+Ms,Ps=1.306562965*Ur+Ms,Ns=_t*.707106781,Ds=vr+Ns,Ls=vr-Ns;q[re+40]=Ls+Os,q[re+24]=Ls-Os,q[re+8]=Ds+Ps,q[re+56]=Ds-Ps,re++}var ut;for(ve=0;ve<rt;++ve)ut=q[ve]*he[ve],m[ve]=ut>0?ut+.5|0:ut-.5|0;return m}function te(){P(65504),P(16),O(74),O(70),O(73),O(70),O(0),O(1),O(1),O(0),P(1),P(1),O(0),O(0)}function J(q){if(q){P(65505),q[0]===69&&q[1]===120&&q[2]===105&&q[3]===102?P(q.length+2):(P(q.length+5+2),O(69),O(120),O(105),O(102),O(0));for(var he=0;he<q.length;he++)O(q[he])}}function G(q,he){P(65472),P(17),O(8),P(he),P(q),O(3),O(1),O(17),O(0),O(2),O(17),O(1),O(3),O(17),O(1)}function V(){P(65499),P(132),O(0);for(var q=0;q<64;q++)O(s[q]);O(1);for(var he=0;he<64;he++)O(o[he])}function E(){P(65476),P(418),O(0);for(var q=0;q<16;q++)O(R[q+1]);for(var he=0;he<=11;he++)O(N[he]);O(16);for(var xe=0;xe<16;xe++)O(j[xe+1]);for(var we=0;we<=161;we++)O(A[we]);O(1);for(var Ee=0;Ee<16;Ee++)O(F[Ee+1]);for(var Te=0;Te<=11;Te++)O(W[Te]);O(17);for(var Re=0;Re<16;Re++)O(Y[Re+1]);for(var De=0;De<=161;De++)O(H[De])}function T(q){typeof q>"u"||q.constructor!==Array||q.forEach(he=>{if(typeof he=="string"){P(65534);var xe=he.length;P(xe+2);var we;for(we=0;we<xe;we++)O(he.charCodeAt(we))}})}function U(){P(65498),P(12),O(3),O(1),O(0),O(2),O(17),O(3),O(17),O(0),O(63),O(0)}function $(q,he,xe,we,Ee){for(var Te=Ee[0],Re=Ee[240],De,He=16,Ve=63,re=64,ve=ae(q,he),ke=0;ke<re;++ke)d[M[ke]]=ve[ke];var rt=d[0]-xe;xe=d[0],rt==0?L(we[0]):(De=32767+rt,L(we[p[De]]),L(f[De]));for(var be=63;be>0&&d[be]==0;be--);if(be==0)return L(Te),xe;for(var Oe=1,Fe;Oe<=be;){for(var _e=Oe;d[Oe]==0&&Oe<=be;++Oe);var Ue=Oe-_e;if(Ue>=He){Fe=Ue>>4;for(var Ie=1;Ie<=Fe;++Ie)L(Re);Ue=Ue&15}De=32767+d[Oe],L(Ee[(Ue<<4)+p[De]]),L(f[De]),Oe++}return be!=Ve&&L(Te),xe}function le(){for(var q=String.fromCharCode,he=0;he<256;he++)k[he]=q(he)}this.encode=function(q,he){var xe=new Date().getTime();he&&fe(he),y=new Array,v=0,_=7,P(65496),te(),T(q.comments),J(q.exifBuffer),V(),G(q.width,q.height),E(),U();var we=0,Ee=0,Te=0;v=0,_=7,this.encode.displayName="_encode_";for(var Re=q.data,De=q.width,He=q.height,Ve=De*4,re=De*3,ve,ke=0,rt,be,Oe,Fe,_e,Ue,Ie,Ze;ke<He;){for(ve=0;ve<Ve;){for(Fe=Ve*ke+ve,_e=Fe,Ue=-1,Ie=0,Ze=0;Ze<64;Ze++)Ie=Ze>>3,Ue=(Ze&7)*4,_e=Fe+Ie*Ve+Ue,ke+Ie>=He&&(_e-=Ve*(ke+1+Ie-He)),ve+Ue>=Ve&&(_e-=ve+Ue-Ve+4),rt=Re[_e++],be=Re[_e++],Oe=Re[_e++],b[Ze]=(x[rt]+x[be+256>>0]+x[Oe+512>>0]>>16)-128,S[Ze]=(x[rt+768>>0]+x[be+1024>>0]+x[Oe+1280>>0]>>16)-128,w[Ze]=(x[rt+1280>>0]+x[be+1536>>0]+x[Oe+1792>>0]>>16)-128;we=$(b,a,we,l,u),Ee=$(S,i,Ee,c,h),Te=$(w,i,Te,c,h),ve+=32}ke+=8}if(_>=0){var At=[];At[1]=_+1,At[0]=(1<<_+1)-1,L(At)}if(P(65497),typeof ra>"u")return new Uint8Array(y);return Buffer.from(y);var Ye,ct};function fe(q){if(q<=0&&(q=1),q>100&&(q=100),I!=q){var he=0;q<50?he=Math.floor(5e3/q):he=Math.floor(200-q*2),B(he),I=q}}function Ce(){var q=new Date().getTime();r||(r=50),le(),ue(),ne(),X(),fe(r);var he=new Date().getTime()-q}Ce()}typeof ra<"u"?ra.exports=Pu:typeof window<"u"&&(window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].encode=Pu);function Pu(r,e){typeof e>"u"&&(e=50);var t=new A_(e),n=t.encode(r,e);return{data:n,width:r.width,height:r.height}}});var $u=Ut((oL,cl)=>{var ll=(function(){"use strict";var e=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,n=799,s=3406,o=2276,a=1567,i=3784,l=5793,c=2896;function u(){}function h(_,b){for(var S=0,w=[],k,x,I=16;I>0&&!_[I-1];)I--;w.push({children:[],index:0});var M=w[0],R;for(k=0;k<I;k++){for(x=0;x<_[k];x++){for(M=w.pop(),M.children[M.index]=b[S];M.index>0;){if(w.length===0)throw new Error("Could not recreate Huffman Table");M=w.pop()}for(M.index++,w.push(M);w.length<=k;)w.push(R={children:[],index:0}),M.children[M.index]=R.children,M=R;S++}k+1<I&&(w.push(R={children:[],index:0}),M.children[M.index]=R.children,M=R)}return w[0].children}function f(_,b,S,w,k,x,I,M,R,N){var j=S.precision,A=S.samplesPerLine,F=S.scanLines,W=S.mcusPerLine,Y=S.progressive,H=S.maxH,B=S.maxV,se=b,ue=0,ne=0;function X(){if(ne>0)return ne--,ue>>ne&1;if(ue=_[b++],ue==255){var re=_[b++];if(re)throw new Error("unexpected marker: "+(ue<<8|re).toString(16))}return ne=7,ue>>>7}function L(re){for(var ve=re,ke;(ke=X())!==null;){if(ve=ve[ke],typeof ve=="number")return ve;if(typeof ve!="object")throw new Error("invalid huffman sequence")}return null}function O(re){for(var ve=0;re>0;){var ke=X();if(ke===null)return;ve=ve<<1|ke,re--}return ve}function P(re){var ve=O(re);return ve>=1<<re-1?ve:ve+(-1<<re)+1}function ae(re,ve){var ke=L(re.huffmanTableDC),rt=ke===0?0:P(ke);ve[0]=re.pred+=rt;for(var be=1;be<64;){var Oe=L(re.huffmanTableAC),Fe=Oe&15,_e=Oe>>4;if(Fe===0){if(_e<15)break;be+=16;continue}be+=_e;var Ue=e[be];ve[Ue]=P(Fe),be++}}function te(re,ve){var ke=L(re.huffmanTableDC),rt=ke===0?0:P(ke)<<R;ve[0]=re.pred+=rt}function J(re,ve){ve[0]|=X()<<R}var G=0;function V(re,ve){if(G>0){G--;return}for(var ke=x,rt=I;ke<=rt;){var be=L(re.huffmanTableAC),Oe=be&15,Fe=be>>4;if(Oe===0){if(Fe<15){G=O(Fe)+(1<<Fe)-1;break}ke+=16;continue}ke+=Fe;var _e=e[ke];ve[_e]=P(Oe)*(1<<R),ke++}}var E=0,T;function U(re,ve){for(var ke=x,rt=I,be=0;ke<=rt;){var Oe=e[ke],Fe=ve[Oe]<0?-1:1;switch(E){case 0:var _e=L(re.huffmanTableAC),Ue=_e&15,be=_e>>4;if(Ue===0)be<15?(G=O(be)+(1<<be),E=4):(be=16,E=1);else{if(Ue!==1)throw new Error("invalid ACn encoding");T=P(Ue),E=be?2:3}continue;case 1:case 2:ve[Oe]?ve[Oe]+=(X()<<R)*Fe:(be--,be===0&&(E=E==2?3:0));break;case 3:ve[Oe]?ve[Oe]+=(X()<<R)*Fe:(ve[Oe]=T<<R,E=0);break;case 4:ve[Oe]&&(ve[Oe]+=(X()<<R)*Fe);break}ke++}E===4&&(G--,G===0&&(E=0))}function $(re,ve,ke,rt,be){var Oe=ke/W|0,Fe=ke%W,_e=Oe*re.v+rt,Ue=Fe*re.h+be;re.blocks[_e]===void 0&&N.tolerantDecoding||ve(re,re.blocks[_e][Ue])}function le(re,ve,ke){var rt=ke/re.blocksPerLine|0,be=ke%re.blocksPerLine;re.blocks[rt]===void 0&&N.tolerantDecoding||ve(re,re.blocks[rt][be])}var fe=w.length,Ce,q,he,xe,we,Ee;Y?x===0?Ee=M===0?te:J:Ee=M===0?V:U:Ee=ae;var Te=0,Re,De;fe==1?De=w[0].blocksPerLine*w[0].blocksPerColumn:De=W*S.mcusPerColumn,k||(k=De);for(var He,Ve;Te<De;){for(q=0;q<fe;q++)w[q].pred=0;if(G=0,fe==1)for(Ce=w[0],we=0;we<k;we++)le(Ce,Ee,Te),Te++;else for(we=0;we<k;we++){for(q=0;q<fe;q++)for(Ce=w[q],He=Ce.h,Ve=Ce.v,he=0;he<Ve;he++)for(xe=0;xe<He;xe++)$(Ce,Ee,Te,he,xe);if(Te++,Te===De)break}if(Te===De)do{if(_[b]===255&&_[b+1]!==0)break;b+=1}while(b<_.length-2);if(ne=0,Re=_[b]<<8|_[b+1],Re<65280)throw new Error("marker was not found");if(Re>=65488&&Re<=65495)b+=2;else break}return b-se}function p(_,b){var S=[],w=b.blocksPerLine,k=b.blocksPerColumn,x=w<<3,I=new Int32Array(64),M=new Uint8Array(64);function R(se,ue,ne){var X=b.quantizationTable,L,O,P,ae,te,J,G,V,E,T=ne,U;for(U=0;U<64;U++)T[U]=se[U]*X[U];for(U=0;U<8;++U){var $=8*U;if(T[1+$]==0&&T[2+$]==0&&T[3+$]==0&&T[4+$]==0&&T[5+$]==0&&T[6+$]==0&&T[7+$]==0){E=l*T[0+$]+512>>10,T[0+$]=E,T[1+$]=E,T[2+$]=E,T[3+$]=E,T[4+$]=E,T[5+$]=E,T[6+$]=E,T[7+$]=E;continue}L=l*T[0+$]+128>>8,O=l*T[4+$]+128>>8,P=T[2+$],ae=T[6+$],te=c*(T[1+$]-T[7+$])+128>>8,V=c*(T[1+$]+T[7+$])+128>>8,J=T[3+$]<<4,G=T[5+$]<<4,E=L-O+1>>1,L=L+O+1>>1,O=E,E=P*i+ae*a+128>>8,P=P*a-ae*i+128>>8,ae=E,E=te-G+1>>1,te=te+G+1>>1,G=E,E=V+J+1>>1,J=V-J+1>>1,V=E,E=L-ae+1>>1,L=L+ae+1>>1,ae=E,E=O-P+1>>1,O=O+P+1>>1,P=E,E=te*o+V*s+2048>>12,te=te*s-V*o+2048>>12,V=E,E=J*n+G*t+2048>>12,J=J*t-G*n+2048>>12,G=E,T[0+$]=L+V,T[7+$]=L-V,T[1+$]=O+G,T[6+$]=O-G,T[2+$]=P+J,T[5+$]=P-J,T[3+$]=ae+te,T[4+$]=ae-te}for(U=0;U<8;++U){var le=U;if(T[8+le]==0&&T[16+le]==0&&T[24+le]==0&&T[32+le]==0&&T[40+le]==0&&T[48+le]==0&&T[56+le]==0){E=l*ne[U+0]+8192>>14,T[0+le]=E,T[8+le]=E,T[16+le]=E,T[24+le]=E,T[32+le]=E,T[40+le]=E,T[48+le]=E,T[56+le]=E;continue}L=l*T[0+le]+2048>>12,O=l*T[32+le]+2048>>12,P=T[16+le],ae=T[48+le],te=c*(T[8+le]-T[56+le])+2048>>12,V=c*(T[8+le]+T[56+le])+2048>>12,J=T[24+le],G=T[40+le],E=L-O+1>>1,L=L+O+1>>1,O=E,E=P*i+ae*a+2048>>12,P=P*a-ae*i+2048>>12,ae=E,E=te-G+1>>1,te=te+G+1>>1,G=E,E=V+J+1>>1,J=V-J+1>>1,V=E,E=L-ae+1>>1,L=L+ae+1>>1,ae=E,E=O-P+1>>1,O=O+P+1>>1,P=E,E=te*o+V*s+2048>>12,te=te*s-V*o+2048>>12,V=E,E=J*n+G*t+2048>>12,J=J*t-G*n+2048>>12,G=E,T[0+le]=L+V,T[56+le]=L-V,T[8+le]=O+G,T[48+le]=O-G,T[16+le]=P+J,T[40+le]=P-J,T[24+le]=ae+te,T[32+le]=ae-te}for(U=0;U<64;++U){var fe=128+(T[U]+8>>4);ue[U]=fe<0?0:fe>255?255:fe}}v(x*k*8);for(var N,j,A=0;A<k;A++){var F=A<<3;for(N=0;N<8;N++)S.push(new Uint8Array(x));for(var W=0;W<w;W++){R(b.blocks[A][W],M,I);var Y=0,H=W<<3;for(j=0;j<8;j++){var B=S[F+j];for(N=0;N<8;N++)B[H+N]=M[Y++]}}}return S}function m(_){return _<0?0:_>255?255:_}u.prototype={load:function(b){var S=new XMLHttpRequest;S.open("GET",b,!0),S.responseType="arraybuffer",S.onload=(function(){var w=new Uint8Array(S.response||S.mozResponseArrayBuffer);this.parse(w),this.onload&&this.onload()}).bind(this),S.send(null)},parse:function(b){var S=this.opts.maxResolutionInMP*1e3*1e3,w=0,k=b.length;function x(){var _e=b[w]<<8|b[w+1];return w+=2,_e}function I(){var _e=x(),Ue=b.subarray(w,w+_e-2);return w+=Ue.length,Ue}function M(_e){var Ue=1,Ie=1,Ze,At;for(At in _e.components)_e.components.hasOwnProperty(At)&&(Ze=_e.components[At],Ue<Ze.h&&(Ue=Ze.h),Ie<Ze.v&&(Ie=Ze.v));var Ye=Math.ceil(_e.samplesPerLine/8/Ue),ct=Math.ceil(_e.scanLines/8/Ie);for(At in _e.components)if(_e.components.hasOwnProperty(At)){Ze=_e.components[At];var Me=Math.ceil(Math.ceil(_e.samplesPerLine/8)*Ze.h/Ue),bt=Math.ceil(Math.ceil(_e.scanLines/8)*Ze.v/Ie),Gt=Ye*Ze.h,Lr=ct*Ze.v,an=Lr*Gt,er=[];v(an*256);for(var yr=0;yr<Lr;yr++){for(var ln=[],cn=0;cn<Gt;cn++)ln.push(new Int32Array(64));er.push(ln)}Ze.blocksPerLine=Me,Ze.blocksPerColumn=bt,Ze.blocks=er}_e.maxH=Ue,_e.maxV=Ie,_e.mcusPerLine=Ye,_e.mcusPerColumn=ct}var R=null,N=null,j=null,A,F,W=[],Y=[],H=[],B=[],se=x(),ue=-1;if(this.comments=[],se!=65496)throw new Error("SOI not found");for(se=x();se!=65497;){var ne,X,L;switch(se){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var O=I();if(se===65534){var P=String.fromCharCode.apply(null,O);this.comments.push(P)}se===65504&&O[0]===74&&O[1]===70&&O[2]===73&&O[3]===70&&O[4]===0&&(R={version:{major:O[5],minor:O[6]},densityUnits:O[7],xDensity:O[8]<<8|O[9],yDensity:O[10]<<8|O[11],thumbWidth:O[12],thumbHeight:O[13],thumbData:O.subarray(14,14+3*O[12]*O[13])}),se===65505&&O[0]===69&&O[1]===120&&O[2]===105&&O[3]===102&&O[4]===0&&(this.exifBuffer=O.subarray(5,O.length)),se===65518&&O[0]===65&&O[1]===100&&O[2]===111&&O[3]===98&&O[4]===101&&O[5]===0&&(N={version:O[6],flags0:O[7]<<8|O[8],flags1:O[9]<<8|O[10],transformCode:O[11]});break;case 65499:for(var ae=x(),te=ae+w-2;w<te;){var J=b[w++];v(256);var G=new Int32Array(64);if(J>>4===0)for(X=0;X<64;X++){var V=e[X];G[V]=b[w++]}else if(J>>4===1)for(X=0;X<64;X++){var V=e[X];G[V]=x()}else throw new Error("DQT: invalid table spec");W[J&15]=G}break;case 65472:case 65473:case 65474:x(),A={},A.extended=se===65473,A.progressive=se===65474,A.precision=b[w++],A.scanLines=x(),A.samplesPerLine=x(),A.components={},A.componentsOrder=[];var E=A.scanLines*A.samplesPerLine;if(E>S){var T=Math.ceil((E-S)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${T}MP`)}var U=b[w++],$,le=0,fe=0;for(ne=0;ne<U;ne++){$=b[w];var Ce=b[w+1]>>4,q=b[w+1]&15,he=b[w+2];if(Ce<=0||q<=0)throw new Error("Invalid sampling factor, expected values above 0");A.componentsOrder.push($),A.components[$]={h:Ce,v:q,quantizationIdx:he},w+=3}M(A),Y.push(A);break;case 65476:var xe=x();for(ne=2;ne<xe;){var we=b[w++],Ee=new Uint8Array(16),Te=0;for(X=0;X<16;X++,w++)Te+=Ee[X]=b[w];v(16+Te);var Re=new Uint8Array(Te);for(X=0;X<Te;X++,w++)Re[X]=b[w];ne+=17+Te,(we>>4===0?B:H)[we&15]=h(Ee,Re)}break;case 65501:x(),F=x();break;case 65500:x(),x();break;case 65498:var De=x(),He=b[w++],Ve=[],re;for(ne=0;ne<He;ne++){re=A.components[b[w++]];var ve=b[w++];re.huffmanTableDC=B[ve>>4],re.huffmanTableAC=H[ve&15],Ve.push(re)}var ke=b[w++],rt=b[w++],be=b[w++],Oe=f(b,w,A,Ve,F,ke,rt,be>>4,be&15,this.opts);w+=Oe;break;case 65535:b[w]!==255&&w--;break;default:if(b[w-3]==255&&b[w-2]>=192&&b[w-2]<=254){w-=3;break}else if(se===224||se==225){if(ue!==-1)throw new Error(`first unknown JPEG marker at offset ${ue.toString(16)}, second unknown JPEG marker ${se.toString(16)} at offset ${(w-1).toString(16)}`);ue=w-1;let _e=x();if(b[w+_e-2]===255){w+=_e-2;break}}throw new Error("unknown JPEG marker "+se.toString(16))}se=x()}if(Y.length!=1)throw new Error("only single frame JPEGs supported");for(var ne=0;ne<Y.length;ne++){var Fe=Y[ne].components;for(var X in Fe)Fe[X].quantizationTable=W[Fe[X].quantizationIdx],delete Fe[X].quantizationIdx}this.width=A.samplesPerLine,this.height=A.scanLines,this.jfif=R,this.adobe=N,this.components=[];for(var ne=0;ne<A.componentsOrder.length;ne++){var re=A.components[A.componentsOrder[ne]];this.components.push({lines:p(A,re),scaleX:re.h/A.maxH,scaleY:re.v/A.maxV})}},getData:function(b,S){var w=this.width/b,k=this.height/S,x,I,M,R,N,j,A,F,W,Y,H=0,B,se,ue,ne,X,L,O,P,ae,te,J,G=b*S*this.components.length;v(G);var V=new Uint8Array(G);switch(this.components.length){case 1:for(x=this.components[0],Y=0;Y<S;Y++)for(N=x.lines[0|Y*x.scaleY*k],W=0;W<b;W++)B=N[0|W*x.scaleX*w],V[H++]=B;break;case 2:for(x=this.components[0],I=this.components[1],Y=0;Y<S;Y++)for(N=x.lines[0|Y*x.scaleY*k],j=I.lines[0|Y*I.scaleY*k],W=0;W<b;W++)B=N[0|W*x.scaleX*w],V[H++]=B,B=j[0|W*I.scaleX*w],V[H++]=B;break;case 3:for(J=!0,this.adobe&&this.adobe.transformCode?J=!0:typeof this.opts.colorTransform<"u"&&(J=!!this.opts.colorTransform),x=this.components[0],I=this.components[1],M=this.components[2],Y=0;Y<S;Y++)for(N=x.lines[0|Y*x.scaleY*k],j=I.lines[0|Y*I.scaleY*k],A=M.lines[0|Y*M.scaleY*k],W=0;W<b;W++)J?(B=N[0|W*x.scaleX*w],se=j[0|W*I.scaleX*w],ue=A[0|W*M.scaleX*w],P=m(B+1.402*(ue-128)),ae=m(B-.3441363*(se-128)-.71413636*(ue-128)),te=m(B+1.772*(se-128))):(P=N[0|W*x.scaleX*w],ae=j[0|W*I.scaleX*w],te=A[0|W*M.scaleX*w]),V[H++]=P,V[H++]=ae,V[H++]=te;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(J=!1,this.adobe&&this.adobe.transformCode?J=!0:typeof this.opts.colorTransform<"u"&&(J=!!this.opts.colorTransform),x=this.components[0],I=this.components[1],M=this.components[2],R=this.components[3],Y=0;Y<S;Y++)for(N=x.lines[0|Y*x.scaleY*k],j=I.lines[0|Y*I.scaleY*k],A=M.lines[0|Y*M.scaleY*k],F=R.lines[0|Y*R.scaleY*k],W=0;W<b;W++)J?(B=N[0|W*x.scaleX*w],se=j[0|W*I.scaleX*w],ue=A[0|W*M.scaleX*w],ne=F[0|W*R.scaleX*w],X=255-m(B+1.402*(ue-128)),L=255-m(B-.3441363*(se-128)-.71413636*(ue-128)),O=255-m(B+1.772*(se-128))):(X=N[0|W*x.scaleX*w],L=j[0|W*I.scaleX*w],O=A[0|W*M.scaleX*w],ne=F[0|W*R.scaleX*w]),V[H++]=255-X,V[H++]=255-L,V[H++]=255-O,V[H++]=255-ne;break;default:throw new Error("Unsupported color mode")}return V},copyToImageData:function(b,S){var w=b.width,k=b.height,x=b.data,I=this.getData(w,k),M=0,R=0,N,j,A,F,W,Y,H,B,se;switch(this.components.length){case 1:for(j=0;j<k;j++)for(N=0;N<w;N++)A=I[M++],x[R++]=A,x[R++]=A,x[R++]=A,S&&(x[R++]=255);break;case 3:for(j=0;j<k;j++)for(N=0;N<w;N++)H=I[M++],B=I[M++],se=I[M++],x[R++]=H,x[R++]=B,x[R++]=se,S&&(x[R++]=255);break;case 4:for(j=0;j<k;j++)for(N=0;N<w;N++)W=I[M++],Y=I[M++],A=I[M++],F=I[M++],H=255-m(W*(1-F/255)+F),B=255-m(Y*(1-F/255)+F),se=255-m(A*(1-F/255)+F),x[R++]=H,x[R++]=B,x[R++]=se,S&&(x[R++]=255);break;default:throw new Error("Unsupported color mode")}}};var d=0,y=0;function v(_=0){var b=d+_;if(b>y){var S=Math.ceil((b-y)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${S}MB`)}d=b}return u.resetMaxMemoryUsage=function(_){d=0,y=_},u.getBytesAllocated=function(){return d},u.requestMemoryAllocation=v,u})();typeof cl<"u"?cl.exports=Lu:typeof window<"u"&&(window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].decode=Lu);function Lu(r,e={}){var t={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512},n={...t,...e},s=new Uint8Array(r),o=new ll;o.opts=n,ll.resetMaxMemoryUsage(n.maxMemoryUsageInMB*1024*1024),o.parse(s);var a=n.formatAsRGBA?4:3,i=o.width*o.height*a;try{ll.requestMemoryAllocation(i);var l={width:o.width,height:o.height,exifBuffer:o.exifBuffer,data:n.useTArray?new Uint8Array(i):Buffer.alloc(i)};o.comments.length>0&&(l.comments=o.comments)}catch(c){throw c instanceof RangeError?new Error("Could not allocate enough memory for the image. Required: "+i):c instanceof ReferenceError&&c.message==="Buffer is not defined"?new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true"):c}return o.copyToImageData(l,n.formatAsRGBA),l}});var ul=Ut((aL,Uu)=>{var R_=Du(),C_=$u();Uu.exports={encode:R_,decode:C_}});var Il=Ut((ZL,mp)=>{"use strict";var Tl=Object.defineProperty,bS=Object.getOwnPropertyDescriptor,_S=Object.getOwnPropertyNames,wS=Object.prototype.hasOwnProperty,SS=(r,e)=>{for(var t in e)Tl(r,t,{get:e[t],enumerable:!0})},xS=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of _S(e))!wS.call(r,s)&&s!==t&&Tl(r,s,{get:()=>e[s],enumerable:!(n=bS(e,s))||n.enumerable});return r},TS=r=>xS(Tl({},"__esModule",{value:!0}),r),dp={};SS(dp,{SYMBOL_FOR_REQ_CONTEXT:()=>pp,getContext:()=>IS});mp.exports=TS(dp);var pp=Symbol.for("@vercel/request-context");function IS(){return globalThis[pp]?.get?.()??{}}});var Zs=Ut((e1,fp)=>{"use strict";var kl=Object.defineProperty,ES=Object.getOwnPropertyDescriptor,kS=Object.getOwnPropertyNames,AS=Object.prototype.hasOwnProperty,RS=(r,e)=>{for(var t in e)kl(r,t,{get:e[t],enumerable:!0})},CS=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of kS(e))!AS.call(r,s)&&s!==t&&kl(r,s,{get:()=>e[s],enumerable:!(n=ES(e,s))||n.enumerable});return r},MS=r=>CS(kl({},"__esModule",{value:!0}),r),hp={};RS(hp,{VercelOidcTokenError:()=>El});fp.exports=MS(hp);var El=class extends Error{constructor(e,t){super(e),this.name="VercelOidcTokenError",this.cause=t}toString(){return this.cause?`${this.name}: ${this.message}: ${this.cause}`:`${this.name}: ${this.message}`}}});var bp=Ut((t1,vp)=>{"use strict";var OS=Object.create,pa=Object.defineProperty,PS=Object.getOwnPropertyDescriptor,NS=Object.getOwnPropertyNames,DS=Object.getPrototypeOf,LS=Object.prototype.hasOwnProperty,$S=(r,e)=>{for(var t in e)pa(r,t,{get:e[t],enumerable:!0})},gp=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of NS(e))!LS.call(r,s)&&s!==t&&pa(r,s,{get:()=>e[s],enumerable:!(n=PS(e,s))||n.enumerable});return r},Rl=(r,e,t)=>(t=r!=null?OS(DS(r)):{},gp(e||!r||!r.__esModule?pa(t,"default",{value:r,enumerable:!0}):t,r)),US=r=>gp(pa({},"__esModule",{value:!0}),r),yp={};$S(yp,{findRootDir:()=>qS,getUserDataDir:()=>BS});vp.exports=US(yp);var eo=Rl(Fr("path")),jS=Rl(Fr("fs")),Al=Rl(Fr("os")),FS=Zs();function qS(){try{let r=process.cwd();for(;r!==eo.default.dirname(r);){let e=eo.default.join(r,".vercel");if(jS.default.existsSync(e))return r;r=eo.default.dirname(r)}}catch{throw new FS.VercelOidcTokenError("Token refresh only supported in node server environments")}return null}function BS(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(Al.default.platform()){case"darwin":return eo.default.join(Al.default.homedir(),"Library/Application Support");case"linux":return eo.default.join(Al.default.homedir(),".local/share");case"win32":return process.env.LOCALAPPDATA?process.env.LOCALAPPDATA:null;default:return null}}});var Ep=Ut((r1,Ip)=>{"use strict";var HS=Object.create,ma=Object.defineProperty,VS=Object.getOwnPropertyDescriptor,zS=Object.getOwnPropertyNames,WS=Object.getPrototypeOf,GS=Object.prototype.hasOwnProperty,YS=(r,e)=>{for(var t in e)ma(r,t,{get:e[t],enumerable:!0})},_p=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of zS(e))!GS.call(r,s)&&s!==t&&ma(r,s,{get:()=>e[s],enumerable:!(n=VS(e,s))||n.enumerable});return r},wp=(r,e,t)=>(t=r!=null?HS(WS(r)):{},_p(e||!r||!r.__esModule?ma(t,"default",{value:r,enumerable:!0}):t,r)),JS=r=>_p(ma({},"__esModule",{value:!0}),r),Sp={};YS(Sp,{isValidAccessToken:()=>ZS,readAuthConfig:()=>QS,writeAuthConfig:()=>XS});Ip.exports=JS(Sp);var to=wp(Fr("fs")),xp=wp(Fr("path")),KS=ha();function Tp(){let r=(0,KS.getVercelDataDir)();if(!r)throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);return xp.join(r,"auth.json")}function QS(){try{let r=Tp();if(!to.existsSync(r))return null;let e=to.readFileSync(r,"utf8");return e?JSON.parse(e):null}catch{return null}}function XS(r){let e=Tp(),t=xp.dirname(e);to.existsSync(t)||to.mkdirSync(t,{mode:504,recursive:!0}),to.writeFileSync(e,JSON.stringify(r,null,2),{mode:384})}function ZS(r){if(!r.token)return!1;if(typeof r.expiresAt!="number")return!0;let e=Math.floor(Date.now()/1e3);return r.expiresAt>=e}});var Cp=Ut((n1,Rp)=>{"use strict";var Ol=Object.defineProperty,ex=Object.getOwnPropertyDescriptor,tx=Object.getOwnPropertyNames,rx=Object.prototype.hasOwnProperty,nx=(r,e)=>{for(var t in e)Ol(r,t,{get:e[t],enumerable:!0})},sx=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of tx(e))!rx.call(r,s)&&s!==t&&Ol(r,s,{get:()=>e[s],enumerable:!(n=ex(e,s))||n.enumerable});return r},ox=r=>sx(Ol({},"__esModule",{value:!0}),r),kp={};nx(kp,{processTokenResponse:()=>ux,refreshTokenRequest:()=>cx});Rp.exports=ox(kp);var Cl=Fr("os"),ax="https://vercel.com",ix="cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp",Ap=`@vercel/oidc node-${process.version} ${(0,Cl.platform)()} (${(0,Cl.arch)()}) ${(0,Cl.hostname)()}`,Ml=null;async function lx(){if(Ml)return Ml;let r=`${ax}/.well-known/openid-configuration`,e=await fetch(r,{headers:{"user-agent":Ap}});if(!e.ok)throw new Error("Failed to discover OAuth endpoints");let t=await e.json();if(!t||typeof t.token_endpoint!="string")throw new Error("Invalid OAuth discovery response");let n=t.token_endpoint;return Ml=n,n}async function cx(r){let e=await lx();return await fetch(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","user-agent":Ap},body:new URLSearchParams({client_id:ix,grant_type:"refresh_token",...r})})}async function ux(r){let e=await r.json();if(!r.ok){let t=typeof e=="object"&&e&&"error"in e?String(e.error):"Token refresh failed";return[new Error(t)]}return typeof e!="object"||e===null?[new Error("Invalid token response")]:typeof e.access_token!="string"?[new Error("Missing access_token in response")]:e.token_type!=="Bearer"?[new Error("Invalid token_type in response")]:typeof e.expires_in!="number"?[new Error("Missing expires_in in response")]:[null,e]}});var ha=Ut((s1,Dp)=>{"use strict";var dx=Object.create,fa=Object.defineProperty,px=Object.getOwnPropertyDescriptor,mx=Object.getOwnPropertyNames,hx=Object.getPrototypeOf,fx=Object.prototype.hasOwnProperty,gx=(r,e)=>{for(var t in e)fa(r,t,{get:e[t],enumerable:!0})},Op=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of mx(e))!fx.call(r,s)&&s!==t&&fa(r,s,{get:()=>e[s],enumerable:!(n=px(e,s))||n.enumerable});return r},Pp=(r,e,t)=>(t=r!=null?dx(hx(r)):{},Op(e||!r||!r.__esModule?fa(t,"default",{value:r,enumerable:!0}):t,r)),yx=r=>Op(fa({},"__esModule",{value:!0}),r),Np={};gx(Np,{assertVercelOidcTokenResponse:()=>Pl,findProjectInfo:()=>wx,getTokenPayload:()=>Tx,getVercelCliToken:()=>bx,getVercelDataDir:()=>vx,getVercelOidcToken:()=>_x,isExpired:()=>Ix,loadToken:()=>xx,saveToken:()=>Sx});Dp.exports=yx(Np);var ro=Pp(Fr("path")),yn=Pp(Fr("fs")),es=Zs(),ga=bp(),Zn=Ep(),Mp=Cp();function vx(){let r="com.vercel.cli",e=(0,ga.getUserDataDir)();return e?ro.join(e,r):null}async function bx(){let r=(0,Zn.readAuthConfig)();if(!r)return null;if((0,Zn.isValidAccessToken)(r))return r.token||null;if(!r.refreshToken)return(0,Zn.writeAuthConfig)({}),null;try{let e=await(0,Mp.refreshTokenRequest)({refresh_token:r.refreshToken}),[t,n]=await(0,Mp.processTokenResponse)(e);if(t||!n)return(0,Zn.writeAuthConfig)({}),null;let s={token:n.access_token,expiresAt:Math.floor(Date.now()/1e3)+n.expires_in};return n.refresh_token&&(s.refreshToken=n.refresh_token),(0,Zn.writeAuthConfig)(s),s.token??null}catch{return(0,Zn.writeAuthConfig)({}),null}}async function _x(r,e,t){let n=`https://api.vercel.com/v1/projects/${e}/token?source=vercel-oidc-refresh${t?`&teamId=${t}`:""}`,s=await fetch(n,{method:"POST",headers:{Authorization:`Bearer ${r}`}});if(!s.ok)throw new es.VercelOidcTokenError(`Failed to refresh OIDC token: ${s.statusText}`);let o=await s.json();return Pl(o),o}function Pl(r){if(!r||typeof r!="object")throw new TypeError("Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again");if(!("token"in r)||typeof r.token!="string")throw new TypeError("Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again")}function wx(){let r=(0,ga.findRootDir)();if(!r)throw new es.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");let e=ro.join(r,".vercel","project.json");if(!yn.existsSync(e))throw new es.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");let t=JSON.parse(yn.readFileSync(e,"utf8"));if(typeof t.projectId!="string"&&typeof t.orgId!="string")throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");return{projectId:t.projectId,teamId:t.orgId}}function Sx(r,e){let t=(0,ga.getUserDataDir)();if(!t)throw new es.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");let n=ro.join(t,"com.vercel.token",`${e}.json`),s=JSON.stringify(r);yn.mkdirSync(ro.dirname(n),{mode:504,recursive:!0}),yn.writeFileSync(n,s),yn.chmodSync(n,432)}function xx(r){let e=(0,ga.getUserDataDir)();if(!e)throw new es.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");let t=ro.join(e,"com.vercel.token",`${r}.json`);if(!yn.existsSync(t))return null;let n=JSON.parse(yn.readFileSync(t,"utf8"));return Pl(n),n}function Tx(r){let e=r.split(".");if(e.length!==3)throw new es.VercelOidcTokenError("Invalid token. Please run `vc env pull` and try again");let t=e[1].replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(t.length+(4-t.length%4)%4,"=");return JSON.parse(Buffer.from(n,"base64").toString("utf8"))}function Ix(r){return r.exp*1e3<Date.now()}});var Up=Ut((o1,$p)=>{"use strict";var Dl=Object.defineProperty,Ex=Object.getOwnPropertyDescriptor,kx=Object.getOwnPropertyNames,Ax=Object.prototype.hasOwnProperty,Rx=(r,e)=>{for(var t in e)Dl(r,t,{get:e[t],enumerable:!0})},Cx=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of kx(e))!Ax.call(r,s)&&s!==t&&Dl(r,s,{get:()=>e[s],enumerable:!(n=Ex(e,s))||n.enumerable});return r},Mx=r=>Cx(Dl({},"__esModule",{value:!0}),r),Lp={};Rx(Lp,{refreshToken:()=>Ox});$p.exports=Mx(Lp);var Nl=Zs(),vn=ha();async function Ox(){let{projectId:r,teamId:e}=(0,vn.findProjectInfo)(),t=(0,vn.loadToken)(r);if(!t||(0,vn.isExpired)((0,vn.getTokenPayload)(t.token))){let n=await(0,vn.getVercelCliToken)();if(!n)throw new Nl.VercelOidcTokenError("Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`");if(!r)throw new Nl.VercelOidcTokenError("Failed to refresh OIDC token: Try re-linking your project with `vc link`");if(t=await(0,vn.getVercelOidcToken)(n,r,e),!t)throw new Nl.VercelOidcTokenError("Failed to refresh OIDC token");(0,vn.saveToken)(t,r)}process.env.VERCEL_OIDC_TOKEN=t.token}});var qp=Ut((a1,Fp)=>{"use strict";var $l=Object.defineProperty,Px=Object.getOwnPropertyDescriptor,Nx=Object.getOwnPropertyNames,Dx=Object.prototype.hasOwnProperty,Lx=(r,e)=>{for(var t in e)$l(r,t,{get:e[t],enumerable:!0})},$x=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Nx(e))!Dx.call(r,s)&&s!==t&&$l(r,s,{get:()=>e[s],enumerable:!(n=Px(e,s))||n.enumerable});return r},Ux=r=>$x($l({},"__esModule",{value:!0}),r),jp={};Lx(jp,{getVercelOidcToken:()=>qx,getVercelOidcTokenSync:()=>Ll});Fp.exports=Ux(jp);var jx=Il(),Fx=Zs();async function qx(){let r="",e;try{r=Ll()}catch(t){e=t}try{let[{getTokenPayload:t,isExpired:n},{refreshToken:s}]=await Promise.all([await Promise.resolve().then(()=>Ln(ha())),await Promise.resolve().then(()=>Ln(Up()))]);(!r||n(t(r)))&&(await s(),r=Ll())}catch(t){let n=e instanceof Error?e.message:"";throw t instanceof Error&&(n=`${n}
3
3
  ${t.message}`),n?new Fx.VercelOidcTokenError(n):t}return r}function Ll(){let r=(0,jx.getContext)().headers?.["x-vercel-oidc-token"]??process.env.VERCEL_OIDC_TOKEN;if(!r)throw new Error("The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?");return r}});var jl=Ut((i1,Vp)=>{"use strict";var Ul=Object.defineProperty,Bx=Object.getOwnPropertyDescriptor,Hx=Object.getOwnPropertyNames,Vx=Object.prototype.hasOwnProperty,zx=(r,e)=>{for(var t in e)Ul(r,t,{get:e[t],enumerable:!0})},Wx=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Hx(e))!Vx.call(r,s)&&s!==t&&Ul(r,s,{get:()=>e[s],enumerable:!(n=Bx(e,s))||n.enumerable});return r},Gx=r=>Wx(Ul({},"__esModule",{value:!0}),r),Hp={};zx(Hp,{getContext:()=>Yx.getContext,getVercelOidcToken:()=>Bp.getVercelOidcToken,getVercelOidcTokenSync:()=>Bp.getVercelOidcTokenSync});Vp.exports=Gx(Hp);var Bp=qp(),Yx=Il()});import{readFileSync as bD}from"node:fs";import{fileURLToPath as _D}from"node:url";import{dirname as wD,join as Kb}from"node:path";import{spawn as QN}from"node:child_process";import{mkdirSync as XN,writeFileSync as ZN,existsSync as eD,statSync as tD}from"node:fs";import{tmpdir as rD}from"node:os";import fu from"node:path";import{createInterface as nD}from"node:readline";var n_=["password","secret","token","credential","apikey","api_key"];function $n(r){let e={};for(let[t,n]of Object.entries(r))n_.some(s=>t.toLowerCase().includes(s))?e[t]="[REDACTED]":typeof n=="object"&&n!==null&&!Array.isArray(n)?e[t]=$n(n):e[t]=n;return e}var $s=class{emit(){}async flush(){}};function un(r,e){return{projectId:r.projectId,sessionKind:r.kind,title:r.title,model:r.config?.model,layoutPreset:r.config?.layoutPreset,screenWidth:r.config?.screenWidth,screenHeight:r.config?.screenHeight,testCoverage:r.config?.happyPathOnly??!0?"happy_path":"full",targetPlatform:r.config?.platform??"web",initialUrl:r.config?.initialUrl,testPlanId:r.testPlanId,agentMode:r.config?.mobileConfig?.mobileAgentMode,deviceMode:r.config?.mobileConfig?.deviceMode,appIdentifier:r.config?.mobileConfig?.appIdentifier,snapshotOnly:r.config?.snapshotOnly,headless:r.config?.headless,hasExtension:r.config?.extensionPath?!0:void 0,maxIterations:r.config?.maxIterationsPerTurn,...e}}var Un=class{url;constructor(e="http://localhost:8787"){this.url=e}emit(e){fetch(`${this.url}/ingest`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).catch(()=>{})}async flush(){}destroy(){}};var s_="The AI service is temporarily unavailable. Please retry shortly.";function tr(r){let e=r.toLowerCase();return e.includes("providerunavailableforlocationerror")||e.includes("provider_location_unsupported")||e.includes("user location is not supported for the api use")||e.includes("location is not supported for the api use")}function Us(){return s_}function qr(r){let e=r.toLowerCase();return e.includes("input token count exceeds")||e.includes("exceeds the maximum number of tokens")||e.includes("maximum number of tokens allowed")||e.includes("maximum context length")||e.includes("context length")||e.includes("context window")||e.includes("prompt is too long")||e.includes("too many tokens")}function Br(r={}){return r.isChildAgent?"Explorer paused because the page/context was too large to process in one pass. Partial findings were preserved; retry this slice with a narrower scope.":"I collected partial evidence, but the page/context was too large to process in one pass. Please retry with a narrower scope or ask me to continue from the current state."}function rr(r){return`${r}_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}var jn=class{apiUrl;fetchFn;sessions=new Map;queues=new Map;timer=null;isUploading=!1;inFlight=new Set;BATCH_SIZE=10;FLUSH_INTERVAL=3e4;MAX_PAYLOAD_BYTES=35e5;auth;constructor(e,t,n=globalThis.fetch.bind(globalThis)){this.apiUrl=e,this.fetchFn=n,this.auth=typeof t=="string"?{kind:"bearer",token:t}:t,this.timer=setInterval(()=>this.flushAll(),this.FLUSH_INTERVAL)}buildAuthHeaders(e,t=!1){let n={"Content-Type":"application/json"};if(this.auth.kind==="bearer")return n.Authorization=`Bearer ${this.auth.token}`,n;if(t&&this.auth.bearerFallback)return n.Authorization=`Bearer ${this.auth.bearerFallback}`,n;n["x-admin-service-key"]=this.auth.serviceKey;let s=e?.userId??this.auth.fallbackUserId;return s&&(n["x-user-id"]=s),n}hasBearerFallback(){return this.auth.kind==="service"&&!!this.auth.bearerFallback}emit(e){let t=e.sessionId;if(e.kind==="session_start"&&e.sessionMeta&&this.sessions.set(t,{...e.sessionMeta,desktopSessionId:t,status:"active",startedAt:new Date(e.ts).toISOString()}),e.kind==="session_end"){let s=this.sessions.get(t);s&&(s.status=e.status??"completed",s.endedAt=new Date(e.ts).toISOString())}if(this.isProviderLocationUnsupportedEvent(e)){let s=this.sessions.get(t);s&&(s.terminalErrorClass="provider_location_unsupported")}!t&&!this.sessions.has("")&&this.sessions.set("",{desktopSessionId:"global",projectId:"_global",status:"active",startedAt:new Date(e.ts).toISOString()});let n=this.queues.get(t);n||(n=[],this.queues.set(t,n)),n.push(e),n.length>=this.BATCH_SIZE&&this.flushSession(t),e.kind==="session_end"&&this.flushSession(t)}async flush(){await this.flushAll()}destroy(){this.timer&&(clearInterval(this.timer),this.timer=null),this.flushAll()}async flushAll(){let e=[];for(let n of this.queues.keys()){let s=this.flushSession(n);s&&e.push(s)}let t=Array.from(this.inFlight);await Promise.allSettled([...e,...t])}flushSession(e){let t=this.sessions.get(e),n=this.queues.get(e);if(!t||!n||n.length===0)return null;let s=n.splice(0),o=this.uploadWithRetry(t,s).catch(a=>{let i=s.filter(l=>l.kind==="session_end");if(i.length>0){let l=this.queues.get(t.desktopSessionId);l&&l.unshift(...i)}console.error(`[RemoteAnalyticsSink] Failed to upload ${s.length} events:`,a.message)});return this.inFlight.add(o),o.finally(()=>{this.inFlight.delete(o)}),o}async uploadWithRetry(e,t,n=3){let s;for(let o=1;o<=n;o++)try{await this.upload(e,t);return}catch(a){s=a;let i=a?.status;if(i!==void 0&&i>=400&&i<500)throw a;if(o<n){let l=Math.min(1e3*Math.pow(3,o-1),9e3);await new Promise(c=>setTimeout(c,l))}}throw s}async upload(e,t){let n=await this.mapEvents(e.desktopSessionId,t);await this.postIngest(e,n)}async postIngest(e,t,n=!1){if(t.length===0)return;let s=JSON.stringify({session:{...e},events:t});if(s.length>this.MAX_PAYLOAD_BYTES&&t.length>1){let l=Math.floor(t.length/2);await this.postIngest(e,t.slice(0,l),n),await this.postIngest(e,t.slice(l),n);return}let o;try{o=await this.fetchFn(`${this.apiUrl}/api/analytics/ingest`,{method:"POST",headers:this.buildAuthHeaders(e,n),body:s})}catch(l){throw new Error(`analytics upload network error: ${l?.message??String(l)}`)}if(o.ok)return;if((o.status===401||o.status===403)&&!n&&this.hasBearerFallback()){console.warn(`[RemoteAnalyticsSink] service-key auth got ${o.status} for session ${e.desktopSessionId} \u2014 retrying with bearer fallback (AG-169)`),await this.postIngest(e,t,!0);return}if(o.status===413){if(t.length>1){let l=Math.floor(t.length/2);await this.postIngest(e,t.slice(0,l),n),await this.postIngest(e,t.slice(l),n);return}console.warn(`[RemoteAnalyticsSink] Dropping single oversized event (${Math.round(s.length/1024)} KB)`);return}let a=await o.text().catch(()=>`HTTP ${o.status}`);if(a.includes("FUNCTION_PAYLOAD_TOO_LARGE")||a.includes("Request Entity Too Large")){if(t.length>1){let l=Math.floor(t.length/2);await this.postIngest(e,t.slice(0,l),n),await this.postIngest(e,t.slice(l),n);return}console.warn(`[RemoteAnalyticsSink] Dropping single oversized event (${Math.round(s.length/1024)} KB)`);return}(o.status===401||o.status===403)&&console.error(`[RemoteAnalyticsSink] auth_failed status=${o.status} authKind=${this.auth.kind} sessionId=${e.desktopSessionId} userId=${e.userId??"(unset)"} body=${a.slice(0,200)}`);let i=new Error(a);throw i.status=o.status,i}async mapEvents(e,t){let n=[];for(let s of t){let o={timestamp:new Date(s.ts).toISOString()};switch(s.kind){case"message":n.push({...o,id:rr("msg"),eventType:"message",role:s.role,messageText:s.text,toolName:s.actionName,toolArgs:s.actionArgs,url:s.url});break;case"tool_call":{let a;s.screenshotBase64&&(a=await this.uploadScreenshot(e,s.screenshotBase64)),n.push({...o,id:rr("tool"),eventType:"tool_call",toolName:s.toolName,toolArgs:s.args,toolResult:s.result,screenshotUrl:a,url:s.url,stepIndex:s.stepIndex,actionMetadata:{durationMs:s.durationMs,tokenCount:s.tokenCount}});break}case"llm_usage":n.push({...o,id:rr("llm"),eventType:"llm_usage",toolName:s.model,promptTokens:s.promptTokens,completionTokens:s.completionTokens,totalTokens:s.totalTokens,runId:s.runId,actionMetadata:{durationMs:s.durationMs,finishReason:s.finishReason,tokenCount:s.tokenCount,messageCount:s.messageCount,systemPromptHash:s.systemPromptHash,lastToolResults:s.lastToolResults,chosenActions:s.chosenActions,textResponse:s.textResponse}});break;case"supervisor_verdict":n.push({...o,id:rr("sv"),eventType:"supervisor_verdict",actionType:s.verdict,actionMetadata:{verdict:s.verdict,message:s.message,iteration:s.iteration,actionLogSize:s.actionLogSize,stepText:s.stepText}});break;case"agent_lifecycle":n.push({...o,id:rr("lc"),eventType:"agent_lifecycle",actionType:s.event,actionMetadata:{event:s.event,iteration:s.iteration,details:s.details}});break;case"user_action":n.push({...o,id:rr("ua"),eventType:"user_action",actionType:s.action,actionTargetId:s.targetId,actionMetadata:s.metadata});break;case"session_start":case"session_end":case"turn_start":case"turn_end":n.push({...o,id:rr("sl"),eventType:"user_action",actionType:s.kind,actionTargetId:s.sessionId,actionMetadata:s.sessionMeta?{...s.sessionMeta}:{status:s.status}});break;case"log":n.push({...o,id:rr("diag"),eventType:"diagnostic",actionType:s.level,actionMetadata:{source:s.source,msg:s.msg,...s.data}});break;case"pageSnapshot.structuralStrip":n.push({...o,id:rr("diag"),eventType:"diagnostic",actionType:s.kind,actionMetadata:{originalLen:s.originalLen,finalLen:s.finalLen,droppedNodeCount:s.droppedNodeCount,foldedRunCount:s.foldedRunCount,capHit:s.capHit}});break;default:{console.warn(`[RemoteAnalyticsSink] dropping unmapped DiagnosticEvent kind=${s.kind}`);break}}}return n}isProviderLocationUnsupportedEvent(e){return e.kind!=="log"?!1:tr([e.msg,e.source,typeof e.data=="object"&&e.data?JSON.stringify(e.data):""].join(`
4
- `))}async uploadScreenshot(e,t){try{let n=rr("img"),s=this.sessions.get(e)??null;return(await(await this.fetchFn(`${this.apiUrl}/api/analytics/upload-image`,{method:"POST",headers:this.buildAuthHeaders(s),body:JSON.stringify({sessionId:e,eventId:n,imageBase64:t})})).json()).url??void 0}catch(n){console.error("[RemoteAnalyticsSink] Screenshot upload failed:",n.message);return}}};function br(r,e){return r.replace(/\{\{timestamp\}\}/g,String(e)).replace(/\{\{unique\}\}/g,o_(e))}function o_(r){let e="abcdefghijklmnopqrstuvwxyz",t="",n=r;for(;n>0;)t=e[n%26]+t,n=Math.floor(n/26);return t||"a"}var a_={type:"string",description:'Brief explanation of what you are doing and why (e.g., "Clicking Login button to access account", "Scrolling to find pricing section")'},i_={type:"string",description:'Name of the screen you are currently looking at (e.g., "Login Page", "Dashboard", "Settings > Billing"). Use consistent names across actions on the same screen.'},l_={type:"array",description:"On the FIRST action of each new screen, list the main navigation elements visible (links, buttons, tabs that lead to other screens). Omit on subsequent actions on the same screen.",items:{type:"object",properties:{label:{type:"string",description:"Text label of the navigation element"},element:{type:"string",description:'Element type: "nav-link", "button", "tab", "menu-item", "sidebar-link", etc.'}},required:["label","element"]}},Gi=[{name:"open_web_browser",description:"Open the web browser session.",parameters:{type:"object",properties:{},required:[]}},{name:"screenshot",description:"Capture a screenshot of the current viewport.",parameters:{type:"object",properties:{},required:[]}},{name:"full_page_screenshot",description:"Capture a full-page screenshot (entire scrollable content). Use this for page exploration/verification to see all content at once.",parameters:{type:"object",properties:{},required:[]}},{name:"switch_layout",description:"Switch browser viewport to a different layout/device size. Presets: mobile (390x844), tablet (834x1112), small_laptop (1366x768), big_laptop (1440x900).",parameters:{type:"object",properties:{width:{type:"number",description:"Viewport width in pixels"},height:{type:"number",description:"Viewport height in pixels"}},required:["width","height"]}},{name:"navigate",description:"Navigate to a URL.",parameters:{type:"object",properties:{url:{type:"string"}},required:["url"]}},{name:"click_at",description:'Click at normalized coordinates (0-1000 scale) or by element ref from page snapshot. If the target is a <select>, the response returns elementType="select" with availableOptions \u2014 use set_focused_input_value to pick an option. For multi-select, use modifiers: ["Control"] (Windows/Linux) or ["Meta"] (Mac). If the target is a file input, the response returns elementType="file" with accept and multiple \u2014 use upload_file to set files.',parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},x:{type:"number"},y:{type:"number"},modifiers:{type:"array",items:{type:"string",enum:["Control","Shift","Alt","Meta"]},description:"Modifier keys to hold during click. Use Control for Ctrl+click (multi-select on Windows/Linux), Meta for Cmd+click (Mac), Shift for range selection."}},required:[]}},{name:"right_click_at",description:"Right-click (context menu click) at normalized coordinates (0-1000 scale) or by element ref from page snapshot.",parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},x:{type:"number"},y:{type:"number"}},required:[]}},{name:"hover_at",description:"Hover at normalized coordinates (0-1000 scale) or by element ref from page snapshot.",parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},x:{type:"number"},y:{type:"number"}},required:[]}},{name:"type_text_at",description:"Type text into a text input field by visible label, element ref, or coordinates. Prefer label for adjacent form fields with visible labels (for example Contract # vs Booking #). Use ONLY for text inputs (input, textarea, contenteditable). Do NOT use for <select> dropdowns - use click_at to open the dropdown, then click_at again on the option. Coordinates are normalized (0-1000). The response includes typedIntoField with the accessible/visible name of the field that received input.",parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},label:{type:"string",description:"Visible or accessibility label of the target text field. When provided, label is preferred over ref/x/y."},x:{type:"number"},y:{type:"number"},text:{type:"string"},pressEnter:{type:"boolean",default:!1},clearBeforeTyping:{type:"boolean",default:!0}},required:["text"]}},{name:"type_project_credential_at",description:"Type the hidden SECRET/PASSWORD of a stored project credential into a form field by element ref or coordinates. The credential name shown in PROJECT MEMORY is visible to you \u2014 type it as plain text with type_text_at for username/email fields. This tool ONLY types the hidden secret value. ONLY use credential names explicitly listed in PROJECT MEMORY. Do NOT guess or assume credential names exist.",parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},x:{type:"number"},y:{type:"number"},credentialName:{type:"string",description:"Exact name of a credential from PROJECT MEMORY"},pressEnter:{type:"boolean",default:!1},clearBeforeTyping:{type:"boolean",default:!0}},required:["credentialName"]}},{name:"scroll_document",description:"Scroll the document.",parameters:{type:"object",properties:{direction:{type:"string",enum:["up","down","left","right"]}},required:["direction"]}},{name:"scroll_to_bottom",description:"Scroll to the bottom of the page.",parameters:{type:"object",properties:{},required:[]}},{name:"scroll_at",description:"Scroll at coordinates or element ref with direction and magnitude (normalized).",parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},x:{type:"number"},y:{type:"number"},direction:{type:"string",enum:["up","down","left","right"]},magnitude:{type:"number"}},required:["direction"]}},{name:"wait",description:"Wait for a specified number of seconds before taking a screenshot. Use after clicks that trigger loading states (spinners, progress bars). Choose duration based on expected load time. For content-specific waits, prefer wait_for_element.",parameters:{type:"object",properties:{seconds:{type:"number",description:"Seconds to wait (1-30, default 2)"}},required:[]}},{name:"wait_for_element",description:"Wait for specific text to become visible on the page. Use when you know what content should appear (loading spinner resolves to results, success message appears, tab content loads). Matches as a case-sensitive substring \u2014 be specific to avoid matching loading indicators. Returns a screenshot once the text is found. If not found within the timeout, returns current page state with a timeout error.",parameters:{type:"object",properties:{textContent:{type:"string",description:'Text the element should contain (substring match). Be specific \u2014 "Order confirmed" not just "Order".'},timeoutSeconds:{type:"number",description:"Max seconds to wait (default 5, max 30)"}},required:["textContent"]}},{name:"go_back",description:"Go back.",parameters:{type:"object",properties:{},required:[]}},{name:"go_forward",description:"Go forward.",parameters:{type:"object",properties:{},required:[]}},{name:"key_combination",description:'Press a key combination. Provide keys as an array of strings (e.g., ["Command","L"]).',parameters:{type:"object",properties:{keys:{type:"array",items:{type:"string"}}},required:["keys"]}},{name:"set_focused_input_value",description:"Set value on the currently focused input or select. Call click_at first to focus the element, then this tool. Works for all input types including date/time and select dropdowns. Returns elementType, valueBefore, valueAfter in the response. For selects: also returns availableOptions. For date: YYYY-MM-DD. For time: HH:MM (24h). For datetime-local: YYYY-MM-DDTHH:MM.",parameters:{type:"object",properties:{value:{type:"string",description:'Value to set. For select/dropdown elements: use the visible option text (e.g., "Damage deposit"). For date/time inputs: use ISO format (date: "2026-02-15", time: "14:30", datetime-local: "2026-02-15T14:30"). For text inputs: plain text.'}},required:["value"]}},{name:"drag_and_drop",description:"Drag and drop using element refs from page snapshot (ref, destinationRef) or normalized coords (x, y, destinationX, destinationY, 0-1000 scale).",parameters:{type:"object",properties:{ref:{type:"string",description:'Source element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},destinationRef:{type:"string",description:"Destination element reference from page snapshot. When provided, destinationX/destinationY are ignored."},x:{type:"number"},y:{type:"number"},destinationX:{type:"number"},destinationY:{type:"number"}},required:[]}},{name:"upload_file",description:'Upload file(s) to a file input. PREREQUISITE: click_at on the file input first \u2014 the response will show elementType="file" with accept types and multiple flag. Then call this tool with absolute file paths. The files must exist on the local filesystem.',parameters:{type:"object",properties:{filePaths:{type:"array",items:{type:"string"},description:'Absolute paths to files to upload (e.g., ["/Users/alex/Desktop/photo.png"]).'}},required:["filePaths"]}},{name:"switch_tab",description:"Switch between browser tabs. Tab 1 is the original page, tab 2 is opened by links or popups.",parameters:{type:"object",properties:{tab:{type:"string",enum:["tab1","tab2"],description:"Which tab to switch to"}},required:["tab"]}},{name:"close_tab",description:"Close the current tab and switch to the other. Cannot close tab 1.",parameters:{type:"object",properties:{},required:[]}},{name:"http_request",description:"Make an HTTP request. Shares the browser session's cookies and auth context (including httpOnly cookies) but is NOT subject to CORS \u2014 can reach any URL. Use this to verify API state after UI actions, set up test data, or test API endpoints directly. Response body is truncated to 50KB.",parameters:{type:"object",properties:{url:{type:"string",description:"The URL to send the request to"},method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE"],description:"HTTP method. Defaults to GET."},headers:{type:"object",description:'Optional request headers as key-value pairs (e.g., {"Content-Type": "application/json"})'},body:{type:"string",description:"Optional request body (for POST/PUT/PATCH). Send JSON as a string."}},required:["url"]}},{name:"run_js",description:"Execute arbitrary JavaScript in the page context via Playwright page.evaluate. Use ONLY as a last resort when normal UI actions cannot make progress \u2014 e.g. clearing browser-side persistent storage (cookies plus the standard Web Storage APIs) to recover from a sticky rejection state, reading hidden DOM state, or force-setting form values that do not accept normal click/type. Prefer typed UI actions whenever possible. Each call is logged. Returns the JSON-serialized return value (or undefined), capped at 5KB.",parameters:{type:"object",properties:{code:{type:"string",description:"JavaScript expression or statement to evaluate in the page context. Capped at 4000 characters."}},required:["code"]}}];function bu(r){return r.map(e=>({...e,parameters:{...e.parameters,properties:{intent:a_,screen:i_,visible_navigation:l_,...e.parameters.properties},required:["intent","screen",...e.parameters.required]}}))}var Fn=bu(Gi),c_=new Set(["screenshot","full_page_screenshot"]),u_=Gi.filter(r=>!c_.has(r.name));var qn=bu(u_),_u=new Set(Gi.map(r=>r.name));function Bn(r){return{open_web_browser:"Opening browser",screenshot:"Taking screenshot",full_page_screenshot:"Capturing full page",switch_layout:"Switching viewport",navigate:"Navigating",click_at:"Clicking",right_click_at:"Right-clicking",hover_at:"Hovering",type_text_at:"Typing text",type_project_credential_at:"Entering credentials",scroll_document:"Scrolling page",scroll_to_bottom:"Scrolling to bottom",scroll_at:"Scrolling",wait:"Waiting",wait_for_element:"Waiting for element",go_back:"Going back",go_forward:"Going forward",key_combination:"Pressing keys",set_focused_input_value:"Setting input value",drag_and_drop:"Dragging element",upload_file:"Uploading file",switch_tab:"Switching tab",close_tab:"Closing tab",http_request:"Making HTTP request",run_js:"Running JavaScript"}[r]??r.replace(/_/g," ")}function zo(r,e,t){return r==="type_project_credential_at"||r==="mobile_type_credential"?{...e,projectId:t}:e}var Hn=`Screenshot Click Indicator:
4
+ `))}async uploadScreenshot(e,t){let n=rr("img"),s=this.sessions.get(e)??null,o=JSON.stringify({sessionId:e,eventId:n,imageBase64:t}),a=i=>this.fetchFn(`${this.apiUrl}/api/analytics/upload-image`,{method:"POST",headers:this.buildAuthHeaders(s,i),body:o});try{let i=await a(!1);if((i.status===401||i.status===403)&&this.hasBearerFallback()&&(console.warn(`[RemoteAnalyticsSink] upload-image service-key auth got ${i.status} for session ${e} \u2014 retrying with bearer fallback (AG-388)`),i=await a(!0)),!i.ok){let c=await i.text().catch(()=>`HTTP ${i.status}`);console.error(`[RemoteAnalyticsSink] upload-image failed status=${i.status} authKind=${this.auth.kind} sessionId=${e} userId=${s?.userId??"(unset)"} body=${c.slice(0,200)}`);return}let l=await i.json().catch(()=>null);if(!l||!l.url){console.warn(`[RemoteAnalyticsSink] upload-image returned no url (success=${l?.success??"(none)"}) for session ${e} \u2014 screenshot_url will be null`);return}return l.url}catch(i){console.error(`[RemoteAnalyticsSink] upload-image network error for session ${e}:`,i.message);return}}};function br(r,e){return r.replace(/\{\{timestamp\}\}/g,String(e)).replace(/\{\{unique\}\}/g,o_(e))}function o_(r){let e="abcdefghijklmnopqrstuvwxyz",t="",n=r;for(;n>0;)t=e[n%26]+t,n=Math.floor(n/26);return t||"a"}var a_={type:"string",description:'Brief explanation of what you are doing and why (e.g., "Clicking Login button to access account", "Scrolling to find pricing section")'},i_={type:"string",description:'Name of the screen you are currently looking at (e.g., "Login Page", "Dashboard", "Settings > Billing"). Use consistent names across actions on the same screen.'},l_={type:"array",description:"On the FIRST action of each new screen, list the main navigation elements visible (links, buttons, tabs that lead to other screens). Omit on subsequent actions on the same screen.",items:{type:"object",properties:{label:{type:"string",description:"Text label of the navigation element"},element:{type:"string",description:'Element type: "nav-link", "button", "tab", "menu-item", "sidebar-link", etc.'}},required:["label","element"]}},Gi=[{name:"open_web_browser",description:"Open the web browser session.",parameters:{type:"object",properties:{},required:[]}},{name:"screenshot",description:"Capture a screenshot of the current viewport.",parameters:{type:"object",properties:{},required:[]}},{name:"full_page_screenshot",description:"Capture a full-page screenshot (entire scrollable content). Use this for page exploration/verification to see all content at once.",parameters:{type:"object",properties:{},required:[]}},{name:"switch_layout",description:"Switch browser viewport to a different layout/device size. Presets: mobile (390x844), tablet (834x1112), small_laptop (1366x768), big_laptop (1440x900).",parameters:{type:"object",properties:{width:{type:"number",description:"Viewport width in pixels"},height:{type:"number",description:"Viewport height in pixels"}},required:["width","height"]}},{name:"navigate",description:"Navigate to a URL.",parameters:{type:"object",properties:{url:{type:"string"}},required:["url"]}},{name:"click_at",description:'Click at normalized coordinates (0-1000 scale) or by element ref from page snapshot. If the target is a <select>, the response returns elementType="select" with availableOptions \u2014 use set_focused_input_value to pick an option. For multi-select, use modifiers: ["Control"] (Windows/Linux) or ["Meta"] (Mac). If the target is a file input, the response returns elementType="file" with accept and multiple \u2014 use upload_file to set files.',parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},x:{type:"number"},y:{type:"number"},modifiers:{type:"array",items:{type:"string",enum:["Control","Shift","Alt","Meta"]},description:"Modifier keys to hold during click. Use Control for Ctrl+click (multi-select on Windows/Linux), Meta for Cmd+click (Mac), Shift for range selection."}},required:[]}},{name:"right_click_at",description:"Right-click (context menu click) at normalized coordinates (0-1000 scale) or by element ref from page snapshot.",parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},x:{type:"number"},y:{type:"number"}},required:[]}},{name:"hover_at",description:"Hover at normalized coordinates (0-1000 scale) or by element ref from page snapshot.",parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},x:{type:"number"},y:{type:"number"}},required:[]}},{name:"type_text_at",description:"Type text into a text input field by visible label, element ref, or coordinates. Prefer label for adjacent form fields with visible labels (for example Contract # vs Booking #). Use ONLY for text inputs (input, textarea, contenteditable). Do NOT use for <select> dropdowns - use click_at to open the dropdown, then click_at again on the option. Coordinates are normalized (0-1000). The response includes typedIntoField with the accessible/visible name of the field that received input.",parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},label:{type:"string",description:"Visible or accessibility label of the target text field. When provided, label is preferred over ref/x/y."},x:{type:"number"},y:{type:"number"},text:{type:"string"},pressEnter:{type:"boolean",default:!1},clearBeforeTyping:{type:"boolean",default:!0}},required:["text"]}},{name:"type_project_credential_at",description:"Type the hidden SECRET/PASSWORD of a stored project credential into a form field by element ref or coordinates. The credential name shown in PROJECT MEMORY is visible to you \u2014 type it as plain text with type_text_at for username/email fields. This tool ONLY types the hidden secret value. ONLY use credential names explicitly listed in PROJECT MEMORY. Do NOT guess or assume credential names exist.",parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},x:{type:"number"},y:{type:"number"},credentialName:{type:"string",description:"Exact name of a credential from PROJECT MEMORY"},pressEnter:{type:"boolean",default:!1},clearBeforeTyping:{type:"boolean",default:!0}},required:["credentialName"]}},{name:"scroll_document",description:"Scroll the document.",parameters:{type:"object",properties:{direction:{type:"string",enum:["up","down","left","right"]}},required:["direction"]}},{name:"scroll_to_bottom",description:"Scroll to the bottom of the page.",parameters:{type:"object",properties:{},required:[]}},{name:"scroll_at",description:"Scroll at coordinates or element ref with direction and magnitude (normalized).",parameters:{type:"object",properties:{ref:{type:"string",description:'Element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},x:{type:"number"},y:{type:"number"},direction:{type:"string",enum:["up","down","left","right"]},magnitude:{type:"number"}},required:["direction"]}},{name:"wait",description:"Wait for a specified number of seconds before taking a screenshot. Use after clicks that trigger loading states (spinners, progress bars). Choose duration based on expected load time. For content-specific waits, prefer wait_for_element.",parameters:{type:"object",properties:{seconds:{type:"number",description:"Seconds to wait (1-30, default 2)"}},required:[]}},{name:"wait_for_element",description:"Wait for specific text to become visible on the page. Use when you know what content should appear (loading spinner resolves to results, success message appears, tab content loads). Matches as a case-sensitive substring \u2014 be specific to avoid matching loading indicators. Returns a screenshot once the text is found. If not found within the timeout, returns current page state with a timeout error.",parameters:{type:"object",properties:{textContent:{type:"string",description:'Text the element should contain (substring match). Be specific \u2014 "Order confirmed" not just "Order".'},timeoutSeconds:{type:"number",description:"Max seconds to wait (default 5, max 30)"}},required:["textContent"]}},{name:"go_back",description:"Go back.",parameters:{type:"object",properties:{},required:[]}},{name:"go_forward",description:"Go forward.",parameters:{type:"object",properties:{},required:[]}},{name:"key_combination",description:'Press a key combination. Provide keys as an array of strings (e.g., ["Command","L"]).',parameters:{type:"object",properties:{keys:{type:"array",items:{type:"string"}}},required:["keys"]}},{name:"set_focused_input_value",description:"Set value on the currently focused input or select. Call click_at first to focus the element, then this tool. Works for all input types including date/time and select dropdowns. Returns elementType, valueBefore, valueAfter in the response. For selects: also returns availableOptions. For date: YYYY-MM-DD. For time: HH:MM (24h). For datetime-local: YYYY-MM-DDTHH:MM.",parameters:{type:"object",properties:{value:{type:"string",description:'Value to set. For select/dropdown elements: use the visible option text (e.g., "Damage deposit"). For date/time inputs: use ISO format (date: "2026-02-15", time: "14:30", datetime-local: "2026-02-15T14:30"). For text inputs: plain text.'}},required:["value"]}},{name:"drag_and_drop",description:"Drag and drop using element refs from page snapshot (ref, destinationRef) or normalized coords (x, y, destinationX, destinationY, 0-1000 scale).",parameters:{type:"object",properties:{ref:{type:"string",description:'Source element reference from page snapshot (e.g. "e5"). When provided, x/y are ignored.'},destinationRef:{type:"string",description:"Destination element reference from page snapshot. When provided, destinationX/destinationY are ignored."},x:{type:"number"},y:{type:"number"},destinationX:{type:"number"},destinationY:{type:"number"}},required:[]}},{name:"upload_file",description:'Upload file(s) to a file input. PREREQUISITE: click_at on the file input first \u2014 the response will show elementType="file" with accept types and multiple flag. Then call this tool with absolute file paths. The files must exist on the local filesystem.',parameters:{type:"object",properties:{filePaths:{type:"array",items:{type:"string"},description:'Absolute paths to files to upload (e.g., ["/Users/alex/Desktop/photo.png"]).'}},required:["filePaths"]}},{name:"switch_tab",description:"Switch between browser tabs. Tab 1 is the original page, tab 2 is opened by links or popups.",parameters:{type:"object",properties:{tab:{type:"string",enum:["tab1","tab2"],description:"Which tab to switch to"}},required:["tab"]}},{name:"close_tab",description:"Close the current tab and switch to the other. Cannot close tab 1.",parameters:{type:"object",properties:{},required:[]}},{name:"http_request",description:"Make an HTTP request. Shares the browser session's cookies and auth context (including httpOnly cookies) but is NOT subject to CORS \u2014 can reach any URL. Use this to verify API state after UI actions, set up test data, or test API endpoints directly. Response body is truncated to 50KB.",parameters:{type:"object",properties:{url:{type:"string",description:"The URL to send the request to"},method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE"],description:"HTTP method. Defaults to GET."},headers:{type:"object",description:'Optional request headers as key-value pairs (e.g., {"Content-Type": "application/json"})'},body:{type:"string",description:"Optional request body (for POST/PUT/PATCH). Send JSON as a string."}},required:["url"]}},{name:"run_js",description:"Execute arbitrary JavaScript in the page context via Playwright page.evaluate. Use ONLY as a last resort when normal UI actions cannot make progress \u2014 e.g. clearing browser-side persistent storage (cookies plus the standard Web Storage APIs) to recover from a sticky rejection state, reading hidden DOM state, or force-setting form values that do not accept normal click/type. Prefer typed UI actions whenever possible. Each call is logged. Returns the JSON-serialized return value (or undefined), capped at 5KB.",parameters:{type:"object",properties:{code:{type:"string",description:"JavaScript expression or statement to evaluate in the page context. Capped at 4000 characters."}},required:["code"]}}];function bu(r){return r.map(e=>({...e,parameters:{...e.parameters,properties:{intent:a_,screen:i_,visible_navigation:l_,...e.parameters.properties},required:["intent","screen",...e.parameters.required]}}))}var Fn=bu(Gi),c_=new Set(["screenshot","full_page_screenshot"]),u_=Gi.filter(r=>!c_.has(r.name));var qn=bu(u_),_u=new Set(Gi.map(r=>r.name));function Bn(r){return{open_web_browser:"Opening browser",screenshot:"Taking screenshot",full_page_screenshot:"Capturing full page",switch_layout:"Switching viewport",navigate:"Navigating",click_at:"Clicking",right_click_at:"Right-clicking",hover_at:"Hovering",type_text_at:"Typing text",type_project_credential_at:"Entering credentials",scroll_document:"Scrolling page",scroll_to_bottom:"Scrolling to bottom",scroll_at:"Scrolling",wait:"Waiting",wait_for_element:"Waiting for element",go_back:"Going back",go_forward:"Going forward",key_combination:"Pressing keys",set_focused_input_value:"Setting input value",drag_and_drop:"Dragging element",upload_file:"Uploading file",switch_tab:"Switching tab",close_tab:"Closing tab",http_request:"Making HTTP request",run_js:"Running JavaScript"}[r]??r.replace(/_/g," ")}function zo(r,e,t){return r==="type_project_credential_at"||r==="mobile_type_credential"?{...e,projectId:t}:e}var Hn=`Screenshot Click Indicator:
5
5
  A red circle may appear in screenshots marking the previous click location. Note: the circle won't appear if the page navigated or refreshed after clicking.
6
6
  `;function Vn({snapshotOnly:r}){return r?`\u2550\u2550\u2550 BROWSER TARGETING POLICY \u2550\u2550\u2550
7
7
  You are using a page snapshot/accessibility tree, not visual screenshots.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentiqa",
3
- "version": "1.1.7-staging.7150afd",
3
+ "version": "1.1.7-staging.fc9ac4f",
4
4
  "description": "AI-powered testing for web and mobile apps",
5
5
  "type": "module",
6
6
  "bin": "dist/cli.js",