@lensmcp/client-runtime 1.23.10 → 1.23.11

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/lib/auto.js CHANGED
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var n=(e,t)=>p(e,"name",{value:t,configurable:!0});var m=Object.defineProperty,o=n((e,t)=>m(e,"name",{value:t,configurable:!0}),"n"),f=Object.defineProperty,i=o((e,t)=>f(e,"name",{value:t,configurable:!0}),"o");import{installClientRuntime as _}from"./install.js";const v=5747,g="127.0.0.1";export function resolveLensmcpWsUrl(e){if(e)return e;const t=globalThis,s=t.__LENSMCP_WS_URL__;if(typeof s=="string"&&s.length>0)return s;const a=r("lensmcp-ws");if(a)return a;const c=t.__LENSMCP_WS_PORT__,u=typeof c=="number"||typeof c=="string"?String(c):r("lensmcp-ws-port")??String(v),l=t.__LENSMCP_WS_HOST__;return`ws://${typeof l=="string"&&l.length>0?l:r("lensmcp-ws-host")??(typeof location<"u"&&location.hostname?location.hostname:g)}:${u}`}n(resolveLensmcpWsUrl,"resolveLensmcpWsUrl"),o(resolveLensmcpWsUrl,"resolveLensmcpWsUrl"),i(resolveLensmcpWsUrl,"resolveLensmcpWsUrl");export function installLensmcp(e={}){if(typeof window>"u")return;const t={wsUrl:resolveLensmcpWsUrl(e.wsUrl)};e.reconnectIntervalMs!==void 0&&(t.reconnectIntervalMs=e.reconnectIntervalMs),_(t)}n(installLensmcp,"installLensmcp"),o(installLensmcp,"installLensmcp"),i(installLensmcp,"installLensmcp");function r(e){if(!(typeof document>"u"))try{const t=document.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return t&&t.length>0?t:void 0}catch{return}}n(r,"r"),o(r,"c"),i(r,"readMeta");
1
+ "use strict";var u=Object.defineProperty;var n=(e,t)=>u(e,"name",{value:t,configurable:!0});var f=Object.defineProperty,i=n((e,t)=>f(e,"name",{value:t,configurable:!0}),"o");import{installClientRuntime as p}from"./install.js";const _=5747,m="127.0.0.1";export function resolveLensmcpWsUrl(e){if(e)return e;const t=globalThis,o=t.__LENSMCP_WS_URL__;if(typeof o=="string"&&o.length>0)return o;const l=r("lensmcp-ws");if(l)return l;const s=t.__LENSMCP_WS_PORT__,a=typeof s=="number"||typeof s=="string"?String(s):r("lensmcp-ws-port")??String(_),c=t.__LENSMCP_WS_HOST__;return`ws://${typeof c=="string"&&c.length>0?c:r("lensmcp-ws-host")??(typeof location<"u"&&location.hostname?location.hostname:m)}:${a}`}n(resolveLensmcpWsUrl,"resolveLensmcpWsUrl"),i(resolveLensmcpWsUrl,"resolveLensmcpWsUrl");export function installLensmcp(e={}){if(typeof window>"u")return;const t={wsUrl:resolveLensmcpWsUrl(e.wsUrl)};e.reconnectIntervalMs!==void 0&&(t.reconnectIntervalMs=e.reconnectIntervalMs),p(t)}n(installLensmcp,"installLensmcp"),i(installLensmcp,"installLensmcp");function r(e){if(!(typeof document>"u"))try{const t=document.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return t&&t.length>0?t:void 0}catch{return}}n(r,"c"),i(r,"readMeta");
package/lib/install.js CHANGED
@@ -1 +1 @@
1
- "use strict";var T=Object.defineProperty;var u=(n,o)=>T(n,"name",{value:o,configurable:!0});var J=Object.defineProperty,f=u((n,o)=>J(n,"name",{value:o,configurable:!0}),"u"),M=Object.defineProperty,c=f((n,o)=>M(n,"name",{value:o,configurable:!0}),"l");const _="__LENSMCP_CLIENT__";export function installClientRuntime(n){if(typeof window>"u"||window[_])return;window[_]=!0;const o=n.wsUrl,b=n.reconnectIntervalMs??1e3;let a=null,L=!1;const w=[];let g=[],m=!1;const N=c(()=>{if(m=!1,!g.length)return;const e=g;if(g=[],a&&a.readyState===1)try{let t=0;for(;t<e.length;){const r=[];let d=0;for(;t<e.length&&r.length<200;){let s=JSON.stringify(e[t]);if(s.length>3e5&&(s=JSON.stringify({kind:"console",level:"warn",at:Date.now(),truncated:!0,args:[`[lensmcp] dropped an oversized ${String(e[t]?.kind)} event (${s.length} chars)`]})),r.length&&d+s.length>3e5)break;r.push(s),d+=s.length+1,t+=1}a.send(r.length===1?r[0]:`{"kind":"batch","at":${Date.now()},"events":[${r.join(",")}]}`)}return}catch{}for(const t of e)w.push(t)},"flushBatch"),i=c(e=>{e.at=Date.now(),g.push(e),m||(m=!0,setTimeout(N,0))},"send");window.addEventListener("pagehide",N);const p=c(()=>{try{a=new WebSocket(o)}catch{setTimeout(p,b);return}a.addEventListener("open",()=>{for(L=!0;w.length;){const e=w.splice(0,200);try{a.send(JSON.stringify(e.length===1?e[0]:{kind:"batch",at:Date.now(),events:e}))}catch{}}i({kind:"ready",userAgent:navigator.userAgent,url:location.href})}),a.addEventListener("close",()=>{L&&setTimeout(p,b)}),a.addEventListener("error",()=>{})},"open");p(),window.__LENSMCP_PUBLISH__=e=>{i({kind:"publish",...e})},window.addEventListener("error",e=>{const t=e.target;if(t&&t!==window&&t.tagName&&!e.message){i({kind:"resource-error",tagName:t.tagName.toLowerCase(),url:t.currentSrc||t.src||t.href||void 0});return}const r=e.error;i({kind:"error",message:e.message,name:r?.name,stack:h(r?.stack),source:e.filename,lineno:e.lineno,colno:e.colno})},!0),window.addEventListener("unhandledrejection",e=>{const t=e.reason;i({kind:"unhandledrejection",reason:h(S(t)),name:typeof t=="object"&&t?t.name:void 0,stack:typeof t=="object"&&t?h(t.stack):void 0})});const j=["log","info","warn","error","debug"];for(const e of j){const t=console[e];console[e]=function(...r){try{i({kind:"console",level:e,args:r.map(k)})}catch{}t.apply(console,r)}}const C=window.fetch.bind(window);window.fetch=async function(e,t){const r=t?.method??(typeof e=="object"&&e&&"method"in e?e.method:"GET"),d=typeof e=="string"?e:e instanceof URL?e.toString():e.url,s=Date.now();try{const l=await C(e,t);return i({kind:"fetch",method:r,url:d,status:l.status,statusText:l.statusText,ok:l.ok,durationMs:Date.now()-s}),l}catch(l){const E=l;throw i({kind:"fetch",method:r,url:d,error:E.message??String(E),durationMs:Date.now()-s}),l}};const O=history.pushState.bind(history),D=history.replaceState.bind(history),y=c(e=>i({kind:"route",url:location.href,from:e}),"notify");history.pushState=function(...e){const t=location.href,r=O(...e);return y(t),r},history.replaceState=function(...e){const t=location.href,r=D(...e);return y(t),r},window.addEventListener("popstate",()=>y())}u(installClientRuntime,"installClientRuntime"),f(installClientRuntime,"installClientRuntime"),c(installClientRuntime,"installClientRuntime");const v=4096;function h(n){return n===void 0||n.length<=v?n:`${n.slice(0,v)}\u2026[lensmcp truncated: ${n.length-v} more chars]`}u(h,"h"),f(h,"m"),c(h,"clipStack");function S(n){if(n==null)return String(n);if(typeof n=="string")return n;if(typeof n.message=="string"&&n.message)return n.message;try{const o=JSON.stringify(n);if(o&&o!=="{}"&&o!=="null")return o}catch{}return String(n)}u(S,"N"),f(S,"M"),c(S,"describeReason");function k(n){if(n===null)return null;const o=typeof n;if(o==="string"||o==="number"||o==="boolean")return n;try{return JSON.parse(JSON.stringify(n))}catch{return String(n)}}u(k,"E"),f(k,"C"),c(k,"safe");
1
+ "use strict";var O=Object.defineProperty;var u=(t,o)=>O(t,"name",{value:o,configurable:!0});var T=Object.defineProperty,c=u((t,o)=>T(t,"name",{value:o,configurable:!0}),"l");const L="__LENSMCP_CLIENT__";export function installClientRuntime(t){if(typeof window>"u"||window[L])return;window[L]=!0;const o=t.wsUrl,S=t.reconnectIntervalMs??1e3;let a=null,k=!1;const g=[];let f=[],w=!1;const v=c(()=>{if(w=!1,!f.length)return;const n=f;if(f=[],a&&a.readyState===1)try{let e=0;for(;e<n.length;){const r=[];let d=0;for(;e<n.length&&r.length<200;){let i=JSON.stringify(n[e]);if(i.length>3e5&&(i=JSON.stringify({kind:"console",level:"warn",at:Date.now(),truncated:!0,args:[`[lensmcp] dropped an oversized ${String(n[e]?.kind)} event (${i.length} chars)`]})),r.length&&d+i.length>3e5)break;r.push(i),d+=i.length+1,e+=1}a.send(r.length===1?r[0]:`{"kind":"batch","at":${Date.now()},"events":[${r.join(",")}]}`)}return}catch{}for(const e of n)g.push(e)},"flushBatch"),s=c(n=>{n.at=Date.now(),f.push(n),w||(w=!0,setTimeout(v,0))},"send");window.addEventListener("pagehide",v);const p=c(()=>{try{a=new WebSocket(o)}catch{setTimeout(p,S);return}a.addEventListener("open",()=>{for(k=!0;g.length;){const n=g.splice(0,200);try{a.send(JSON.stringify(n.length===1?n[0]:{kind:"batch",at:Date.now(),events:n}))}catch{}}s({kind:"ready",userAgent:navigator.userAgent,url:location.href})}),a.addEventListener("close",()=>{k&&setTimeout(p,S)}),a.addEventListener("error",()=>{})},"open");p(),window.__LENSMCP_PUBLISH__=n=>{s({kind:"publish",...n})},window.addEventListener("error",n=>{const e=n.target;if(e&&e!==window&&e.tagName&&!n.message){s({kind:"resource-error",tagName:e.tagName.toLowerCase(),url:e.currentSrc||e.src||e.href||void 0});return}const r=n.error;s({kind:"error",message:n.message,name:r?.name,stack:h(r?.stack),source:n.filename,lineno:n.lineno,colno:n.colno})},!0),window.addEventListener("unhandledrejection",n=>{const e=n.reason;s({kind:"unhandledrejection",reason:h(N(e)),name:typeof e=="object"&&e?e.name:void 0,stack:typeof e=="object"&&e?h(e.stack):void 0})});const _=["log","info","warn","error","debug"];for(const n of _){const e=console[n];console[n]=function(...r){try{s({kind:"console",level:n,args:r.map(E)})}catch{}e.apply(console,r)}}const j=window.fetch.bind(window);window.fetch=async function(n,e){const r=e?.method??(typeof n=="object"&&n&&"method"in n?n.method:"GET"),d=typeof n=="string"?n:n instanceof URL?n.toString():n.url,i=Date.now();try{const l=await j(n,e);return s({kind:"fetch",method:r,url:d,status:l.status,statusText:l.statusText,ok:l.ok,durationMs:Date.now()-i}),l}catch(l){const b=l;throw s({kind:"fetch",method:r,url:d,error:b.message??String(b),durationMs:Date.now()-i}),l}};const C=history.pushState.bind(history),D=history.replaceState.bind(history),m=c(n=>s({kind:"route",url:location.href,from:n}),"notify");history.pushState=function(...n){const e=location.href,r=C(...n);return m(e),r},history.replaceState=function(...n){const e=location.href,r=D(...n);return m(e),r},window.addEventListener("popstate",()=>m())}u(installClientRuntime,"installClientRuntime"),c(installClientRuntime,"installClientRuntime");const y=4096;function h(t){return t===void 0||t.length<=y?t:`${t.slice(0,y)}\u2026[lensmcp truncated: ${t.length-y} more chars]`}u(h,"m"),c(h,"clipStack");function N(t){if(t==null)return String(t);if(typeof t=="string")return t;if(typeof t.message=="string"&&t.message)return t.message;try{const o=JSON.stringify(t);if(o&&o!=="{}"&&o!=="null")return o}catch{}return String(t)}u(N,"M"),c(N,"describeReason");function E(t){if(t===null)return null;const o=typeof t;if(o==="string"||o==="number"||o==="boolean")return t;try{return JSON.parse(JSON.stringify(t))}catch{return String(t)}}u(E,"C"),c(E,"safe");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/client-runtime",
3
- "version": "1.23.10",
3
+ "version": "1.23.11",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",