pub struct AppState {Show 79 fields
pub running: bool,
pub mode: OperationMode,
pub autonomy: AutonomyLevel,
pub reasoning_level: ReasoningLevel,
pub model: String,
pub working_dir: String,
pub path_shortener: PathShortener,
pub git_branch: Option<String>,
pub tokens_used: u64,
pub tokens_limit: u64,
pub context_usage_pct: f64,
pub session_cost: f64,
pub mcp_status: Option<(usize, usize)>,
pub mcp_has_errors: bool,
pub agent_active: bool,
pub messages: Vec<DisplayMessage>,
pub task_progress: Option<TaskProgress>,
pub spinner: SpinnerState,
pub input_buffer: String,
pub input_cursor: usize,
pub active_tools: Vec<ToolExecution>,
pub scroll_offset: u32,
pub user_scrolled: bool,
pub autocomplete: AutocompleteEngine,
pub background_task_count: usize,
pub backgrounded_task_info: Option<(String, Instant)>,
pub active_subagents: Vec<SubagentDisplayState>,
pub todo_manager: Option<Arc<Mutex<TodoManager>>>,
pub todo_items: Vec<TodoDisplayItem>,
pub todo_expanded: bool,
pub thinking_expanded: bool,
pub todo_spinner_tick: usize,
pub plan_name: Option<String>,
pub file_changes: Option<(usize, u64, u64)>,
pub version: String,
pub welcome_panel: WelcomePanelState,
pub terminal_width: u16,
pub terminal_height: u16,
pub pending_queue: VecDeque<PendingItem>,
pub dirty: bool,
pub message_generation: u64,
pub cached_lines: Vec<Line<'static>>,
pub lines_generation: u64,
pub per_message_hashes: Vec<u64>,
pub per_message_line_counts: Vec<usize>,
pub markdown_cache: HashMap<u64, Vec<Line<'static>>>,
pub cached_width: u16,
pub per_message_culled: Vec<bool>,
pub cached_scroll_offset: u32,
pub scroll_last_direction: Option<bool>,
pub scroll_last_time: Option<Instant>,
pub scroll_accel_level: u8,
pub theme: Theme,
pub theme_name: ThemeName,
pub command_history: CommandHistory,
pub compact_requested: bool,
pub compaction_active: bool,
pub pending_plan_request: bool,
pub plan_content_display: Option<String>,
pub backgrounding_pending: bool,
pub bg_agent_manager: BackgroundAgentManager,
pub task_watcher_open: bool,
pub task_watcher_focus: usize,
pub task_watcher_cell_scrolls: Vec<usize>,
pub task_watcher_page: usize,
pub task_watcher_all_done_at: Option<Instant>,
pub last_task_completion: Option<(String, Instant)>,
pub toasts: Vec<Toast>,
pub leader_pending: bool,
pub leader_timestamp: Option<Instant>,
pub undo_stack: Vec<String>,
pub redo_stack: Vec<String>,
pub debug_panel_open: bool,
pub session_title: Option<String>,
pub bg_subagent_map: HashMap<String, String>,
pub subagent_cancel_tokens: HashMap<String, CancellationToken>,
pub selection: SelectionState,
pub force_clear: bool,
pub last_event_time: Option<Instant>,
}Expand description
Persistent application state shared across renders.
Fields§
§running: boolWhether the app is running.
mode: OperationModeCurrent operation mode.
autonomy: AutonomyLevelAutonomy level (Manual / Semi-Auto / Auto).
reasoning_level: ReasoningLevelReasoning effort level (Off / Low / Medium / High).
model: StringActive model name.
working_dir: StringCurrent working directory.
path_shortener: PathShortenerCached path shortener for display (avoids repeated syscalls).
git_branch: Option<String>Git branch name (if in a repo).
tokens_used: u64Tokens used in current session.
tokens_limit: u64Token limit for the session.
context_usage_pct: f64Context window usage percentage (0.0 - 100.0+).
session_cost: f64Session cost in USD.
mcp_status: Option<(usize, usize)>MCP server status: (connected, total).
mcp_has_errors: boolWhether any MCP server has errors.
agent_active: boolWhether the agent is currently processing.
messages: Vec<DisplayMessage>Conversation messages for display.
task_progress: Option<TaskProgress>Current task progress (while agent is working).
spinner: SpinnerStateSpinner state for animation.
input_buffer: StringCurrent user input buffer.
input_cursor: usizeCursor position within the input buffer.
active_tools: Vec<ToolExecution>Active tool executions.
scroll_offset: u32Scroll offset for the conversation view (lines from bottom).
user_scrolled: boolWhether the user has scrolled up (disables auto-scroll).
autocomplete: AutocompleteEngineAutocomplete engine for / commands and @ file mentions.
background_task_count: usizeNumber of running background tasks.
backgrounded_task_info: Option<(String, Instant)>Info about a recently-backgrounded task: (task_id, when).
active_subagents: Vec<SubagentDisplayState>Active subagent executions for nested display.
todo_manager: Option<Arc<Mutex<TodoManager>>>Shared todo manager for syncing panel state with tool results.
todo_items: Vec<TodoDisplayItem>Todo items from the current plan (for the todo progress panel).
todo_expanded: boolWhether the todo panel is expanded (true) or collapsed (false).
thinking_expanded: boolWhether thinking blocks should start expanded (toggled by Ctrl+I).
todo_spinner_tick: usizeSpinner tick counter for todo panel animation.
plan_name: Option<String>Optional plan name for the todo panel title.
file_changes: Option<(usize, u64, u64)>File change stats for current session: (files, additions, deletions).
version: StringApplication version string.
welcome_panel: WelcomePanelStateAnimated welcome panel state.
terminal_width: u16Cached terminal width for tick-time access.
terminal_height: u16Cached terminal height for tick-time access.
pending_queue: VecDeque<PendingItem>Unified queue for items waiting to be processed by the foreground agent. Contains both user messages and completed background results, processed FIFO.
dirty: boolDirty flag — set to true when state changes; cleared after render.
message_generation: u64Generation counter for message/tool state changes. Incremented whenever messages, tool results, or collapse state change.
cached_lines: Vec<Line<'static>>Cached conversation lines (static message portion only, excludes spinners).
lines_generation: u64Generation counter at which cached_lines was last built.
per_message_hashes: Vec<u64>Per-message content hashes for incremental cache rebuilds.
per_message_line_counts: Vec<usize>Per-message line counts tracking how many cached_lines each message produced.
markdown_cache: HashMap<u64, Vec<Line<'static>>>Per-message markdown render cache, keyed by hash of (role + content).
cached_width: u16Terminal width at which cached_lines were last built (for resize invalidation).
per_message_culled: Vec<bool>Per-message culling state from the last cache rebuild. Used to detect when scrolling changes which messages are visible vs culled.
cached_scroll_offset: u32Scroll offset at the time cached_lines were last built.
scroll_last_direction: Option<bool>Scroll acceleration: last scroll direction (true = up, false = down).
scroll_last_time: Option<Instant>Scroll acceleration: timestamp of the last scroll key press.
scroll_accel_level: u8Scroll acceleration: current acceleration level (0 = base, increases).
theme: ThemeActive color theme for the TUI.
theme_name: ThemeNameName of the active theme.
command_history: CommandHistoryCommand history for Up/Down arrow navigation.
compact_requested: boolFlag set by /compact command; agent loop consumes and triggers compaction.
compaction_active: boolWhether manual compaction is currently in progress.
pending_plan_request: boolPlan mode flag — when true, next UserSubmit injects plan reminder.
plan_content_display: Option<String>Plan content to display in the conversation (consumed after first render).
backgrounding_pending: boolWhether we’re waiting for the current tool to finish before backgrounding.
bg_agent_manager: BackgroundAgentManagerBackground agent task manager.
task_watcher_open: boolWhether the task watcher panel (Alt+B) is open.
task_watcher_focus: usizeIndex of focused cell in the task watcher grid (0-based).
task_watcher_cell_scrolls: Vec<usize>Per-task scroll offset in the task watcher (index = task_idx, value = lines scrolled up).
task_watcher_page: usizePage offset when tasks exceed grid capacity.
task_watcher_all_done_at: Option<Instant>When all tasks finished (for auto-close after 3s grace).
last_task_completion: Option<(String, Instant)>Last task completion flash: (task_id, when).
toasts: Vec<Toast>Active toast notifications.
leader_pending: boolWhether leader key (Ctrl+X) is pending.
leader_timestamp: Option<Instant>Timestamp of leader key press (for timeout).
undo_stack: Vec<String>Undo stack: tree hashes from snapshot manager.
redo_stack: Vec<String>Redo stack: tree hashes for redo.
debug_panel_open: boolWhether debug panel is open.
session_title: Option<String>Session title (set by the agent).
bg_subagent_map: HashMap<String, String>Maps background subagent IDs to their parent background task IDs.
subagent_cancel_tokens: HashMap<String, CancellationToken>Per-subagent cancellation tokens for individual kill support.
selection: SelectionStateText selection state for mouse-based copy.
force_clear: boolForce a full terminal clear before next draw (resets ratatui’s diff buffer).
last_event_time: Option<Instant>Timestamp of last user-interactive event (key, mouse, scroll). Used to detect tab-switch return via timing gap.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AppState
impl !RefUnwindSafe for AppState
impl Send for AppState
impl !Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
impl UnwindSafe for AppState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more