Problem
PostMessageTransport calls console.debug unconditionally (src/message-transport.ts at 264d9ca, lines 77, 82, 87 and 128):
- "Sending message" for every outgoing message except
tool-input-partial
- "Parsed message" for every valid incoming message
- "Ignoring message from unknown source" for every message from another frame
A host cannot turn these off. The transport takes no option for it, and the only workaround is wrapping console.debug globally.
The noise grows with the number of Apps on a page. Each card's host transport listens on the same window, so a message from any View reaches every bridge. The owning bridge logs "Parsed message", and each of the other N−1 bridges logs "Ignoring message from unknown source" with the full MessageEvent. With four cards in a conversation, every View message produces four host lines, plus the View's own "Sending message" inside its frame. Size changes and host-context updates fan out the same way.
The source check is correct. Only the logging is the problem.
Prior discussion
Proposal
Make transport logging opt-in through an options argument:
new PostMessageTransport(eventTarget, eventSource, { logger?: Pick<Console, "debug"> })
Log nothing when logger is absent. The console.error for a malformed JSON-RPC message can stay. The third argument keeps the existing constructor compatible.
Happy to open a PR if this direction works.
Seen on 1.7.5; unchanged on main as of v2.0.0.
Problem
PostMessageTransportcallsconsole.debugunconditionally (src/message-transport.tsat 264d9ca, lines 77, 82, 87 and 128):tool-input-partialA host cannot turn these off. The transport takes no option for it, and the only workaround is wrapping
console.debugglobally.The noise grows with the number of Apps on a page. Each card's host transport listens on the same
window, so a message from any View reaches every bridge. The owning bridge logs "Parsed message", and each of the other N−1 bridges logs "Ignoring message from unknown source" with the fullMessageEvent. With four cards in a conversation, every View message produces four host lines, plus the View's own "Sending message" inside its frame. Size changes and host-context updates fan out the same way.The source check is correct. Only the logging is the problem.
Prior discussion
console.errorfor expected unknown sources during development #237 / fix: change unknown source message log from error to debug level #239 moved the unknown-source log fromconsole.errortoconsole.debug.tool-input-partialbecause it flooded the console._meta, reach the console. Its filer closed it without a change.Proposal
Make transport logging opt-in through an options argument:
Log nothing when
loggeris absent. Theconsole.errorfor a malformed JSON-RPC message can stay. The third argument keeps the existing constructor compatible.Happy to open a PR if this direction works.
Seen on 1.7.5; unchanged on main as of v2.0.0.