Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

PostMessageTransport: make debug logging opt-in (or accept a logger)

Abierto Apto para principiantes
#786 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
70/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript

Línea de trabajo

El issue apunta a src/message-transport.ts, específicamente a las líneas donde se llama a console.debug. Comience examinando el constructor de PostMessageTransport y su firma actual. La tarea consiste en agregar un tercer argumento opcional para un logger, que por defecto no registre nada. Verifique cómo se instancia el transporte en otras partes del código base para garantizar la compatibilidad con versiones anteriores. Escriba una prueba para verificar que el registro solo ocurra cuando se proporciona un logger.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

  • #237 / #239 moved the unknown-source log from console.error to console.debug.
  • #546 skipped the log for tool-input-partial because it flooded the console.
  • #741 asked for opt-in logging or a configurable logger, and noted that full payloads, including tool-result _meta, reach the console. Its filer closed it without a change.

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.

Lenguaje dominante
TypeScript
Estrellas
2.9k
Forks
387
Merge medio
2 h 54 min
PR fusionados (30 d)
7

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de modelcontextprotocol/ext-apps

Todos los issues de modelcontextprotocol/ext-apps

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.