@mindstudio-ai/browser-agent 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- 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
|
-
`,t.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 n=document.createElement("div");n.id=_r,n.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(n),document.documentElement.appendChild(t),e.cameraEl=t,e.flashEl=n}function Yl(e,t){let{cameraEl:n}=k().screenshot;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`,n.style.opacity="1")}function Tr(e,t){let{cameraEl:n}=k().screenshot;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`)}async function Xl(){let{flashEl:e}=k().screenshot;e&&(e.style.transition="none",e.style.opacity="0.7",e.offsetWidth,e.style.transition="opacity 600ms ease-out",e.style.opacity="0",await W(600))}function Gl(){let{cameraEl:e}=k().screenshot;e&&(e.style.opacity="0")}function Kl(){let e=k().screenshot;document.getElementById(Xt)?.remove(),document.getElementById(_r)?.remove(),e.cameraEl=null,e.flashEl=null}function Jl(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 Ie(e){await Nr();let t=window.innerWidth,n=window.innerHeight;if(e?.viewportOnly)return Zl(t,n);let r=window.scrollY,i=document.documentElement.style.scrollBehavior;document.documentElement.style.scrollBehavior="auto",Vl();try{let o=Math.random()<.5?t+30:-60,a=n*.3+Math.random()*n*.4;Yl(o,a),await W(200);let c=t*.4+Math.random()*t*.15,l=n*.35+Math.random()*n*.15;Tr(c,l),await W(700);let s=[],u=0,d=()=>Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);for(;u<d();){let x=d()-n,b=Math.min(u,x);Math.abs(b-window.scrollY)>1&&(await Jl(b,ql),Tr(c,l),await W(Ul));let E=d(),S=window.scrollY,v=Math.min(n,E-S);await Xl();try{let
|
|
43
|
+
`,t.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 n=document.createElement("div");n.id=_r,n.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(n),document.documentElement.appendChild(t),e.cameraEl=t,e.flashEl=n}function Yl(e,t){let{cameraEl:n}=k().screenshot;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`,n.style.opacity="1")}function Tr(e,t){let{cameraEl:n}=k().screenshot;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`)}async function Xl(){let{flashEl:e}=k().screenshot;e&&(e.style.transition="none",e.style.opacity="0.7",e.offsetWidth,e.style.transition="opacity 600ms ease-out",e.style.opacity="0",await W(600))}function Gl(){let{cameraEl:e}=k().screenshot;e&&(e.style.opacity="0")}function Kl(){let e=k().screenshot;document.getElementById(Xt)?.remove(),document.getElementById(_r)?.remove(),e.cameraEl=null,e.flashEl=null}function Jl(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 Ie(e){await Nr();let t=window.innerWidth,n=window.innerHeight;if(e?.viewportOnly)return Zl(t,n);let r=window.scrollY,i=document.documentElement.style.scrollBehavior;document.documentElement.style.scrollBehavior="auto",Vl();try{let o=Math.random()<.5?t+30:-60,a=n*.3+Math.random()*n*.4;Yl(o,a),await W(200);let c=t*.4+Math.random()*t*.15,l=n*.35+Math.random()*n*.15;Tr(c,l),await W(700);let s=[],u=0,d=()=>Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);for(;u<d();){let x=d()-n,b=Math.min(u,x);Math.abs(b-window.scrollY)>1&&(await Jl(b,ql),Tr(c,l),await W(Ul));let E=d(),S=window.scrollY,v=Math.min(n,E-S);await Xl();try{let M=await R(document.body,{embedFonts:!0,exclude:Rr,excludeMode:"remove"});Math.abs(window.scrollY-b)>2&&window.scrollTo(0,b);let N=await M.toCanvas({width:t});if(N){let O=N.height/E,F=Math.round(S*O),L=Math.round(v*O),$=N.width,D=document.createElement("canvas");D.width=$,D.height=L;let B=D.getContext("2d");B&&(B.drawImage(N,0,F,$,L,0,0,$,L),s.push({y:S,canvas:D}))}}catch{}u+=n}if(s.length===0)throw new Error("Screenshot capture produced no image data");let f=d(),p=s[0].canvas.width/t,g=document.createElement("canvas");g.width=s[0].canvas.width,g.height=Math.round(f*p);let h=g.getContext("2d");if(!h)throw new Error("Failed to create output canvas");for(let x of s)h.drawImage(x.canvas,0,Math.round(x.y*p));let y=g.toDataURL("image/jpeg",.85).replace(/^data:image\/jpeg;base64,/,"");if(!y)throw new Error("Canvas export produced no image data");return{image:y,width:g.width,height:g.height}}finally{Gl(),Kl(),document.documentElement.style.scrollBehavior="auto",window.scrollTo(0,r),document.documentElement.style.scrollBehavior=i}}async function Zl(e,t){let r=await(await R(document.body,{embedFonts:!0,exclude:Rr,excludeMode:"remove"})).toCanvas({width:e,scale:me});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*me,o.height=t*me;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*me,t*me);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*me,height:t*me}}function Pr(){let e=k().zoom,t=new URLSearchParams(window.location.search);e.pipMode=t.get("display-mode")==="pip",window.addEventListener("message",n=>{!n.data||typeof n.data.command!="string"||(n.data.command==="display-mode-pip"?e.pipMode=!0:n.data.command==="display-mode-full"&&(e.pipMode=!1))})}var Fr="__mindstudio-cursor",Ql="__mindstudio-cursor-ripple",Dr=.07,es=250,lt=300,ts=2e3,at=10,Ir=1,st="#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="${st}"/>
|
|
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="${st}"/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindstudio-ai/browser-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
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": [
|