feat: adopt streamEvents v2 protocol for enhanced real-time TUI streaming - #56
Merged
Merged
Conversation
…ming Switch agent streaming from streamMode 'values' to streamEvents with v2 protocol for granular event-based streaming. This enables: - Reasoning/thinking content streamed in real-time via on_chat_model_stream events with chunk.reasoning property (e.g., Claude thought blocks) - Explicit tool lifecycle events: on_tool_start, on_tool_end, on_tool_error with input/output context, showing 'Running: tool_name' during execution - Final AI response text streaming as token deltas via on_chat_model_stream events with AIMessageChunk content extraction - Model-level streaming enabled by default (ChatOpenAI streaming: true) Changes: - src/agent/react.js: rewrite callReactAgentStreaming to use streamEvents v2 protocol, emit text/reasoning/tool_start/tool_end/tool_error events - src/provider/openai.js: enable streaming: true on ChatOpenAI instances - src/tui/app.js: handle reasoning, activeToolCall, and text append events - src/tui/conversationPanel.js: render reasoning content and running tool indicators alongside existing toolCallDisplay - src/tui/messages.js: extend Message typedef with new fields - Update all related tests to mock streamEvents instead of stream/AgentStream
avoidwork
force-pushed
the
feat/event-streaming-enhanced-ui
branch
from
May 31, 2026 17:32
6885c0a to
9f68037
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Switches the agent streaming from
streamMode: "values"to thestreamEventsv2 protocol for finer-grained event-based streaming. This enables real-time reasoning/thought display, explicit tool lifecycle signals, and incremental text streaming in the TUI.Type of Change
Testing
npm run test— 776 tests pass, 164 suitesstreamEventsinstead ofstream/AgentStreamprompts.test.js(unrelated — pre-date this change)Coverage
npm run coverage— pre-commit hook passes)Checklist
npm run lintpassesChanges by file
src/agent/react.jscallReactAgentStreamingusesagent.streamEvents({ messages }, { version: "v2" }); emitstext,reasoning,tool_start,tool_end,tool_errorsrc/provider/openai.jsChatOpenAIcreated withstreaming: trueby defaultsrc/tui/app.jsreasoning(thinking content) andactiveToolCall(running tool indicator); usescommittedContentfor final response textsrc/tui/conversationPanel.js(thinking)prefix for reasoning;- Running: tool_name ...for active tool callssrc/tui/messages.jsreasoningContent,activeToolCall,toolCallDisplayfieldsArchitecture:
streamEventsv2 vsstreamMode: "values"streamMode: "values"(old)streamEvents v2(new)on_chat_model_streamwithchunk.reasoningtool_callson_tool_starteventon_tool_endwithdata.outputon_tool_errorwith error messagePR Template Checklist
All sections below filled per section 5.4 (no blanks).
Files Changed (10 files, +543 −277)
src/agent/react.js,src/provider/openai.js,src/tui/app.js,src/tui/conversationPanel.js,src/tui/messages.js,tests/unit/conversationPanel.test.js,tests/unit/provider.test.js,tests/unit/react_agent.test.js,tests/unit/react_agent_checkpoint.test.js,coverage.txt