page-agent 0.0.11 → 0.0.13
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/README.md +5 -4
- package/dist/umd/page-agent.js +2 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -31,10 +31,11 @@ The GUI Agent Living in Your Webpage. Control web interfaces with natural langua
|
|
|
31
31
|
### CDN Integration
|
|
32
32
|
|
|
33
33
|
```html
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
// CDN - https://cdn.jsdelivr.net/npm/page-agent@latest/dist/umd/page-agent.js
|
|
35
|
+
// Mirror(CN) - https://registry.npmmirror.com/page-agent/latest/files/dist/umd/page-agent.js
|
|
36
|
+
<script
|
|
37
|
+
src="https://cdn.jsdelivr.net/npm/page-agent@latest/dist/umd/page-agent.js"
|
|
38
|
+
crossorigin="true"
|
|
38
39
|
type="text/javascript"
|
|
39
40
|
></script>
|
|
40
41
|
```
|
package/dist/umd/page-agent.js
CHANGED
|
@@ -155,7 +155,7 @@ out vec2 vUV;
|
|
|
155
155
|
void main() {
|
|
156
156
|
vUV = aUV;
|
|
157
157
|
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
158
|
-
}`;const COLORS=["rgb(57, 182, 255)","rgb(189, 69, 251)","rgb(255, 87, 51)","rgb(255, 214, 0)"];function parseColor(e){const r=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!r)throw new Error(`Invalid color format: ${e}`);const[,n,o,t]=r;return[parseInt(n)/255,parseInt(o)/255,parseInt(t)/255]}s(parseColor,"parseColor");const ct=class ct{element;canvas;options;running=!1;disposed=!1;startTime=0;lastTime=0;rafId=null;glr;observer;constructor(r={}){this.options={width:r.width??600,height:r.height??600,ratio:r.ratio??window.devicePixelRatio??1,borderWidth:r.borderWidth??8,glowWidth:r.glowWidth??200,borderRadius:r.borderRadius??8,mode:r.mode??"light",...r},this.canvas=document.createElement("canvas"),this.options.classNames&&(this.canvas.className=this.options.classNames),this.options.styles&&Object.assign(this.canvas.style,this.options.styles),this.canvas.style.display="block",this.canvas.style.transformOrigin="center",this.canvas.style.pointerEvents="none",this.element=this.canvas,this.setupGL(),this.options.skipGreeting||this.greet()}start(){if(this.disposed)throw new Error("Motion instance has been disposed.");if(this.running)return;if(!this.glr){console.error("WebGL resources are not initialized.");return}this.running=!0,this.startTime=performance.now(),this.resize(this.options.width??600,this.options.height??600,this.options.ratio),this.glr.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.glr.gl.useProgram(this.glr.program),this.glr.gl.uniform2f(this.glr.uResolution,this.canvas.width,this.canvas.height),this.checkGLError(this.glr.gl,"start: after initial setup");const r=s(()=>{if(!this.running||!this.glr)return;this.rafId=requestAnimationFrame(r);const n=performance.now();if(n-this.lastTime<1e3/32)return;this.lastTime=n;const t=(n-this.startTime)*.001;this.render(t)},"loop");this.rafId=requestAnimationFrame(r)}pause(){if(this.disposed)throw new Error("Motion instance has been disposed.");this.running=!1,this.rafId!==null&&cancelAnimationFrame(this.rafId)}dispose(){if(this.disposed)return;this.disposed=!0,this.running=!1,this.rafId!==null&&cancelAnimationFrame(this.rafId);const{gl:r,vao:n,positionBuffer:o,uvBuffer:t,program:i}=this.glr;n&&r.deleteVertexArray(n),o&&r.deleteBuffer(o),t&&r.deleteBuffer(t),r.deleteProgram(i),this.observer&&this.observer.disconnect(),this.canvas.remove()}resize(r,n,o){if(this.disposed)throw new Error("Motion instance has been disposed.");if(this.options.width=r,this.options.height=n,o&&(this.options.ratio=o),!this.running)return;const{gl:t,program:i,vao:a,positionBuffer:c,uvBuffer:u,uResolution:l}=this.glr,d=o??this.options.ratio??window.devicePixelRatio??1,f=Math.max(1,Math.floor(r*d)),g=Math.max(1,Math.floor(n*d));this.canvas.style.width=`${r}px`,this.canvas.style.height=`${n}px`,(this.canvas.width!==f||this.canvas.height!==g)&&(this.canvas.width=f,this.canvas.height=g),t.viewport(0,0,this.canvas.width,this.canvas.height),this.checkGLError(t,"resize: after viewport setup");const{positions:h,uvs:b}=computeBorderGeometry(this.canvas.width,this.canvas.height,this.options.borderWidth*d,this.options.glowWidth*d);t.bindVertexArray(a),t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,h,t.STATIC_DRAW);const E=t.getAttribLocation(i,"aPosition");t.enableVertexAttribArray(E),t.vertexAttribPointer(E,2,t.FLOAT,!1,0,0),this.checkGLError(t,"resize: after position buffer update"),t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,b,t.STATIC_DRAW);const P=t.getAttribLocation(i,"aUV");t.enableVertexAttribArray(P),t.vertexAttribPointer(P,2,t.FLOAT,!1,0,0),this.checkGLError(t,"resize: after UV buffer update"),t.useProgram(i),t.uniform2f(l,this.canvas.width,this.canvas.height),t.uniform1f(this.glr.uBorderWidth,this.options.borderWidth*d),t.uniform1f(this.glr.uGlowWidth,this.options.glowWidth*d),t.uniform1f(this.glr.uBorderRadius,this.options.borderRadius*d),this.checkGLError(t,"resize: after uniform updates");const U=performance.now();this.lastTime=U;const J=(U-this.startTime)*.001;this.render(J)}autoResize(r){this.observer&&this.observer.disconnect(),this.observer=new ResizeObserver(()=>{const n=r.getBoundingClientRect();this.resize(n.width,n.height)}),this.observer.observe(r)}fadeIn(){if(this.disposed)throw new Error("Motion instance has been disposed.");return new Promise((r,n)=>{const o=this.canvas.animate([{opacity:0,transform:"scale(1.2)"},{opacity:1,transform:"scale(1)"}],{duration:300,easing:"ease-out",fill:"forwards"});o.onfinish=()=>r(),o.oncancel=()=>n("canceled")})}fadeOut(){if(this.disposed)throw new Error("Motion instance has been disposed.");return new Promise((r,n)=>{const o=this.canvas.animate([{opacity:1,transform:"scale(1)"},{opacity:0,transform:"scale(1.2)"}],{duration:300,easing:"ease-in",fill:"forwards"});o.onfinish=()=>r(),o.oncancel=()=>n("canceled")})}checkGLError(r,n){let o=r.getError();if(o!==r.NO_ERROR){for(console.group(`🔴 WebGL Error in ${n}`);o!==r.NO_ERROR;){const t=this.getGLErrorName(r,o);console.error(`${t} (0x${o.toString(16)})`),o=r.getError()}console.groupEnd()}}getGLErrorName(r,n){switch(n){case r.INVALID_ENUM:return"INVALID_ENUM";case r.INVALID_VALUE:return"INVALID_VALUE";case r.INVALID_OPERATION:return"INVALID_OPERATION";case r.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case r.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case r.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"UNKNOWN_ERROR"}}setupGL(){const r=this.canvas.getContext("webgl2",{antialias:!1,alpha:!0});if(!r)throw new Error("WebGL2 is required but not available.");const n=createProgram(r,vertexShaderSource,fragmentShaderSource);this.checkGLError(r,"setupGL: after createProgram");const o=r.createVertexArray();r.bindVertexArray(o),this.checkGLError(r,"setupGL: after VAO creation");const t=this.canvas.width||2,i=this.canvas.height||2,{positions:a,uvs:c}=computeBorderGeometry(t,i,this.options.borderWidth,this.options.glowWidth),u=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,a,r.STATIC_DRAW);const l=r.getAttribLocation(n,"aPosition");r.enableVertexAttribArray(l),r.vertexAttribPointer(l,2,r.FLOAT,!1,0,0),this.checkGLError(r,"setupGL: after position buffer setup");const d=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,d),r.bufferData(r.ARRAY_BUFFER,c,r.STATIC_DRAW);const f=r.getAttribLocation(n,"aUV");r.enableVertexAttribArray(f),r.vertexAttribPointer(f,2,r.FLOAT,!1,0,0),this.checkGLError(r,"setupGL: after UV buffer setup");const g=r.getUniformLocation(n,"uResolution"),h=r.getUniformLocation(n,"uTime"),b=r.getUniformLocation(n,"uBorderWidth"),E=r.getUniformLocation(n,"uGlowWidth"),P=r.getUniformLocation(n,"uBorderRadius"),U=r.getUniformLocation(n,"uColors"),J=r.getUniformLocation(n,"uGlowExponent"),Z=r.getUniformLocation(n,"uGlowFactor");r.useProgram(n),r.uniform1f(b,this.options.borderWidth),r.uniform1f(E,this.options.glowWidth),r.uniform1f(P,this.options.borderRadius),this.options.mode==="dark"?(r.uniform1f(J,2),r.uniform1f(Z,1.8)):(r.uniform1f(J,1),r.uniform1f(Z,1));const I=COLORS.map(parseColor);for(let N=0;N<I.length;N++)r.uniform3f(r.getUniformLocation(n,`uColors[${N}]`),...I[N]);this.checkGLError(r,"setupGL: after uniform setup"),r.bindVertexArray(null),r.bindBuffer(r.ARRAY_BUFFER,null),this.glr={gl:r,program:n,vao:o,positionBuffer:u,uvBuffer:d,uResolution:g,uTime:h,uBorderWidth:b,uGlowWidth:E,uBorderRadius:P,uColors:U}}render(r){if(!this.glr)return;const{gl:n,program:o,vao:t,uTime:i}=this.glr;n.useProgram(o),n.bindVertexArray(t),n.uniform1f(i,r),n.disable(n.DEPTH_TEST),n.disable(n.CULL_FACE),n.disable(n.BLEND),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLES,0,24),this.checkGLError(n,"render: after draw call"),n.bindVertexArray(null)}greet(){console.log("%c🌈 ai-motion 0.4.7 🌈","background: linear-gradient(90deg, #39b6ff, #bd45fb, #ff5733, #ffd600); color: white; text-shadow: 0 0 2px rgba(0, 0, 0, 0.2); font-weight: bold; font-size: 1em; padding: 2px 12px; border-radius: 6px;")}};s(ct,"Motion");let Motion=ct;function hasDarkModeClass(){const e=["dark","dark-mode","theme-dark","night","night-mode"],r=document.documentElement,n=document.body;for(const t of e)if(r.classList.contains(t)||n.classList.contains(t))return!0;return!!r.getAttribute("data-theme")?.toLowerCase().includes("dark")}s(hasDarkModeClass,"hasDarkModeClass");function parseRgbColor(e){const r=/rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(e);return r?{r:parseInt(r[1]),g:parseInt(r[2]),b:parseInt(r[3])}:null}s(parseRgbColor,"parseRgbColor");function isColorDark(e,r=128){if(!e||e==="transparent"||e.startsWith("rgba(0, 0, 0, 0)"))return!1;const n=parseRgbColor(e);return n?.299*n.r+.587*n.g+.114*n.b<r:!1}s(isColorDark,"isColorDark");function isBackgroundDark(){const e=window.getComputedStyle(document.documentElement),r=window.getComputedStyle(document.body),n=e.backgroundColor,o=r.backgroundColor;return isColorDark(o)?!0:o==="transparent"||o.startsWith("rgba(0, 0, 0, 0)")?isColorDark(n):!1}s(isBackgroundDark,"isBackgroundDark");function isPageDark(){return!!(hasDarkModeClass()||isBackgroundDark())}s(isPageDark,"isPageDark");const wrapper="_wrapper_1oy2s_1",styles$2={wrapper},cursor="_cursor_1vrf3_2",cursorBorder="_cursorBorder_1vrf3_13",cursorFilling="_cursorFilling_1vrf3_23",cursorRipple="_cursorRipple_1vrf3_31",clicking="_clicking_1vrf3_37",cursorStyles={cursor,cursorBorder,cursorFilling,cursorRipple,clicking},ut=class ut{constructor(){A(this,Le);Q(this,"wrapper",document.createElement("div"));Q(this,"motion",new Motion({mode:isPageDark()?"dark":"light",styles:{position:"absolute",inset:"0"}}));A(this,K,document.createElement("div"));A(this,ie,0);A(this,ae,0);A(this,je,0);A(this,Ee,0);this.wrapper.id="page-agent-runtime_simulator-mask",this.wrapper.className=styles$2.wrapper,this.wrapper.setAttribute("data-browser-use-ignore","true"),this.wrapper.appendChild(this.motion.element),this.motion.autoResize(this.wrapper),this.wrapper.addEventListener("click",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("mousedown",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("mouseup",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("mousemove",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("wheel",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("keydown",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("keyup",r=>{r.stopPropagation(),r.preventDefault()}),S(this,Le,Jt).call(this),document.body.appendChild(this.wrapper),S(this,Le,jt).call(this),window.addEventListener("PageAgent::MovePointerTo",r=>{const{x:n,y:o}=r.detail;this.setCursorPosition(n,o)}),window.addEventListener("PageAgent::ClickPointer",r=>{this.triggerClickAnimation()})}setCursorPosition(r,n){x(this,je,r),x(this,Ee,n)}triggerClickAnimation(){p(this,K).classList.remove(cursorStyles.clicking),p(this,K).offsetHeight,p(this,K).classList.add(cursorStyles.clicking)}show(){this.motion.start(),this.motion.fadeIn(),this.wrapper.style.display="block",x(this,ie,window.innerWidth/2),x(this,ae,window.innerHeight/2),x(this,je,p(this,ie)),x(this,Ee,p(this,ae)),p(this,K).style.left=`${p(this,ie)}px`,p(this,K).style.top=`${p(this,ae)}px`}hide(){this.motion.fadeOut(),this.motion.pause(),p(this,K).classList.remove(cursorStyles.clicking),setTimeout(()=>{this.wrapper.style.display="none"},800)}dispose(){this.motion.dispose(),this.wrapper.remove()}};K=new WeakMap,ie=new WeakMap,ae=new WeakMap,je=new WeakMap,Ee=new WeakMap,Le=new WeakSet,Jt=s(function(){p(this,K).className=cursorStyles.cursor;const r=document.createElement("div");r.className=cursorStyles.cursorRipple,p(this,K).appendChild(r);const n=document.createElement("div");n.className=cursorStyles.cursorFilling,p(this,K).appendChild(n);const o=document.createElement("div");o.className=cursorStyles.cursorBorder,p(this,K).appendChild(o),this.wrapper.appendChild(p(this,K))},"#createCursor"),jt=s(function(){const r=p(this,ie)+(p(this,je)-p(this,ie))*.2,n=p(this,ae)+(p(this,Ee)-p(this,ae))*.2,o=Math.abs(r-p(this,je));o>0&&(o<2?x(this,ie,p(this,je)):x(this,ie,r),p(this,K).style.left=`${p(this,ie)}px`);const t=Math.abs(n-p(this,Ee));t>0&&(t<2?x(this,ae,p(this,Ee)):x(this,ae,n),p(this,K).style.top=`${p(this,ae)}px`),requestAnimationFrame(()=>S(this,Le,jt).call(this))},"#moveCursorToTarget"),s(ut,"SimulatorMask");let SimulatorMask=ut;const ANSI_BACKGROUND_OFFSET=10,wrapAnsi16=s((e=0)=>r=>`\x1B[${r+e}m`,"wrapAnsi16"),wrapAnsi256=s((e=0)=>r=>`\x1B[${38+e};5;${r}m`,"wrapAnsi256"),wrapAnsi16m=s((e=0)=>(r,n,o)=>`\x1B[${38+e};2;${r};${n};${o}m`,"wrapAnsi16m"),styles$1={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(styles$1.modifier);const foregroundColorNames=Object.keys(styles$1.color),backgroundColorNames=Object.keys(styles$1.bgColor);[...foregroundColorNames,...backgroundColorNames];function assembleStyles(){const e=new Map;for(const[r,n]of Object.entries(styles$1)){for(const[o,t]of Object.entries(n))styles$1[o]={open:`\x1B[${t[0]}m`,close:`\x1B[${t[1]}m`},n[o]=styles$1[o],e.set(t[0],t[1]);Object.defineProperty(styles$1,r,{value:n,enumerable:!1})}return Object.defineProperty(styles$1,"codes",{value:e,enumerable:!1}),styles$1.color.close="\x1B[39m",styles$1.bgColor.close="\x1B[49m",styles$1.color.ansi=wrapAnsi16(),styles$1.color.ansi256=wrapAnsi256(),styles$1.color.ansi16m=wrapAnsi16m(),styles$1.bgColor.ansi=wrapAnsi16(ANSI_BACKGROUND_OFFSET),styles$1.bgColor.ansi256=wrapAnsi256(ANSI_BACKGROUND_OFFSET),styles$1.bgColor.ansi16m=wrapAnsi16m(ANSI_BACKGROUND_OFFSET),Object.defineProperties(styles$1,{rgbToAnsi256:{value(r,n,o){return r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5)},enumerable:!1},hexToRgb:{value(r){const n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(r.toString(16));if(!n)return[0,0,0];let[o]=n;o.length===3&&(o=[...o].map(i=>i+i).join(""));const t=Number.parseInt(o,16);return[t>>16&255,t>>8&255,t&255]},enumerable:!1},hexToAnsi256:{value:s(r=>styles$1.rgbToAnsi256(...styles$1.hexToRgb(r)),"value"),enumerable:!1},ansi256ToAnsi:{value(r){if(r<8)return 30+r;if(r<16)return 90+(r-8);let n,o,t;if(r>=232)n=((r-232)*10+8)/255,o=n,t=n;else{r-=16;const c=r%36;n=Math.floor(r/36)/5,o=Math.floor(c/6)/5,t=c%6/5}const i=Math.max(n,o,t)*2;if(i===0)return 30;let a=30+(Math.round(t)<<2|Math.round(o)<<1|Math.round(n));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:s((r,n,o)=>styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(r,n,o)),"value"),enumerable:!1},hexToAnsi:{value:s(r=>styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(r)),"value"),enumerable:!1}}),styles$1}s(assembleStyles,"assembleStyles");const ansiStyles=assembleStyles(),level=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const e=navigator.userAgentData.brands.find(({brand:r})=>r==="Chromium");if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),colorSupport=level!==0&&{level},supportsColor={stdout:colorSupport,stderr:colorSupport};function stringReplaceAll(e,r,n){let o=e.indexOf(r);if(o===-1)return e;const t=r.length;let i=0,a="";do a+=e.slice(i,o)+r+n,i=o+t,o=e.indexOf(r,i);while(o!==-1);return a+=e.slice(i),a}s(stringReplaceAll,"stringReplaceAll");function stringEncaseCRLFWithFirstIndex(e,r,n,o){let t=0,i="";do{const a=e[o-1]==="\r";i+=e.slice(t,a?o-1:o)+r+(a?`\r
|
|
158
|
+
}`;const COLORS=["rgb(57, 182, 255)","rgb(189, 69, 251)","rgb(255, 87, 51)","rgb(255, 214, 0)"];function parseColor(e){const r=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!r)throw new Error(`Invalid color format: ${e}`);const[,n,o,t]=r;return[parseInt(n)/255,parseInt(o)/255,parseInt(t)/255]}s(parseColor,"parseColor");const ct=class ct{element;canvas;options;running=!1;disposed=!1;startTime=0;lastTime=0;rafId=null;glr;observer;constructor(r={}){this.options={width:r.width??600,height:r.height??600,ratio:r.ratio??window.devicePixelRatio??1,borderWidth:r.borderWidth??8,glowWidth:r.glowWidth??200,borderRadius:r.borderRadius??8,mode:r.mode??"light",...r},this.canvas=document.createElement("canvas"),this.options.classNames&&(this.canvas.className=this.options.classNames),this.options.styles&&Object.assign(this.canvas.style,this.options.styles),this.canvas.style.display="block",this.canvas.style.transformOrigin="center",this.canvas.style.pointerEvents="none",this.element=this.canvas,this.setupGL(),this.options.skipGreeting||this.greet()}start(){if(this.disposed)throw new Error("Motion instance has been disposed.");if(this.running)return;if(!this.glr){console.error("WebGL resources are not initialized.");return}this.running=!0,this.startTime=performance.now(),this.resize(this.options.width??600,this.options.height??600,this.options.ratio),this.glr.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.glr.gl.useProgram(this.glr.program),this.glr.gl.uniform2f(this.glr.uResolution,this.canvas.width,this.canvas.height),this.checkGLError(this.glr.gl,"start: after initial setup");const r=s(()=>{if(!this.running||!this.glr)return;this.rafId=requestAnimationFrame(r);const n=performance.now();if(n-this.lastTime<1e3/32)return;this.lastTime=n;const t=(n-this.startTime)*.001;this.render(t)},"loop");this.rafId=requestAnimationFrame(r)}pause(){if(this.disposed)throw new Error("Motion instance has been disposed.");this.running=!1,this.rafId!==null&&cancelAnimationFrame(this.rafId)}dispose(){if(this.disposed)return;this.disposed=!0,this.running=!1,this.rafId!==null&&cancelAnimationFrame(this.rafId);const{gl:r,vao:n,positionBuffer:o,uvBuffer:t,program:i}=this.glr;n&&r.deleteVertexArray(n),o&&r.deleteBuffer(o),t&&r.deleteBuffer(t),r.deleteProgram(i),this.observer&&this.observer.disconnect(),this.canvas.remove()}resize(r,n,o){if(this.disposed)throw new Error("Motion instance has been disposed.");if(this.options.width=r,this.options.height=n,o&&(this.options.ratio=o),!this.running)return;const{gl:t,program:i,vao:a,positionBuffer:c,uvBuffer:u,uResolution:l}=this.glr,d=o??this.options.ratio??window.devicePixelRatio??1,f=Math.max(1,Math.floor(r*d)),g=Math.max(1,Math.floor(n*d));this.canvas.style.width=`${r}px`,this.canvas.style.height=`${n}px`,(this.canvas.width!==f||this.canvas.height!==g)&&(this.canvas.width=f,this.canvas.height=g),t.viewport(0,0,this.canvas.width,this.canvas.height),this.checkGLError(t,"resize: after viewport setup");const{positions:h,uvs:b}=computeBorderGeometry(this.canvas.width,this.canvas.height,this.options.borderWidth*d,this.options.glowWidth*d);t.bindVertexArray(a),t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,h,t.STATIC_DRAW);const E=t.getAttribLocation(i,"aPosition");t.enableVertexAttribArray(E),t.vertexAttribPointer(E,2,t.FLOAT,!1,0,0),this.checkGLError(t,"resize: after position buffer update"),t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,b,t.STATIC_DRAW);const P=t.getAttribLocation(i,"aUV");t.enableVertexAttribArray(P),t.vertexAttribPointer(P,2,t.FLOAT,!1,0,0),this.checkGLError(t,"resize: after UV buffer update"),t.useProgram(i),t.uniform2f(l,this.canvas.width,this.canvas.height),t.uniform1f(this.glr.uBorderWidth,this.options.borderWidth*d),t.uniform1f(this.glr.uGlowWidth,this.options.glowWidth*d),t.uniform1f(this.glr.uBorderRadius,this.options.borderRadius*d),this.checkGLError(t,"resize: after uniform updates");const U=performance.now();this.lastTime=U;const J=(U-this.startTime)*.001;this.render(J)}autoResize(r){this.observer&&this.observer.disconnect(),this.observer=new ResizeObserver(()=>{const n=r.getBoundingClientRect();this.resize(n.width,n.height)}),this.observer.observe(r)}fadeIn(){if(this.disposed)throw new Error("Motion instance has been disposed.");return new Promise((r,n)=>{const o=this.canvas.animate([{opacity:0,transform:"scale(1.2)"},{opacity:1,transform:"scale(1)"}],{duration:300,easing:"ease-out",fill:"forwards"});o.onfinish=()=>r(),o.oncancel=()=>n("canceled")})}fadeOut(){if(this.disposed)throw new Error("Motion instance has been disposed.");return new Promise((r,n)=>{const o=this.canvas.animate([{opacity:1,transform:"scale(1)"},{opacity:0,transform:"scale(1.2)"}],{duration:300,easing:"ease-in",fill:"forwards"});o.onfinish=()=>r(),o.oncancel=()=>n("canceled")})}checkGLError(r,n){let o=r.getError();if(o!==r.NO_ERROR){for(console.group(`🔴 WebGL Error in ${n}`);o!==r.NO_ERROR;){const t=this.getGLErrorName(r,o);console.error(`${t} (0x${o.toString(16)})`),o=r.getError()}console.groupEnd()}}getGLErrorName(r,n){switch(n){case r.INVALID_ENUM:return"INVALID_ENUM";case r.INVALID_VALUE:return"INVALID_VALUE";case r.INVALID_OPERATION:return"INVALID_OPERATION";case r.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case r.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case r.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"UNKNOWN_ERROR"}}setupGL(){const r=this.canvas.getContext("webgl2",{antialias:!1,alpha:!0});if(!r)throw new Error("WebGL2 is required but not available.");const n=createProgram(r,vertexShaderSource,fragmentShaderSource);this.checkGLError(r,"setupGL: after createProgram");const o=r.createVertexArray();r.bindVertexArray(o),this.checkGLError(r,"setupGL: after VAO creation");const t=this.canvas.width||2,i=this.canvas.height||2,{positions:a,uvs:c}=computeBorderGeometry(t,i,this.options.borderWidth,this.options.glowWidth),u=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,a,r.STATIC_DRAW);const l=r.getAttribLocation(n,"aPosition");r.enableVertexAttribArray(l),r.vertexAttribPointer(l,2,r.FLOAT,!1,0,0),this.checkGLError(r,"setupGL: after position buffer setup");const d=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,d),r.bufferData(r.ARRAY_BUFFER,c,r.STATIC_DRAW);const f=r.getAttribLocation(n,"aUV");r.enableVertexAttribArray(f),r.vertexAttribPointer(f,2,r.FLOAT,!1,0,0),this.checkGLError(r,"setupGL: after UV buffer setup");const g=r.getUniformLocation(n,"uResolution"),h=r.getUniformLocation(n,"uTime"),b=r.getUniformLocation(n,"uBorderWidth"),E=r.getUniformLocation(n,"uGlowWidth"),P=r.getUniformLocation(n,"uBorderRadius"),U=r.getUniformLocation(n,"uColors"),J=r.getUniformLocation(n,"uGlowExponent"),Z=r.getUniformLocation(n,"uGlowFactor");r.useProgram(n),r.uniform1f(b,this.options.borderWidth),r.uniform1f(E,this.options.glowWidth),r.uniform1f(P,this.options.borderRadius),this.options.mode==="dark"?(r.uniform1f(J,2),r.uniform1f(Z,1.8)):(r.uniform1f(J,1),r.uniform1f(Z,1));const I=COLORS.map(parseColor);for(let N=0;N<I.length;N++)r.uniform3f(r.getUniformLocation(n,`uColors[${N}]`),...I[N]);this.checkGLError(r,"setupGL: after uniform setup"),r.bindVertexArray(null),r.bindBuffer(r.ARRAY_BUFFER,null),this.glr={gl:r,program:n,vao:o,positionBuffer:u,uvBuffer:d,uResolution:g,uTime:h,uBorderWidth:b,uGlowWidth:E,uBorderRadius:P,uColors:U}}render(r){if(!this.glr)return;const{gl:n,program:o,vao:t,uTime:i}=this.glr;n.useProgram(o),n.bindVertexArray(t),n.uniform1f(i,r),n.disable(n.DEPTH_TEST),n.disable(n.CULL_FACE),n.disable(n.BLEND),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLES,0,24),this.checkGLError(n,"render: after draw call"),n.bindVertexArray(null)}greet(){console.log("%c🌈 ai-motion 0.4.7 🌈","background: linear-gradient(90deg, #39b6ff, #bd45fb, #ff5733, #ffd600); color: white; text-shadow: 0 0 2px rgba(0, 0, 0, 0.2); font-weight: bold; font-size: 1em; padding: 2px 12px; border-radius: 6px;")}};s(ct,"Motion");let Motion=ct;function hasDarkModeClass(){const e=["dark","dark-mode","theme-dark","night","night-mode"],r=document.documentElement,n=document.body||document.documentElement;for(const t of e)if(r.classList.contains(t)||n?.classList.contains(t))return!0;return!!r.getAttribute("data-theme")?.toLowerCase().includes("dark")}s(hasDarkModeClass,"hasDarkModeClass");function parseRgbColor(e){const r=/rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(e);return r?{r:parseInt(r[1]),g:parseInt(r[2]),b:parseInt(r[3])}:null}s(parseRgbColor,"parseRgbColor");function isColorDark(e,r=128){if(!e||e==="transparent"||e.startsWith("rgba(0, 0, 0, 0)"))return!1;const n=parseRgbColor(e);return n?.299*n.r+.587*n.g+.114*n.b<r:!1}s(isColorDark,"isColorDark");function isBackgroundDark(){const e=window.getComputedStyle(document.documentElement),r=window.getComputedStyle(document.body||document.documentElement),n=e.backgroundColor,o=r.backgroundColor;return isColorDark(o)?!0:o==="transparent"||o.startsWith("rgba(0, 0, 0, 0)")?isColorDark(n):!1}s(isBackgroundDark,"isBackgroundDark");function isPageDark(){try{return!!(hasDarkModeClass()||isBackgroundDark())}catch(e){return console.warn("Error determining if page is dark:",e),!1}}s(isPageDark,"isPageDark");const wrapper="_wrapper_1oy2s_1",styles$2={wrapper},cursor="_cursor_1vrf3_2",cursorBorder="_cursorBorder_1vrf3_13",cursorFilling="_cursorFilling_1vrf3_23",cursorRipple="_cursorRipple_1vrf3_31",clicking="_clicking_1vrf3_37",cursorStyles={cursor,cursorBorder,cursorFilling,cursorRipple,clicking},ut=class ut{constructor(){A(this,Le);Q(this,"wrapper",document.createElement("div"));Q(this,"motion",new Motion({mode:isPageDark()?"dark":"light",styles:{position:"absolute",inset:"0"}}));A(this,K,document.createElement("div"));A(this,ie,0);A(this,ae,0);A(this,je,0);A(this,Ee,0);this.wrapper.id="page-agent-runtime_simulator-mask",this.wrapper.className=styles$2.wrapper,this.wrapper.setAttribute("data-browser-use-ignore","true"),this.wrapper.appendChild(this.motion.element),this.motion.autoResize(this.wrapper),this.wrapper.addEventListener("click",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("mousedown",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("mouseup",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("mousemove",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("wheel",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("keydown",r=>{r.stopPropagation(),r.preventDefault()}),this.wrapper.addEventListener("keyup",r=>{r.stopPropagation(),r.preventDefault()}),S(this,Le,Jt).call(this),document.body.appendChild(this.wrapper),S(this,Le,jt).call(this),window.addEventListener("PageAgent::MovePointerTo",r=>{const{x:n,y:o}=r.detail;this.setCursorPosition(n,o)}),window.addEventListener("PageAgent::ClickPointer",r=>{this.triggerClickAnimation()})}setCursorPosition(r,n){x(this,je,r),x(this,Ee,n)}triggerClickAnimation(){p(this,K).classList.remove(cursorStyles.clicking),p(this,K).offsetHeight,p(this,K).classList.add(cursorStyles.clicking)}show(){this.motion.start(),this.motion.fadeIn(),this.wrapper.style.display="block",x(this,ie,window.innerWidth/2),x(this,ae,window.innerHeight/2),x(this,je,p(this,ie)),x(this,Ee,p(this,ae)),p(this,K).style.left=`${p(this,ie)}px`,p(this,K).style.top=`${p(this,ae)}px`}hide(){this.motion.fadeOut(),this.motion.pause(),p(this,K).classList.remove(cursorStyles.clicking),setTimeout(()=>{this.wrapper.style.display="none"},800)}dispose(){this.motion.dispose(),this.wrapper.remove()}};K=new WeakMap,ie=new WeakMap,ae=new WeakMap,je=new WeakMap,Ee=new WeakMap,Le=new WeakSet,Jt=s(function(){p(this,K).className=cursorStyles.cursor;const r=document.createElement("div");r.className=cursorStyles.cursorRipple,p(this,K).appendChild(r);const n=document.createElement("div");n.className=cursorStyles.cursorFilling,p(this,K).appendChild(n);const o=document.createElement("div");o.className=cursorStyles.cursorBorder,p(this,K).appendChild(o),this.wrapper.appendChild(p(this,K))},"#createCursor"),jt=s(function(){const r=p(this,ie)+(p(this,je)-p(this,ie))*.2,n=p(this,ae)+(p(this,Ee)-p(this,ae))*.2,o=Math.abs(r-p(this,je));o>0&&(o<2?x(this,ie,p(this,je)):x(this,ie,r),p(this,K).style.left=`${p(this,ie)}px`);const t=Math.abs(n-p(this,Ee));t>0&&(t<2?x(this,ae,p(this,Ee)):x(this,ae,n),p(this,K).style.top=`${p(this,ae)}px`),requestAnimationFrame(()=>S(this,Le,jt).call(this))},"#moveCursorToTarget"),s(ut,"SimulatorMask");let SimulatorMask=ut;const ANSI_BACKGROUND_OFFSET=10,wrapAnsi16=s((e=0)=>r=>`\x1B[${r+e}m`,"wrapAnsi16"),wrapAnsi256=s((e=0)=>r=>`\x1B[${38+e};5;${r}m`,"wrapAnsi256"),wrapAnsi16m=s((e=0)=>(r,n,o)=>`\x1B[${38+e};2;${r};${n};${o}m`,"wrapAnsi16m"),styles$1={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(styles$1.modifier);const foregroundColorNames=Object.keys(styles$1.color),backgroundColorNames=Object.keys(styles$1.bgColor);[...foregroundColorNames,...backgroundColorNames];function assembleStyles(){const e=new Map;for(const[r,n]of Object.entries(styles$1)){for(const[o,t]of Object.entries(n))styles$1[o]={open:`\x1B[${t[0]}m`,close:`\x1B[${t[1]}m`},n[o]=styles$1[o],e.set(t[0],t[1]);Object.defineProperty(styles$1,r,{value:n,enumerable:!1})}return Object.defineProperty(styles$1,"codes",{value:e,enumerable:!1}),styles$1.color.close="\x1B[39m",styles$1.bgColor.close="\x1B[49m",styles$1.color.ansi=wrapAnsi16(),styles$1.color.ansi256=wrapAnsi256(),styles$1.color.ansi16m=wrapAnsi16m(),styles$1.bgColor.ansi=wrapAnsi16(ANSI_BACKGROUND_OFFSET),styles$1.bgColor.ansi256=wrapAnsi256(ANSI_BACKGROUND_OFFSET),styles$1.bgColor.ansi16m=wrapAnsi16m(ANSI_BACKGROUND_OFFSET),Object.defineProperties(styles$1,{rgbToAnsi256:{value(r,n,o){return r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5)},enumerable:!1},hexToRgb:{value(r){const n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(r.toString(16));if(!n)return[0,0,0];let[o]=n;o.length===3&&(o=[...o].map(i=>i+i).join(""));const t=Number.parseInt(o,16);return[t>>16&255,t>>8&255,t&255]},enumerable:!1},hexToAnsi256:{value:s(r=>styles$1.rgbToAnsi256(...styles$1.hexToRgb(r)),"value"),enumerable:!1},ansi256ToAnsi:{value(r){if(r<8)return 30+r;if(r<16)return 90+(r-8);let n,o,t;if(r>=232)n=((r-232)*10+8)/255,o=n,t=n;else{r-=16;const c=r%36;n=Math.floor(r/36)/5,o=Math.floor(c/6)/5,t=c%6/5}const i=Math.max(n,o,t)*2;if(i===0)return 30;let a=30+(Math.round(t)<<2|Math.round(o)<<1|Math.round(n));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:s((r,n,o)=>styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(r,n,o)),"value"),enumerable:!1},hexToAnsi:{value:s(r=>styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(r)),"value"),enumerable:!1}}),styles$1}s(assembleStyles,"assembleStyles");const ansiStyles=assembleStyles(),level=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const e=navigator.userAgentData.brands.find(({brand:r})=>r==="Chromium");if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),colorSupport=level!==0&&{level},supportsColor={stdout:colorSupport,stderr:colorSupport};function stringReplaceAll(e,r,n){let o=e.indexOf(r);if(o===-1)return e;const t=r.length;let i=0,a="";do a+=e.slice(i,o)+r+n,i=o+t,o=e.indexOf(r,i);while(o!==-1);return a+=e.slice(i),a}s(stringReplaceAll,"stringReplaceAll");function stringEncaseCRLFWithFirstIndex(e,r,n,o){let t=0,i="";do{const a=e[o-1]==="\r";i+=e.slice(t,a?o-1:o)+r+(a?`\r
|
|
159
159
|
`:`
|
|
160
160
|
`)+n,t=o+1,o=e.indexOf(`
|
|
161
161
|
`,t)}while(o!==-1);return i+=e.slice(t),i}s(stringEncaseCRLFWithFirstIndex,"stringEncaseCRLFWithFirstIndex");const{stdout:stdoutColor,stderr:stderrColor}=supportsColor,GENERATOR=Symbol("GENERATOR"),STYLER=Symbol("STYLER"),IS_EMPTY=Symbol("IS_EMPTY"),levelMapping=["ansi","ansi","ansi256","ansi16m"],styles=Object.create(null),applyOptions=s((e,r={})=>{if(r.level&&!(Number.isInteger(r.level)&&r.level>=0&&r.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const n=stdoutColor?stdoutColor.level:0;e.level=r.level===void 0?n:r.level},"applyOptions"),chalkFactory=s(e=>{const r=s((...n)=>n.join(" "),"chalk");return applyOptions(r,e),Object.setPrototypeOf(r,createChalk.prototype),r},"chalkFactory");function createChalk(e){return chalkFactory(e)}s(createChalk,"createChalk"),Object.setPrototypeOf(createChalk.prototype,Function.prototype);for(const[e,r]of Object.entries(ansiStyles))styles[e]={get(){const n=createBuilder(this,createStyler(r.open,r.close,this[STYLER]),this[IS_EMPTY]);return Object.defineProperty(this,e,{value:n}),n}};styles.visible={get(){const e=createBuilder(this,this[STYLER],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const getModelAnsi=s((e,r,n,...o)=>e==="rgb"?r==="ansi16m"?ansiStyles[n].ansi16m(...o):r==="ansi256"?ansiStyles[n].ansi256(ansiStyles.rgbToAnsi256(...o)):ansiStyles[n].ansi(ansiStyles.rgbToAnsi(...o)):e==="hex"?getModelAnsi("rgb",r,n,...ansiStyles.hexToRgb(...o)):ansiStyles[n][e](...o),"getModelAnsi"),usedModels=["rgb","hex","ansi256"];for(const e of usedModels){styles[e]={get(){const{level:n}=this;return function(...o){const t=createStyler(getModelAnsi(e,levelMapping[n],"color",...o),ansiStyles.color.close,this[STYLER]);return createBuilder(this,t,this[IS_EMPTY])}}};const r="bg"+e[0].toUpperCase()+e.slice(1);styles[r]={get(){const{level:n}=this;return function(...o){const t=createStyler(getModelAnsi(e,levelMapping[n],"bgColor",...o),ansiStyles.bgColor.close,this[STYLER]);return createBuilder(this,t,this[IS_EMPTY])}}}}const proto=Object.defineProperties(()=>{},{...styles,level:{enumerable:!0,get(){return this[GENERATOR].level},set(e){this[GENERATOR].level=e}}}),createStyler=s((e,r,n)=>{let o,t;return n===void 0?(o=e,t=r):(o=n.openAll+e,t=r+n.closeAll),{open:e,close:r,openAll:o,closeAll:t,parent:n}},"createStyler"),createBuilder=s((e,r,n)=>{const o=s((...t)=>applyStyle(o,t.length===1?""+t[0]:t.join(" ")),"builder");return Object.setPrototypeOf(o,proto),o[GENERATOR]=e,o[STYLER]=r,o[IS_EMPTY]=n,o},"createBuilder"),applyStyle=s((e,r)=>{if(e.level<=0||!r)return e[IS_EMPTY]?"":r;let n=e[STYLER];if(n===void 0)return r;const{openAll:o,closeAll:t}=n;if(r.includes("\x1B"))for(;n!==void 0;)r=stringReplaceAll(r,n.close,n.open),n=n.parent;const i=r.indexOf(`
|
|
@@ -376,4 +376,4 @@ Do NOT wait any longer unless you have a good reason.
|
|
|
376
376
|
`,t.pixels_below>4&&i!==-1?c+=`... ${t.pixels_below} pixels below (${t.pages_below.toFixed(1)} pages) - scroll to see more ...
|
|
377
377
|
`:c+=`[End of page]
|
|
378
378
|
`,c+=`</browser_state>
|
|
379
|
-
`,c},"#getBrowserState"),s($t,"PageAgent");let PageAgent=$t;window.pageAgent&&window.pageAgent.dispose(),window.PageAgent=PageAgent,console.log("🚀 page-agent.js loaded!");const DEMO_MODEL="PAGE-AGENT-FREE-TESTING-RANDOM",DEMO_BASE_URL="https://hwcxiuzfylggtcktqgij.supabase.co/functions/v1/llm-testing-proxy",DEMO_API_KEY="PAGE-AGENT-FREE-TESTING-RANDOM"
|
|
379
|
+
`,c},"#getBrowserState"),s($t,"PageAgent");let PageAgent=$t;window.pageAgent&&window.pageAgent.dispose(),window.PageAgent=PageAgent,console.log("🚀 page-agent.js loaded!");const DEMO_MODEL="PAGE-AGENT-FREE-TESTING-RANDOM",DEMO_BASE_URL="https://hwcxiuzfylggtcktqgij.supabase.co/functions/v1/llm-testing-proxy",DEMO_API_KEY="PAGE-AGENT-FREE-TESTING-RANDOM";setTimeout(()=>{const e=document.currentScript;if(e){console.log("🚀 page-agent.js detected current script:",e.src);const r=new URL(e.src),n=r.searchParams.get("model")||DEMO_MODEL,o=r.searchParams.get("baseURL")||DEMO_BASE_URL,t=r.searchParams.get("apiKey")||DEMO_API_KEY,i=r.searchParams.get("lang")||"zh-CN",a={model:n,baseURL:o,apiKey:t,language:i};window.pageAgent=new PageAgent(a)}else console.log("🚀 page-agent.js no current script detected, using default demo config"),window.pageAgent=new PageAgent;console.log("🚀 page-agent.js initialized with config:",window.pageAgent.config),window.pageAgent.panel.show()})}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "page-agent",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.13",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/page-agent.js",
|
|
7
7
|
"module": "./dist/esm/page-agent.js",
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://alibaba.github.io/page-agent/",
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "vite build &&
|
|
40
|
+
"build": "vite build && vite build --config vite.umd.config.js",
|
|
41
41
|
"serve": "npx serve dist/umd -p 5173",
|
|
42
|
-
"dev:umd": "concurrently \"
|
|
42
|
+
"dev:umd": "concurrently \"vite build --config vite.umd.config.js --watch\" \"npm run serve\"",
|
|
43
43
|
"prepublishOnly": "node -e \"const fs=require('fs');['README.md','LICENSE'].forEach(f=>fs.copyFileSync('../../'+f,f))\"",
|
|
44
44
|
"postpublish": "node -e \"['README.md','LICENSE'].forEach(f=>{try{require('fs').unlinkSync(f)}catch{}})\""
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"chalk": "^5.6.2",
|
|
48
48
|
"zod": "^4.2.0",
|
|
49
|
-
"@page-agent/page-controller": "0.0.
|
|
50
|
-
"@page-agent/ui": "0.0.
|
|
49
|
+
"@page-agent/page-controller": "0.0.13",
|
|
50
|
+
"@page-agent/ui": "0.0.13"
|
|
51
51
|
}
|
|
52
52
|
}
|