Skip to main content

ChatApp

Struct ChatApp 

Source
pub struct ChatApp {
Show 30 fields pub messages: Vec<ChatMessage>, pub input: String, pub cursor: usize, pub message_scroll: ScrollState, pub sidebar_scroll: ScrollState, pub should_quit: bool, pub is_processing: bool, pub session_id: Option<String>, pub session_name: String, pub working_directory: String, pub git_branch: Option<String>, pub context_budget: usize, pub todo_items: Vec<TodoItemView>, pub subagent_items: Vec<SubagentItemView>, pub cached_lines: RefCell<Vec<Line<'static>>>, pub cached_width: RefCell<usize>, pub needs_rebuild: RefCell<bool>, pub available_sessions: Vec<SessionMetadata>, pub is_picking_session: bool, pub commands: Vec<SlashCommand>, pub filtered_commands: Vec<SlashCommand>, pub selected_command_index: usize, pub pending_attachments: Vec<MessageAttachment>, pub current_model_ref: String, pub available_models: Vec<ModelOptionView>, pub last_context_tokens: Option<usize>, pub text_selection: TextSelection, pub clipboard_notice: Option<ClipboardNotice>, pub current_agent_name: Option<String>, pub available_agents: Vec<AgentOptionView>, /* private fields */
}

Fields§

§messages: Vec<ChatMessage>§input: String§cursor: usize§message_scroll: ScrollState§sidebar_scroll: ScrollState§should_quit: bool§is_processing: bool§session_id: Option<String>§session_name: String§working_directory: String§git_branch: Option<String>§context_budget: usize§todo_items: Vec<TodoItemView>§subagent_items: Vec<SubagentItemView>§cached_lines: RefCell<Vec<Line<'static>>>§cached_width: RefCell<usize>§needs_rebuild: RefCell<bool>§available_sessions: Vec<SessionMetadata>§is_picking_session: bool§commands: Vec<SlashCommand>§filtered_commands: Vec<SlashCommand>§selected_command_index: usize§pending_attachments: Vec<MessageAttachment>§current_model_ref: String§available_models: Vec<ModelOptionView>§last_context_tokens: Option<usize>§text_selection: TextSelection§clipboard_notice: Option<ClipboardNotice>§current_agent_name: Option<String>§available_agents: Vec<AgentOptionView>

Implementations§

Source§

impl ChatApp

Source

pub fn new(session_name: String, cwd: &Path) -> Self

Source

pub fn set_agents( &mut self, agents: Vec<AgentOptionView>, selected: Option<String>, )

Source

pub fn cycle_agent(&mut self)

Source

pub fn selected_agent(&self) -> Option<&AgentOptionView>

Source

pub fn handle_event(&mut self, event: &TuiEvent)

Source

pub fn has_pending_question(&self) -> bool

Source

pub fn pending_question_view(&self) -> Option<PendingQuestionView>

Source

pub fn handle_question_key(&mut self, key_event: KeyEvent) -> QuestionKeyResult

Source

pub fn submit_input(&mut self) -> SubmittedInput

Source

pub fn get_lines(&self, width: usize) -> Ref<'_, Vec<Line<'static>>>

Get or rebuild cached lines for the given width (interior mutability)

Source

pub fn progress_panel_height(&self) -> u16

Source

pub fn message_viewport_height(&self, total_height: u16) -> usize

Source

pub fn message_wrap_width(&self, total_width: u16) -> usize

Source

pub fn context_usage(&self) -> (usize, usize)

Source

pub fn processing_step(&self, interval_ms: u128) -> usize

Source

pub fn processing_duration(&self) -> String

Source

pub fn set_processing(&mut self, processing: bool)

Source

pub fn session_epoch(&self) -> u64

Source

pub fn run_epoch(&self) -> u64

Source

pub fn bump_session_epoch(&mut self)

Source

pub fn bump_run_epoch(&mut self)

Source

pub fn start_new_session(&mut self, session_name: String)

Source

pub fn cancel_agent_task(&mut self)

Cancel any running agent task

Source

pub fn set_agent_task(&mut self, handle: JoinHandle<()>)

Set the agent task handle

Source

pub fn arm_esc_interrupt(&mut self)

Source

pub fn clear_pending_esc_interrupt(&mut self)

Source

pub fn should_interrupt_on_esc(&self) -> bool

Source

pub fn processing_interrupt_hint(&self) -> &'static str

Source

pub fn update_command_filtering(&mut self)

Source

pub fn mark_dirty(&self)

Source

pub fn configure_models( &mut self, current_model_ref: String, available_models: Vec<ModelOptionView>, )

Source

pub fn selected_model_ref(&self) -> &str

Source

pub fn set_selected_model(&mut self, model_ref: &str)

Source

pub fn insert_char(&mut self, ch: char)

Source

pub fn insert_str(&mut self, text: &str)

Source

pub fn backspace(&mut self)

Source

pub fn clear_input(&mut self)

Source

pub fn set_input(&mut self, value: String)

Source

pub fn add_pending_attachment(&mut self, attachment: MessageAttachment)

Source

pub fn move_to_line_start(&mut self)

Source

pub fn move_to_line_end(&mut self)

Source

pub fn move_cursor_up(&mut self)

Source

pub fn move_cursor_down(&mut self)

Source

pub fn move_cursor_left(&mut self)

Source

pub fn move_cursor_right(&mut self)

Source

pub fn start_selection(&mut self, line: usize, column: usize)

Source

pub fn update_selection(&mut self, line: usize, column: usize)

Source

pub fn end_selection(&mut self)

Source

pub fn clear_selection(&mut self)

Source

pub fn show_clipboard_notice(&mut self, x: u16, y: u16)

Source

pub fn active_clipboard_notice(&self) -> Option<ClipboardNotice>

Source

pub fn get_selected_text(&self, lines: &[Line<'static>]) -> String

Get selected text from the lines

Source

pub fn is_point_selected(&self, line: usize, column: usize) -> bool

Check if a point (line, column) is within the selection

Trait Implementations§

Source§

impl Default for ChatApp

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
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> 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