Skip to content

feat: add streaming output renderer#81

Open
zgc37359-lang wants to merge 1 commit intoMiniMax-AI:mainfrom
zgc37359-lang:feat/streaming-renderer
Open

feat: add streaming output renderer#81
zgc37359-lang wants to merge 1 commit intoMiniMax-AI:mainfrom
zgc37359-lang:feat/streaming-renderer

Conversation

@zgc37359-lang
Copy link
Copy Markdown

Summary

Add StreamingRenderer class that implements the stable prefix + unstable suffix pattern for incremental command output rendering. This reduces visual flicker during long-running tasks like npm test or pytest.

Changes

  • mini_agent/streaming.py: New module with StreamingRenderer class

    • update(): Processes incremental content, returns stable prefix
    • render(): Returns complete rendered string
    • clear(): Resets renderer state
    • Helper functions: erase_lines(), move_cursor_up(), clear_line()
  • tests/test_streaming.py: 18 test cases covering all functionality

Design

Lines ending with \n are considered "stable" and will not be re-rendered. The last line (without a trailing newline) is considered "unstable" and will be updated on each render. This pattern is borrowed from Claude Code's approach to handling streaming output.

Test plan

  • All 18 tests pass
  • Manual testing with long-running commands

🤖 Generated with Claude Code

Add StreamingRenderer class that implements stable prefix + unstable
suffix pattern for incremental command output rendering. This reduces
visual flicker during long-running tasks like npm test or pytest.

- StreamingRenderer class with update/render/clear methods
- Helper functions for terminal control (erase_lines, move_cursor_up)
- 18 test cases covering all functionality

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zgc37359-lang
Copy link
Copy Markdown
Author

This PR addresses issue #71 - streaming output support for LLM responses. The StreamingRenderer class provides incremental rendering that reduces visual flicker during long-running tasks.

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