--- # claudbg-nq36 title: 'TUI: app state model and screen enum' status: in-progress type: task priority: normal created_at: 2026-03-30T04:45:19Z updated_at: 2026-03-30T16:37:25Z parent: claudbg-i6l2 blocked_by: - claudbg-78xt --- Define the central `AppState` struct and `Screen` enum that drive the entire TUI. ## Types to define (`src/tui/state.rs` or `src/commands/tui/state.rs`) ```rust pub enum Screen { SessionList, Transcript { session_id: String }, SubagentTranscript { parent_session_id: String, agent_id: String }, } pub enum Focus { ChatLog, SubagentsPanel, } pub struct AppState { pub screen: Screen, // Session list pub sessions: Vec, // loaded once pub list_selected: usize, // Transcript pub transcript_entries: Vec, pub transcript_scroll: usize, // vertical scroll offset pub transcript_h_scroll: usize, // horizontal scroll offset pub subagents: Vec, pub subagent_selected: usize, pub focus: Focus, // Modals pub show_quit_dialog: bool, pub show_help: bool, } ``` ## Notes - `SessionListItem` is a lightweight struct with the display fields (short_id, date, project, model, msg_count, agent_count). - State transitions: `AppState::enter_transcript(session_id)` loads entries + subagents. `AppState::go_back()` pops the screen stack (or just switches back to `SessionList`). - Keep all data loading in state transitions so the render function is pure. ## Blocked by - ratatui dependency task (claudbg-78xt)