Skip to main content

App

Struct App 

Source
pub struct App {
Show 57 fields pub messages: Vec<ChatMessage>, pub viewport: ChatViewport, pub input: InputState, pub status: AppStatus, pub should_quit: bool, pub session_id: Option<SessionId>, pub conn: Option<Rc<ClientSideConnection>>, pub adapter_child: Option<Child>, pub model_name: String, pub cwd: String, pub cwd_raw: String, pub files_accessed: usize, pub mode: Option<ModeState>, pub login_hint: Option<LoginHint>, pub pending_compact_clear: bool, pub help_view: HelpView, pub pending_permission_ids: Vec<String>, pub cancelled_turn_pending_hint: bool, pub event_tx: UnboundedSender<ClientEvent>, pub event_rx: UnboundedReceiver<ClientEvent>, pub spinner_frame: usize, pub tools_collapsed: bool, pub active_task_ids: HashSet<String>, pub terminals: TerminalMap, pub force_redraw: bool, pub tool_call_index: HashMap<String, (usize, usize)>, pub todos: Vec<TodoItem>, pub show_header: bool, pub show_todo_panel: bool, pub todo_scroll: usize, pub todo_selected: usize, pub focus: FocusManager, pub available_commands: Vec<AvailableCommand>, pub cached_frame_area: Rect, pub selection: Option<SelectionState>, pub scrollbar_drag: Option<ScrollbarDragState>, pub rendered_chat_lines: Vec<String>, pub rendered_chat_area: Rect, pub rendered_input_lines: Vec<String>, pub rendered_input_area: Rect, pub mention: Option<MentionState>, pub slash: Option<SlashState>, pub pending_submit: bool, pub drain_key_count: usize, pub paste_burst: PasteBurstDetector, pub pending_paste_text: String, pub file_cache: Option<Vec<FileCandidate>>, pub cached_todo_compact: Option<Line<'static>>, pub git_branch: Option<String>, pub cached_header_line: Option<Line<'static>>, pub cached_footer_line: Option<Line<'static>>, pub update_check_hint: Option<String>, pub terminal_tool_calls: Vec<(String, usize, usize)>, pub needs_redraw: bool, pub perf: Option<PerfLogger>, pub fps_ema: Option<f32>, pub last_frame_at: Option<Instant>,
}

Fields§

§messages: Vec<ChatMessage>§viewport: ChatViewport

Single owner of all chat layout state: scroll, per-message heights, prefix sums.

§input: InputState§status: AppStatus§should_quit: bool§session_id: Option<SessionId>§conn: Option<Rc<ClientSideConnection>>

ACP connection handle. None while connecting (before adapter is ready).

§adapter_child: Option<Child>

Adapter child process handle. Held solely to keep the process alive – dropping Child kills the subprocess. Never read after being stored.

§model_name: String§cwd: String§cwd_raw: String§files_accessed: usize§mode: Option<ModeState>§login_hint: Option<LoginHint>

Login hint shown when authentication is required. Rendered above the input field.

§pending_compact_clear: bool

When true, the current/next turn completion should clear local conversation history. Set by /compact once the command is accepted for ACP forwarding.

§help_view: HelpView

Active help overlay view when ? help is open.

§pending_permission_ids: Vec<String>

Tool call IDs with pending permission prompts, ordered by arrival. The first entry is the “focused” permission that receives keyboard input. Up / Down arrow keys cycle focus through the list.

§cancelled_turn_pending_hint: bool

Set when a cancel notification succeeds; consumed on TurnComplete to render a red interruption hint in chat.

§event_tx: UnboundedSender<ClientEvent>§event_rx: UnboundedReceiver<ClientEvent>§spinner_frame: usize§tools_collapsed: bool

Session-level default for tool call collapsed state. Toggled by Ctrl+O - new tool calls inherit this value.

§active_task_ids: HashSet<String>

IDs of Task tool calls currently InProgress – their children get hidden. Use insert_active_task(), remove_active_task().

§terminals: TerminalMap

Shared terminal process map - used to snapshot output on completion.

§force_redraw: bool

Force a full terminal clear on next render frame.

§tool_call_index: HashMap<String, (usize, usize)>

O(1) lookup: tool_call_id -> (message_index, block_index). Use lookup_tool_call(), index_tool_call().

§todos: Vec<TodoItem>

Current todo list from Claude’s TodoWrite tool calls.

§show_header: bool

Whether the header bar is visible. Toggled by Ctrl+H.

§show_todo_panel: bool

Whether the todo panel is expanded (true) or shows compact status line (false). Toggled by Ctrl+T.

§todo_scroll: usize

Scroll offset for the expanded todo panel (capped at 5 visible lines).

§todo_selected: usize

Selected todo index used for keyboard navigation in the open todo panel.

§focus: FocusManager

Focus manager for directional/navigation key ownership.

§available_commands: Vec<AvailableCommand>

Commands advertised by the agent via AvailableCommandsUpdate.

§cached_frame_area: Rect

Last known frame area (for mouse selection mapping).

