Skip to main content

App

Struct App 

Source
pub struct App {
Show 50 fields pub cli: Cli, pub session_id: String, pub mode: Mode, pub run_state: RunState, pub input: PromptInput, pub input_history: Vec<String>, pub history_cursor: Option<usize>, pub history_draft: String, pub transcript: Vec<Entry>, pub cwd: PathBuf, pub git_status: Option<GitStatusSummary>, pub model: String, pub model_picker_items: Vec<PickerItem>, pub user_label: String, pub websearch: WebSearchMode, pub theme: Theme, pub verbose: bool, pub session_tokens_in: u64, pub session_tokens_out: u64, pub ttft: TurnTtftState, pub context_sources: Vec<ContextSource>, pub context_diagnostics: Vec<InstructionDiagnostic>, pub context_ledger: Option<ContextLedger>, pub last_request_accounting: Option<ProviderRequestAccounting>, pub skills: Vec<SkillMetadata>, pub skill_diagnostics: Vec<SkillDiagnostic>, pub ui_tick: u64, pub ctrl_d_pending: Option<u64>, pub stopping_deadline: Option<u64>, pub session_writer: Option<SessionWriter>, pub tool_artifacts: HashMap<String, String>, pub turn_count: u64, pub process_registry: ProcessRegistry, pub last_input: Option<String>, pub last_compaction_review: Option<CompactionReviewResult>, pub queue_target: QueueTarget, pub picker: Option<PickerState>, pub prompt_accessory: PromptAccessory, pub first_run_recovery: Option<FirstRunRecovery>, pub chatgpt_oauth_driver: ChatGptOAuthDriver, pub chatgpt_browser_login: Option<ChatGptCodexBrowserLogin>, pub queued_steering: Vec<String>, pub queued_followups: Vec<String>, pub kill_ring: Vec<String>, pub detail_pane: DetailPane, pub pending_permission: Option<PendingPermission>, pub config_diagnostics: Vec<String>, pub mcp_config_files: Vec<SessionConfigFile>, pub mcp_config_diagnostics: Vec<String>, pub quit: bool, /* private fields */
}
Expand description

The full application state used to draw the screen.

Fields§

§cli: Cli

Snapshot of the effective CLI config used by command-like TUI flows.

§session_id: String§mode: Mode§run_state: RunState§input: PromptInput§input_history: Vec<String>

Submitted prompt history for Up/Down recall.

§history_cursor: Option<usize>

Current index into input_history while navigating history.

§history_draft: String

Draft input captured before history navigation starts.

§transcript: Vec<Entry>§cwd: PathBuf§git_status: Option<GitStatusSummary>

Current git working tree summary for the status line.

§model: String§model_picker_items: Vec<PickerItem>§user_label: String§websearch: WebSearchMode§theme: Theme

UI color theme.

§verbose: bool

Whether diagnostic provider/log status rows should be shown in transcript.

§session_tokens_in: u64

Provider token usage accumulated for this session.

§session_tokens_out: u64§ttft: TurnTtftState

In-memory client-observed TTFT for the active and last completed turn.

§context_sources: Vec<ContextSource>

Loaded context sources (e.g. AGENTS.md).

§context_diagnostics: Vec<InstructionDiagnostic>

Filesystem discovery diagnostics for project instructions.

§context_ledger: Option<ContextLedger>

Latest provider-neutral context ledger used for inspection and prompt assembly. It is replaced at each turn boundary.

§last_request_accounting: Option<ProviderRequestAccounting>

Most recent completed provider request accounting for /tokens and context export. The request projection is in-memory only.

§skills: Vec<SkillMetadata>

Discovered Agent Skills metadata.

§skill_diagnostics: Vec<SkillDiagnostic>

Skill discovery diagnostics for ignored malformed skills.

§ui_tick: u64

Monotonic UI tick used for lightweight animated affordances.

§ctrl_d_pending: Option<u64>

When Some, the user pressed Ctrl+D once and we are waiting for a second press within roughly three seconds to actually quit. The value is the tick deadline at which the pending confirmation expires.

§stopping_deadline: Option<u64>

Tick deadline that bounds how long a cancelled run may remain in the Stopping state while its worker unwinds.

§session_writer: Option<SessionWriter>

Append-only session writer. None when persistence is disabled (e.g. the sessions directory is not writable).

§tool_artifacts: HashMap<String, String>

Tool-call ids mapped to their bounded redacted recovery handles.

§turn_count: u64

Monotonic turn counter for session record correlation.

§process_registry: ProcessRegistry

Registry of background processes started via run_shell.

§last_input: Option<String>

The active provider prompt, retained so user input can be restored on provider failure. This can be an internal compaction request that is intentionally absent from the visible transcript. Cleared on successful completion.

§last_compaction_review: Option<CompactionReviewResult>

Last compaction review state for the context health surface.

§queue_target: QueueTarget

