/**
* The wire format spoken between the injected `@lensmcp/client-runtime`
* and the bridge's WebSocket. Kept intentionally narrow — the client
* runtime *only* emits these envelopes, never anything else.
*
* This type was originally owned by `@lensmcp/vite-plugin`; it moved here
* when the bridge was decoupled from Vite so every host (webpack, Next.js,
* no-build) shares one definition. The Vite plugin re-exports it for
* backwards compatibility.
*/
export type ClientEnvelope = (
/**
* An uncaught JS error (`window.onerror`). `message` is OPTIONAL because it
* genuinely can be absent: a synthesised or cross-origin `ErrorEvent`
* carries none, and 3 of the 7 real browser errors captured on foodguard
* (2026-07-30) had no message at all. `name` is the constructor name of the
* thrown value, which survives when a cross-origin policy strips the rest.
*/
{
kind: 'error';
at: number;
message?: string;
name?: string;
stack?: string;
source?: string;
lineno?: number;
colno?: number;
}
/**
* A SUBRESOURCE that failed to load — `
`, `