Skip to main content

Crate flywheel

Crate flywheel 

Source
Expand description

§Flywheel

A zero-flicker terminal compositor for Agentic CLIs.

Flywheel is a purpose-built TUI engine designed for high-frequency token streaming (100+ tokens/s) without flickering, blocking, or latency.

§Core Concepts

  • Double-buffered rendering: Current and Next buffers with minimal diff
  • Dirty rectangles: Only re-render changed regions
  • Actor model: Isolated threads for input, rendering, and agent logic
  • Optimistic append: Fast path for streaming text that bypasses diffing

§Example

use flywheel::{Buffer, Cell, Rect};

// Create a buffer for a 80x24 terminal
let mut buffer = Buffer::new(80, 24);

// Write a cell
buffer.set(0, 0, Cell::new('H'));

Re-exports§

pub use buffer::Buffer;
pub use buffer::Cell;
pub use buffer::CellFlags;
pub use buffer::Modifiers;
pub use buffer::Rgb;
pub use buffer::RopeBuffer;
pub use buffer::ChunkedLine;
pub use buffer::RopeMemoryStats;
pub use layout::Layout;
pub use layout::Rect;
pub use layout::Region;
pub use layout::RegionId;
pub use actor::Engine;
pub use actor::EngineConfig;
pub use actor::InputEvent;
pub use actor::KeyCode;
pub use actor::KeyModifiers;
pub use actor::RenderCommand;
pub use actor::AgentEvent;
pub use actor::TickerActor;
pub use actor::Tick;
pub use widget::Widget;
pub use widget::StreamWidget;
pub use widget::StreamConfig;
pub use widget::AppendResult;
pub use widget::ScrollBuffer;
pub use widget::TextInput;
pub use widget::TextInputConfig;
pub use widget::StatusBar;
pub use widget::StatusBarConfig;
pub use widget::ProgressBar;
pub use widget::ProgressBarConfig;
pub use widget::ProgressStyle;
pub use widget::Terminal;

Modules§

actor
Actor Model: Message-passing concurrency for the TUI engine.
buffer
Buffer module: Core data structures for the double-buffer rendering system.
ffi
C Foreign Function Interface (FFI) for Flywheel.
layout
Layout module: Pre-computed static regions for efficient rendering.
terminal
Terminal module: Backend abstraction and output buffering.
widget
Widget System: Composable UI components for terminal applications.