feat(ui): plumb reasoning stream + output-token count to the UI seam#5
Merged
Conversation
Add an on_thinking callback through OllamaClient.chat/_stream_chat and the LLMClient/RuntimeUI protocols, mirroring the existing on_token path, and parse Ollama's eval_count into Message.output_tokens. The runtime accumulates output tokens per turn and surfaces the total in TurnStats. The current TerminalUI consumes the new hook as a no-op, so a default session stays byte-identical; a later full-screen UI renders the live reasoning readout.
lavindeep
added a commit
that referenced
this pull request
Jul 2, 2026
feat(ui): plumb reasoning stream + output-token count to the UI seam
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.
Branch 1 of the UI v2 rework — thinking-stream plumbing, no visible change.
Threads the model's reasoning stream and output-token count to the UI seam so later branches can render a live reasoning readout. UI-agnostic; a default session is byte-identical.
on_thinkingcallback throughOllamaClient.chat/_stream_chat+ theLLMClient/RuntimeUIprotocols, mirroring the existingon_tokenpath.eval_count→Message.output_tokens(defensive: absent / non-int → 0).TurnStats.output_tokens.TerminalUI.stream_thinkingis a no-op → default session byte-identical.Phase gate green: ruff, ruff format, mypy --strict, 1262 tests (+7 red-first).