Current target for input submitted while the agent is running.

§picker: Option<PickerState>

Active fuzzy picker state, used by file and model pickers.

§prompt_accessory: PromptAccessory

Inline prompt accessory rendered above the input.

§first_run_recovery: Option<FirstRunRecovery>

Focused first-run or credential recovery surface.

§chatgpt_oauth_driver: ChatGptOAuthDriver

ChatGPT OAuth functions used by focused recovery.

§chatgpt_browser_login: Option<ChatGptCodexBrowserLogin>

Short-lived browser PKCE callback owned by the application adapter.

§queued_steering: Vec<String>

Steering messages waiting to be sent to the active agent thread.

§queued_followups: Vec<String>

Follow-up prompts to submit as new turns after the active run completes.

§kill_ring: Vec<String>

Kill-ring for readline-style yank (Ctrl+Y).

§detail_pane: DetailPane

Scrollable detail pane for inspecting full tool output.

§pending_permission: Option<PendingPermission>

One pending ACP permission request, if an external agent is blocked on a user decision.

§config_diagnostics: Vec<String>

Non-fatal config diagnostics from effective config loading. Surfaced in verbose startup rows and prompt inspection.

§mcp_config_files: Vec<SessionConfigFile>

MCP config files captured when the session audit metadata was written.

§mcp_config_diagnostics: Vec<String>

Non-fatal MCP config diagnostics from the latest MCP config audit load.

§quit: bool

When true the loop should stop and the app exit.

Implementations§

Source§

impl App

Source

pub fn recover_context_evidence( &mut self, reference: &str, ) -> Result<ArtifactRecovery, String>

Recover bounded redacted evidence for a context item or artifact handle.

The recovery action is appended even when the body is missing or expired, so the item’s audit metadata remains useful across resume.

Source

pub fn refresh_context_ledger( &mut self, user_turn: Option<&str>, ) -> ContextLedger

Rebuild the deterministic context ledger for a turn boundary.

The caller owns discovery, transcript projection, and persistence. The agent library receives only typed candidates and returns the policy result. This method also stores the latest ledger for bounded inspection.

Source

pub fn open_context_surface(&mut self)

Open the bounded context inspection surface.

Source

pub fn build_context_export(&mut self, include_artifacts: bool) -> ContextExport

Build the current bounded context export.

Source

pub fn write_context_export( &mut self, path: &Path, format: ContextExportFormat, include_artifacts: bool, ) -> Result<(), String>

Render and atomically write a bounded context export.

Source

pub fn restore_context_state(&mut self, records: &[SessionRecord])

Source§

impl App

Source

pub fn from_cli(cli: &Cli) -> Self

Build the initial app from parsed CLI args.

Discovers the workspace root from --cwd (preferring the git root), loads scoped AGENTS.md sources if present, and records their metadata in the session.

Source

pub fn compaction_in_flight(&self) -> bool

Whether a compaction turn is currently in flight.

Used by the preflight gate to avoid re-triggering auto-compaction while the configured-model summary request is the active turn.

Source

pub fn artifact_store(&self) -> ArtifactStore

Return the local bounded artifact store for this session workspace.

The store is deliberately separate from JSONL so session records carry metadata and handles without making artifact bodies part of replay truth.

Source

pub fn token_accounting_status(&self) -> String

Render the bounded /tokens inspection projection.

Source

pub fn self_knowledge_snapshot(&self) -> SelfKnowledgeSnapshot

Build the compact self-knowledge snapshot used by the startup display.

Source

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

Derive the granular status label for the status line.

Maps RunState plus the last transcript entry into one of idle, sending, thinking, working, running tool, stopping, cancelled, failed, error, done.

Source

pub fn prompt_state(&self) -> PromptState

Derive the prompt UI state from run_state and the transcript.

Source

pub fn effective_compaction_policy(&self) -> CompactionPolicy

Resolve the configured compaction policy from loaded config layers.

Source§

impl App

Source

pub fn render_banner_rows(&self, width: usize) -> Vec<Row>

Build startup banner rows from app state.

Source§

impl App

Source

pub fn render_context_table(&self) -> TableView

Project the context ledger into bounded table data owned by the renderer.

Trait Implementations§

Source§

impl Debug for App

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&App> for FocusedSurfaceView

Source§

fn from(app: &App) -> Self

Converts to this type from the input type.
Source§

impl From<&App> for SemanticUiView

Source§

fn from(app: &App) -> Self

Converts to this type from the input type.
Source§

impl From<&App> for PromptSurfaceView

Source§

fn from(app: &App) -> Self

Converts to this type from the input type.
Source§

impl From<&App> for OrientationBandView

Source§

fn from(app: &App) -> Self

Converts to this type from the input type.
Source§

impl From<&Cli> for App

Source§

fn from(value: &Cli) -> Self

Converts to this type from the input type.

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§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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: Sized + 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> 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