§selection: Option<SelectionState>

Current selection state for mouse-based selection.

§scrollbar_drag: Option<ScrollbarDragState>

Active scrollbar drag state while left mouse button is held on the rail.

§rendered_chat_lines: Vec<String>

Cached rendered chat lines for selection/copy.

§rendered_chat_area: Rect

Area where chat content was rendered (for selection mapping).

§rendered_input_lines: Vec<String>

Cached rendered input lines for selection/copy.

§rendered_input_area: Rect

Area where input content was rendered (for selection mapping).

§mention: Option<MentionState>

Active @ file mention autocomplete state.

§slash: Option<SlashState>

Active slash-command autocomplete state.

§pending_submit: bool

Deferred submit: set true when Enter is pressed. If another key event arrives during the same drain cycle (paste), this is cleared and the Enter becomes a newline. After the drain, the main loop checks: if still true, strips the trailing newline and submits.

§drain_key_count: usize

Count of key events processed in the current drain cycle. Used to detect paste: if >1 key events arrive in a single cycle, Enter is treated as a newline rather than submit.

§paste_burst: PasteBurstDetector

Timing-based paste burst detector. Tracks rapid key events to distinguish paste from typing when Event::Paste is not available (Windows).

§pending_paste_text: String

Buffered Event::Paste payload for this drain cycle. Some terminals split one clipboard paste into multiple chunks; we merge them and apply placeholder threshold to the merged content once per cycle.

§file_cache: Option<Vec<FileCandidate>>

Cached file list from cwd (scanned on first @ trigger).

§cached_todo_compact: Option<Line<'static>>

Cached todo compact line (invalidated on set_todos()).

§git_branch: Option<String>

Current git branch (refreshed on focus gain + turn complete).

§cached_header_line: Option<Line<'static>>

Cached header line (invalidated when git branch changes).

§cached_footer_line: Option<Line<'static>>

Cached footer line (invalidated on mode change).

§update_check_hint: Option<String>

Optional startup update-check hint rendered at the footer’s right edge.

§terminal_tool_calls: Vec<(String, usize, usize)>

Indexed terminal tool calls: (terminal_id, msg_idx, block_idx). Avoids O(n*m) scan of all messages/blocks every frame.

§needs_redraw: bool

Dirty flag: skip terminal.draw() when nothing changed since last frame.

§perf: Option<PerfLogger>

Performance logger. Present only when built with --features perf. Taken out (Option::take) during render, used, then put back to avoid borrow conflicts with &mut App.

§fps_ema: Option<f32>

Smoothed frames-per-second (EMA of presented frame cadence).

§last_frame_at: Option<Instant>

Timestamp of the previous presented frame.

Implementations§

Source§

impl App

Source

pub fn mark_frame_presented(&mut self, now: Instant)

Mark one presented frame at now, updating smoothed FPS.

Source

pub fn frame_fps(&self) -> Option<f32>

Source

pub fn ensure_welcome_message(&mut self)

Ensure the synthetic welcome message exists at index 0.

Source

pub fn update_welcome_model_if_pristine(&mut self)

Update the welcome message’s model name, but only before chat starts.

Source

pub fn insert_active_task(&mut self, id: String)

Track a Task tool call as active (in-progress subagent).

Source

pub fn remove_active_task(&mut self, id: &str)

Remove a Task tool call from the active set (completed/failed).

Source

pub fn lookup_tool_call(&self, id: &str) -> Option<(usize, usize)>

Look up the (message_index, block_index) for a tool call ID.

Source

pub fn index_tool_call(&mut self, id: String, msg_idx: usize, block_idx: usize)

Register a tool call’s position in the message/block arrays.

Source

pub fn mark_message_layout_dirty(&mut self, msg_idx: usize)

Mark message layout caches dirty from msg_idx onward.

Non-tail changes invalidate prefix-sum fast path so a full rebuild happens once.

Source

pub fn mark_all_message_layout_dirty(&mut self)

Mark all message layout caches dirty.

Source

pub fn finalize_in_progress_tool_calls( &mut self, new_status: ToolCallStatus, ) -> usize

Force-finish any lingering in-progress tool calls. Returns the number of tool calls that were transitioned.

Source

pub fn refresh_git_branch(&mut self)

Detect the current git branch and invalidate the header cache if it changed.

Source

pub fn focus_owner(&self) -> FocusOwner

Resolve the effective focus owner for Up/Down and other directional keys.

Source

pub fn is_help_active(&self) -> bool

Source

pub fn claim_focus_target(&mut self, target: FocusTarget)

Claim key routing for a navigation target. The latest claimant wins.

Source

pub fn release_focus_target(&mut self, target: FocusTarget)

Release key routing claim for a navigation target.

Source

pub fn normalize_focus_stack(&mut self)

Drop claims that are no longer valid for current state.

Auto Trait Implementations§

§

impl !Freeze for App

§

impl !RefUnwindSafe for App

§

impl !Send for App

§

impl !Sync for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

§

impl !UnwindSafe for App

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

impl<T> IntoOption<T> for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more