pub struct PiApp {
pub conversation_viewport: Viewport,
/* private fields */
}Expand description
The main interactive TUI application model.
Fields§
§conversation_viewport: ViewportImplementations§
Source§impl PiApp
impl PiApp
Sourcepub fn open_model_selector(&mut self)
pub fn open_model_selector(&mut self)
Open the model selector overlay.
Sourcepub fn handle_model_selector_key(&mut self, key: &KeyMsg) -> Option<Cmd>
pub fn handle_model_selector_key(&mut self, key: &KeyMsg) -> Option<Cmd>
Handle keyboard input while the model selector is open.
Source§impl PiApp
impl PiApp
Sourcepub fn handle_branch_picker_key(&mut self, key: &KeyMsg) -> Option<Cmd>
pub fn handle_branch_picker_key(&mut self, key: &KeyMsg) -> Option<Cmd>
Handle keyboard input when the branch picker overlay is active.
Sourcepub fn open_branch_picker(&mut self)
pub fn open_branch_picker(&mut self)
Open the branch picker if the session has sibling branches.
Sourcepub fn cycle_sibling_branch(&mut self, forward: bool)
pub fn cycle_sibling_branch(&mut self, forward: bool)
Cycle to the next or previous sibling branch (Ctrl+Right / Ctrl+Left).
Source§impl PiApp
impl PiApp
Sourcepub fn build_conversation_content(&self) -> String
pub fn build_conversation_content(&self) -> String
Build the conversation content string for the viewport.
Uses MessageRenderCache (PERF-1) to avoid re-rendering unchanged
messages and a conversation prefix cache (PERF-2) to skip iterating
all messages during streaming. Streaming content (current_response)
always renders fresh.
Source§impl PiApp
impl PiApp
Sourcepub fn new(
agent: Agent,
session: Arc<Mutex<Session>>,
config: Config,
resources: ResourceLoader,
resource_cli: ResourceCliOptions,
cwd: PathBuf,
model_entry: ModelEntry,
model_scope: Vec<ModelEntry>,
available_models: Vec<ModelEntry>,
pending_inputs: Vec<PendingInput>,
event_tx: Sender<PiMsg>,
runtime_handle: RuntimeHandle,
save_enabled: bool,
extensions: Option<ExtensionManager>,
keybindings_override: Option<KeyBindings>,
messages: Vec<ConversationMessage>,
total_usage: Usage,
) -> Self
pub fn new( agent: Agent, session: Arc<Mutex<Session>>, config: Config, resources: ResourceLoader, resource_cli: ResourceCliOptions, cwd: PathBuf, model_entry: ModelEntry, model_scope: Vec<ModelEntry>, available_models: Vec<ModelEntry>, pending_inputs: Vec<PendingInput>, event_tx: Sender<PiMsg>, runtime_handle: RuntimeHandle, save_enabled: bool, extensions: Option<ExtensionManager>, keybindings_override: Option<KeyBindings>, messages: Vec<ConversationMessage>, total_usage: Usage, ) -> Self
Create a new Pi application.
pub fn session_handle(&self) -> Arc<Mutex<Session>>
Sourcepub fn status_message(&self) -> Option<&str>
pub fn status_message(&self) -> Option<&str>
Get the current status message (for testing).
Sourcepub fn conversation_messages_for_test(&self) -> &[ConversationMessage]
pub fn conversation_messages_for_test(&self) -> &[ConversationMessage]
Snapshot the in-memory conversation buffer (integration test helper).
Sourcepub fn memory_summary_for_test(&self) -> String
pub fn memory_summary_for_test(&self) -> String
Return the memory summary string (integration test helper).
Sourcepub fn install_memory_rss_reader_for_test(
&mut self,
read_fn: Box<dyn Fn() -> Option<usize> + Send>,
)
pub fn install_memory_rss_reader_for_test( &mut self, read_fn: Box<dyn Fn() -> Option<usize> + Send>, )
Install a deterministic RSS sampler for integration tests.
This replaces /proc/self RSS sampling with a caller-provided function
and enables immediate sampling cadence (sample_interval = 0).
Sourcepub fn force_memory_cycle_for_test(&mut self)
pub fn force_memory_cycle_for_test(&mut self)
Force a memory monitor sample + action pass (integration test helper).
Sourcepub fn force_memory_collapse_tick_for_test(&mut self)
pub fn force_memory_collapse_tick_for_test(&mut self)
Force progressive-collapse timing eligibility (integration test helper).
Sourcepub const fn model_selector(&self) -> Option<&ModelSelectorOverlay>
pub const fn model_selector(&self) -> Option<&ModelSelectorOverlay>
Get a reference to the model selector overlay (for testing).
Sourcepub const fn has_branch_picker(&self) -> bool
pub const fn has_branch_picker(&self) -> bool
Check if the branch picker is currently open (for testing).
Sourcepub fn prefix_cache_valid_for_test(&self) -> bool
pub fn prefix_cache_valid_for_test(&self) -> bool
Return whether the conversation prefix cache is currently valid for the current message count (integration test helper for PERF-2).
Sourcepub fn prefix_cache_len_for_test(&self) -> usize
pub fn prefix_cache_len_for_test(&self) -> usize
Return the length of the cached conversation prefix (integration test helper for PERF-2).
Sourcepub fn render_buffer_capacity_hint_for_test(&self) -> usize
pub fn render_buffer_capacity_hint_for_test(&self) -> usize
Return the current view capacity hint from render buffers (integration test helper for PERF-7).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PiApp
impl !RefUnwindSafe for PiApp
impl Send for PiApp
impl !Sync for PiApp
impl Unpin for PiApp
impl UnsafeUnpin for PiApp
impl !UnwindSafe for PiApp
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
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