Commit Graph

4 Commits

Author SHA1 Message Date
TheArchitectit 25610f2a06 fix(tui): leave alternate screen during turns — zero output bleeding
The TUI is not active during tool execution. The flow becomes:
  1. leave_for_turn()  — exit alt screen, enable raw mode
  2. cli.run_turn_to() — stdout/stderr goes to normal terminal
  3. wait_to_return()  — 'Press any key to return to TUI...'
  4. reenter_after_turn() — re-enter alt screen, redraw

This guarantees zero output bleeding. Replaces suspend/resume approach.
2026-06-12 14:30:06 -05:00
TheArchitectit 4af649b442 fix(tui): safe stdout capture + focused OpenCode-style layout
- Add  dependency for safe stdout/stderr capture during turns
- Replace unsafe libc::dup/dup2 stdout suppression with capture_output()
- Tool stdout/stderr is now captured and rendered inside conversation pane
- Add compact StatusBar component for focused layout
- Redraw layout: status bar top, large conversation, compact input,
  optional dashboard on the right for wide terminals
- Eliminates output bleeding onto the TUI frame
- 321 tests pass
2026-06-12 14:17:21 -05:00
TheArchitectit 9d066a0818 fix(tui): ConversationPane render cache via RefCell — actually renders now
The Component trait's render(&self) couldn't mutate the cache.
Switched to RefCell<RenderCache> for interior mutability so the
word-wrapped line cache rebuilds on dirty during render().

Also adds Dashboard::clear_dirty() and marks components clean
after each draw_screen() cycle.
2026-06-12 14:03:35 -05:00
TheArchitectit 55941ac6c8 feat(tui): component-based architecture, eliminates libc::dup hack
- Convert tui.rs → tui/ directory module with legacy.rs re-export
- Add Component + Overlay traits for clean separation of concerns
- Build component-based TuiApp (app.rs) with pre-borrow draw pattern
- Extract: ConversationPane, InputBar, Dashboard, CommandPaletteOverlay,
  AgentViewOverlay as independent components
- Add EventBus with crossbeam-channel for component communication
- Add SlashCommandDispatcher (testable, decoupled from main.rs)
- Add shared MarkdownAst + parser + shared markdown utilities
- Add StreamingMarkdownState stub for incremental rendering
- Wire new TuiApp into main.rs::run_tui_repl()
- ELIMINATE unsafe libc::dup/dup2 stdout suppression — replaced with
  suspend/resume pattern (same as provider swap flow)
- All 320 tests pass, 57 TUI-specific tests pass
2026-06-12 13:26:53 -05:00