import type { BaseEvent } from '@lensmcp/protocol-types'; import type { ClientEnvelope } from './types.js'; /** * Translate a single client-runtime envelope into the normalised * `BaseEvent` consumed by the LensMCP event bus. The bridge publishes * these; reducers in `@lensmcp/` materialise them into * `runtime://browser/*` resources. * * ── Substance is the point ────────────────────────────────────────────────── * This mapper decides what a reader of `runtime://browser/errors` can actually * learn. Measured on foodguard (2026-07-30) an entry looked like: * * { id, timestamp, severity: 'error', source: 'client-runtime', * fingerprint: 'runtime:52331dbd', tabId: 'tab-gal0r3bs', * raw: { kind: 'error', at: 1785450203325, tabId: 'tab-gal0r3bs' } } * * — no message, no stack, no URL, no status. The resource could report that * two errors happened and nothing whatsoever about what they were. A signal * that is correct but undiagnosable is only half a signal, so every branch * below now carries identity: a title that names the failure, a bounded * message/stack, and for a request its method, URL and STATUS. * * Every string that reaches `title`/`message` is redacted and bounded first * (`./redact.js`) — enrichment is exactly what creates the leak risk, so the * two land together. See that module for what is and is not scrubbed. */ export declare function envelopeToEvent(env: Exclude, sessionId?: string): BaseEvent | undefined;