@mindstudio-ai/browser-agent 0.1.15 → 0.1.17

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/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -40,7 +40,7 @@ ${h}
40
40
  white-space: nowrap;
41
41
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
42
42
  ">Remy</div>
43
- `,e.style.cssText=["position: fixed","z-index: 2147483647","pointer-events: none","opacity: 0","transition: opacity 300ms ease, left 600ms cubic-bezier(0.4, 0, 0, 1), top 600ms cubic-bezier(0.4, 0, 0, 1)","will-change: left, top, opacity"].join("; ");let t=document.createElement("div");t.id=so,t.style.cssText=["position: fixed","top: 0","left: 0","width: 100vw","height: 100vh","background: white","opacity: 0","z-index: 2147483646","pointer-events: none","transition: opacity 600ms ease-out"].join("; "),document.documentElement.appendChild(t),document.documentElement.appendChild(e),re=e,be=t}function Es(e,t){re&&(re.style.left=`${e}px`,re.style.top=`${t}px`,re.style.opacity="1")}function io(e,t){re&&(re.style.left=`${e}px`,re.style.top=`${t}px`)}async function Cs(){be&&(be.style.transition="none",be.style.opacity="0.7",be.offsetWidth,be.style.transition="opacity 600ms ease-out",be.style.opacity="0",await B(600))}function ks(){re&&(re.style.opacity="0")}function Ms(){document.getElementById(yn)?.remove(),document.getElementById(so)?.remove(),re=null,be=null}function ao(e,t){return new Promise(n=>{let r=window.scrollY,i=e-r;if(Math.abs(i)<1){n();return}let o=Math.abs(i),c=Math.max(t,o/2),l=performance.now();function s(u){let d=u-l,f=Math.min(d/c,1),p=f<.5?4*f*f*f:1-Math.pow(-2*f+2,3)/2;window.scrollTo(0,r+i*p),f<1?requestAnimationFrame(s):n()}requestAnimationFrame(s)})}async function At(e){await oo();let t=window.innerWidth,n=window.innerHeight;if(e?.viewportOnly)return As(t,n);let r=window.scrollX,i=window.scrollY,o=document.documentElement.style.scrollBehavior;document.documentElement.style.scrollBehavior="auto",Ss();let a=Math.random()<.5?t+30:-60,c=n*.3+Math.random()*n*.4;Es(a,c),await B(200);let l=t*.4+Math.random()*t*.15,s=n*.35+Math.random()*n*.15;io(l,s),await B(700);let u=[],d=0,f=()=>Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);for(;d<f();){let b=f()-n,w=Math.min(d,b);await ao(w,ws),io(l,s),await B(ys);let E=f(),S=window.scrollY,v=Math.min(n,E-S);await Cs();try{let T=await(await _(document.body,{embedFonts:!0,exclude:lo,excludeMode:"remove"})).toCanvas({width:t});if(T){let W=T.height/E,I=Math.round(S*W),$=Math.round(v*W),A=T.width,H=document.createElement("canvas");H.width=A,H.height=$;let V=H.getContext("2d");V&&(V.drawImage(T,0,I,A,$,0,0,A,$),u.push({y:S,canvas:H}))}}catch{}d+=n}if(ks(),await ao(i,bs),document.documentElement.style.scrollBehavior=o,await B(200),Ms(),u.length===0)throw new Error("Screenshot capture produced no image data");let p=f(),g=u[0].canvas.width/t,h=document.createElement("canvas");h.width=u[0].canvas.width,h.height=Math.round(p*g);let m=h.getContext("2d");if(!m)throw new Error("Failed to create output canvas");for(let b of u)m.drawImage(b.canvas,0,Math.round(b.y*g));let x=h.toDataURL("image/png").replace(/^data:image\/png;base64,/,"");if(!x)throw new Error("Canvas export produced no image data");return{image:x,width:h.width,height:h.height}}async function As(e,t){let r=await(await _(document.body,{embedFonts:!0,exclude:lo,excludeMode:"remove"})).toCanvas({width:e,scale:ke});if(!r)throw new Error("SnapDOM viewport capture returned empty result");let i=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),o=document.createElement("canvas");o.width=e*ke,o.height=t*ke;let a=o.getContext("2d");if(!a)throw new Error("Failed to create canvas context");let c=window.scrollY/i*r.height,l=t/i*r.height;a.drawImage(r,0,c,r.width,l,0,0,e*ke,t*ke);let u=o.toDataURL("image/png").replace(/^data:image\/png;base64,/,"");if(!u)throw new Error("Canvas export produced no image data");return{image:u,width:e*ke,height:t*ke}}var wn=!1;function co(){wn=new URLSearchParams(window.location.search).get("display-mode")==="pip",window.addEventListener("message",t=>{!t.data||typeof t.data.command!="string"||(t.data.command==="display-mode-pip"?wn=!0:t.data.command==="display-mode-full"&&(wn=!1))})}var uo="__mindstudio-cursor",$s="__mindstudio-cursor-ripple",fo=.07,Ls=250,Tt=300,Ts=2e3,$t=10,mo=1,Nt="#DD2590",Ns=`<svg width="40" height="41" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
43
+ `,e.style.cssText=["position: fixed","z-index: 2147483647","pointer-events: none","opacity: 0","transition: opacity 300ms ease, left 600ms cubic-bezier(0.4, 0, 0, 1), top 600ms cubic-bezier(0.4, 0, 0, 1)","will-change: left, top, opacity"].join("; ");let t=document.createElement("div");t.id=so,t.style.cssText=["position: fixed","top: 0","left: 0","width: 100vw","height: 100vh","background: white","opacity: 0","z-index: 2147483646","pointer-events: none","transition: opacity 600ms ease-out"].join("; "),document.documentElement.appendChild(t),document.documentElement.appendChild(e),re=e,be=t}function Es(e,t){re&&(re.style.left=`${e}px`,re.style.top=`${t}px`,re.style.opacity="1")}function io(e,t){re&&(re.style.left=`${e}px`,re.style.top=`${t}px`)}async function Cs(){be&&(be.style.transition="none",be.style.opacity="0.7",be.offsetWidth,be.style.transition="opacity 600ms ease-out",be.style.opacity="0",await B(600))}function ks(){re&&(re.style.opacity="0")}function Ms(){document.getElementById(yn)?.remove(),document.getElementById(so)?.remove(),re=null,be=null}function ao(e,t){return new Promise(n=>{let r=window.scrollY,i=e-r;if(Math.abs(i)<1){n();return}let o=Math.abs(i),c=Math.max(t,o/2),l=performance.now();function s(u){let d=u-l,f=Math.min(d/c,1),p=f<.5?4*f*f*f:1-Math.pow(-2*f+2,3)/2;window.scrollTo(0,r+i*p),f<1?requestAnimationFrame(s):n()}requestAnimationFrame(s)})}async function At(e){await oo();let t=window.innerWidth,n=window.innerHeight;if(e?.viewportOnly)return As(t,n);let r=window.scrollX,i=window.scrollY,o=document.documentElement.style.scrollBehavior;document.documentElement.style.scrollBehavior="auto",Ss();let a=Math.random()<.5?t+30:-60,c=n*.3+Math.random()*n*.4;Es(a,c),await B(200);let l=t*.4+Math.random()*t*.15,s=n*.35+Math.random()*n*.15;io(l,s),await B(700);let u=[],d=0,f=()=>Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);for(;d<f();){let b=f()-n,w=Math.min(d,b);await ao(w,ws),io(l,s),await B(ys);let E=f(),S=window.scrollY,v=Math.min(n,E-S);await Cs();try{let T=await(await _(document.body,{embedFonts:!0,exclude:lo,excludeMode:"remove"})).toCanvas({width:t});if(T){let W=T.height/E,I=Math.round(S*W),$=Math.round(v*W),A=T.width,H=document.createElement("canvas");H.width=A,H.height=$;let V=H.getContext("2d");V&&(V.drawImage(T,0,I,A,$,0,0,A,$),u.push({y:S,canvas:H}))}}catch{}d+=n}if(ks(),await ao(i,bs),document.documentElement.style.scrollBehavior=o,await B(200),Ms(),u.length===0)throw new Error("Screenshot capture produced no image data");let p=f(),g=u[0].canvas.width/t,h=document.createElement("canvas");h.width=u[0].canvas.width,h.height=Math.round(p*g);let m=h.getContext("2d");if(!m)throw new Error("Failed to create output canvas");for(let b of u)m.drawImage(b.canvas,0,Math.round(b.y*g));let x=h.toDataURL("image/jpeg",.85).replace(/^data:image\/jpeg;base64,/,"");if(!x)throw new Error("Canvas export produced no image data");return{image:x,width:h.width,height:h.height}}async function As(e,t){let r=await(await _(document.body,{embedFonts:!0,exclude:lo,excludeMode:"remove"})).toCanvas({width:e,scale:ke});if(!r)throw new Error("SnapDOM viewport capture returned empty result");let i=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),o=document.createElement("canvas");o.width=e*ke,o.height=t*ke;let a=o.getContext("2d");if(!a)throw new Error("Failed to create canvas context");let c=window.scrollY/i*r.height,l=t/i*r.height;a.drawImage(r,0,c,r.width,l,0,0,e*ke,t*ke);let u=o.toDataURL("image/jpeg",.85).replace(/^data:image\/jpeg;base64,/,"");if(!u)throw new Error("Canvas export produced no image data");return{image:u,width:e*ke,height:t*ke}}var wn=!1;function co(){wn=new URLSearchParams(window.location.search).get("display-mode")==="pip",window.addEventListener("message",t=>{!t.data||typeof t.data.command!="string"||(t.data.command==="display-mode-pip"?wn=!0:t.data.command==="display-mode-full"&&(wn=!1))})}var uo="__mindstudio-cursor",$s="__mindstudio-cursor-ripple",fo=.07,Ls=250,Tt=300,Ts=2e3,$t=10,mo=1,Nt="#DD2590",Ns=`<svg width="40" height="41" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
44
44
  <g filter="url(#filter0_d_4_78)">
45
45
  <path d="M12.5448 26L6.72762 5.59339L26 14.8132L17.1816 17.9377L12.5448 26Z" fill="${Nt}"/>
46
46
  <path d="M6.9457 5.14539L26.2178 14.3651L27.2985 14.8826L26.1697 15.2813L17.5259 18.3444L12.9812 26.2464L12.3881 27.2792L12.0614 26.1349L6.24434 5.72851L5.94119 4.66488L6.9457 5.14539Z" stroke="${Nt}"/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/browser-agent",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Browser-side agent for MindStudio dev previews — captures logs, provides DOM snapshots, and enables remote interaction.",
5
5
  "main": "dist/index.js",
6
6
  "files": [