mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-10-18 14:07:31 +02:00
Moves `on_stream_event` off the v1 `StreamMessagesHandler` base and onto the v2 subclass. Content-block events are a v2-only concept, so forwarding them only when the v2 handler is attached keeps the messages channel's shape predictable for v1 callers: plain `graph.stream(stream_mode="messages")` now ignores `on_stream_event` entirely, even if a node explicitly calls `model.stream_v2()` on a v1-flagged run. Dedupe of the returned AIMessage still works in that case via `_find_and_emit_messages` / `on_chain_end`. Also makes the v2 handler's `on_llm_new_token` override an explicit pass-through with a comment rather than `return None`, so it reads as an intentional no-op instead of a missing return value.