Skip to main content

PiApp

Struct PiApp 

Source
pub struct PiApp {
    pub conversation_viewport: Viewport,
    /* private fields */
}
Expand description

The main interactive TUI application model.

Fields§

§conversation_viewport: Viewport

Implementations§

Source§

impl PiApp

Source

pub fn cycle_model(&mut self, delta: i32)

Source§

impl PiApp

Source

pub fn open_model_selector(&mut self)

Open the model selector overlay.

Source

pub fn handle_model_selector_key(&mut self, key: &KeyMsg) -> Option<Cmd>

Handle keyboard input while the model selector is open.

Source§

impl PiApp

Source

pub fn handle_branch_picker_key(&mut self, key: &KeyMsg) -> Option<Cmd>

Handle keyboard input when the branch picker overlay is active.

Source

pub fn open_branch_picker(&mut self)

Open the branch picker if the session has sibling branches.

Source

pub fn cycle_sibling_branch(&mut self, forward: bool)

Cycle to the next or previous sibling branch (Ctrl+Right / Ctrl+Left).

Source§

impl PiApp

Source

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

Source

pub fn set_terminal_size(&mut self, width: usize, height: usize)

Source§

impl PiApp

Source

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.

Source

pub fn session_handle(&self) -> Arc<Mutex<Session>>

Source

pub fn status_message(&self) -> Option<&str>

Get the current status message (for testing).

Source

pub fn conversation_messages_for_test(&self) -> &[ConversationMessage]

Snapshot the in-memory conversation buffer (integration test helper).

Source

pub fn memory_summary_for_test(&self) -> String

Return the memory summary string (integration test helper).

Source

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).

Source

pub fn force_memory_cycle_for_test(&mut self)

Force a memory monitor sample + action pass (integration test helper).

Source

pub fn force_memory_collapse_tick_for_test(&mut self)

Force progressive-collapse timing eligibility (integration test helper).

Source

pub const fn model_selector(&self) -> Option<&ModelSelectorOverlay>

Get a reference to the model selector overlay (for testing).

Source

pub const fn has_branch_picker(&self) -> bool

Check if the branch picker is currently open (for testing).

Source

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).

Source

pub fn prefix_cache_len_for_test(&self) -> usize

Return the length of the cached conversation prefix (integration test helper for PERF-2).

Source

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§

Source§

impl Model for PiApp

Source§

fn init(&self) -> Option<Cmd>

Initialize the model and return an optional startup command. Read more
Source§

fn update(&mut self, msg: Message) -> Option<Cmd>

Process a message and return a new command. Read more
Source§

fn view(&self) -> String

Render the model as a string for display. Read more

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<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
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> 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> Same for T

Source§

type Output = T

Should always be Self
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
Source§

impl<T> ParallelSend for T

Source§

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

Source§

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