You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
claudbg/.beans/claudbg-nq36--tui-app-state...

1.5 KiB

title status type priority created_at updated_at parent blocked_by
TUI: app state model and screen enum todo task normal 2026-03-30T04:45:19Z 2026-03-30T04:49:03Z claudbg-i6l2
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)

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<SessionListItem>,   // loaded once
    pub list_selected: usize,
    // Transcript
    pub transcript_entries: Vec<RawEntry>,
    pub transcript_scroll: usize,         // vertical scroll offset
    pub transcript_h_scroll: usize,       // horizontal scroll offset
    pub subagents: Vec<AgentRef>,
    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)