PostMessageTransport: make debug logging opt-in (or accept a logger)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 70/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- developer-experience, tooling
Direzione di ricerca
L'issue punta a src/message-transport.ts, in particolare alle righe in cui viene chiamato console.debug. Inizia esaminando il costruttore PostMessageTransport e la sua firma attuale. Il compito consiste nell'aggiungere un terzo argomento opzionale per un logger, che per impostazione predefinita non effettua alcuna registrazione. Controlla come il trasporto viene istanziato altrove nella codebase per garantire la compatibilità con le versioni precedenti. Scrivi un test per verificare che la registrazione avvenga solo quando viene fornito un logger.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.errortoconsole.debug. - #546 skipped the log for
tool-input-partialbecause 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.
- Lingua principale
- TypeScript
- Stelle
- 2.9k
- Fork
- 387
- Merge medio
- 2h 54m
- PR unite (30g)
- 7
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelcontextprotocol/ext-apps
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
modelcontextprotocol/ext-apps#767 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
modelcontextprotocol/ext-apps#742 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
modelcontextprotocol/ext-apps#711 ·
-
Spec: Deprecate Sampling Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
modelcontextprotocol/ext-apps#706 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
modelcontextprotocol/ext-apps#703 · 1 reazione ·
Tutte le issue di modelcontextprotocol/ext-apps
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mksglu/context-mode#1200 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anthropics/claude-code#96687 ·
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
AOSSIE-Org/DebateAI#582 · 2 commenti ·