Skip to content

refactor(tui): consolidate streaming handlers in app.js#504

Merged
avoidwork merged 1 commit into
mainfrom
feat/simplify-tui-streaming-handlers
Jul 2, 2026
Merged

refactor(tui): consolidate streaming handlers in app.js#504
avoidwork merged 1 commit into
mainfrom
feat/simplify-tui-streaming-handlers

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

Extract createStreamingHandler and finalizeStreaming helpers in src/tui/app.js to eliminate ~80 lines of duplicated callback logic across handleCommand and handleChat (initial + auto-continue paths).

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • Performance improvement
  • CI / build / tooling

Testing

All 1082 tests pass. The refactoring is purely structural — two helper functions replace four duplicated inline callbacks and two duplicated finalization blocks.

Coverage

  • Line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with maintained line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Extract createStreamingHandler and finalizeStreaming helpers to
eliminate ~80 lines of duplicated callback logic across handleCommand
and handleChat (initial + auto-continue paths).

- createStreamingHandler(committedContentRef, onTextReceived?) — single
  handler for all dispatchProvider streaming callbacks
- finalizeStreaming(responseContent, committedReasoning, lastToolCallDisplay,
  todoStatusLines) — single function for finalizing the last message

Changed committedContent to committedContentRef so the handler can
mutate it across multiple invocations.
@avoidwork avoidwork merged commit 6a89549 into main Jul 2, 2026
3 checks passed
@avoidwork avoidwork deleted the feat/simplify-tui-streaming-handlers branch July 2, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant