Skip to content

feat: smooth streaming mode for TUI response rendering #280

Description

@anandgupta42

The TUI response rendering feels sluggish compared to Claude Code. Text appears in visible jumps and scrolling is jerky during LLM streaming.

Root cause: The <markdown> element re-lays out block elements (headers, code blocks, lists) on every token delta, causing layout height shifts that make stickyScroll jump.

Solution: Add ALTIMATE_SMOOTH_STREAMING feature flag that:

  1. Uses <code filetype="markdown"> during streaming (syntax colors without layout-shifting block elements), swaps to <markdown> after completion
  2. Pre-merges consecutive delta events in the SDK batch window
  3. Uses direct store path updates instead of produce() proxy
  4. Reduces scroll-to-bottom latency from 50ms to 0ms
  5. Memoizes trim() in TextPart to avoid redundant string scans

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions