Skip to main content

Action

Enum Action 

Source
pub enum Action {
Show 51 variants InsertChar(char), Backspace, DeleteForward, MoveLeft, MoveRight, MoveHome, MoveEnd, Newline, ClearComposerLine, Submit(String), ScrollUp, ScrollDown, ToggleTheme, OpenHistorySearch, HistorySearchType(char), HistorySearchBackspace, HistorySearchNext, HistorySearchPrev, HistorySearchConfirm, HistorySearchCancel, VimSetMode(VimMode), VimMoveLeft, VimMoveRight, VimMoveHome, VimMoveEnd, VimDeleteChar, VimDeleteLine, RequestExternalEditor, ExternalEditorResult(String), ExternalEditorFailed(String), PasteImage(String), ShowApprovalModal(PendingApprovalRequest), ResolveApproval(ApprovalOutcome), ShowChildApprovalModal(PendingChildApproval), ResolveChildApproval(ApprovalOutcome), ShowElicitationModal(PendingElicitation), ElicitationType(char), ElicitationBackspace, ResolveElicitationAccept, ResolveElicitationDecline, ResolveElicitationCancel, ShowOAuthModal(PendingOAuthDisplay), DismissOAuthModal, AppendStreamingDelta(String), FinalizeStreaming, PushTranscript(TranscriptEntry), SetModelLabel(String), SetTurnActive(bool), ArmQuit, Quit, Noop,
}
Expand description

A pure description of a state transition — the output of TuiState::handle_key and the input to TuiState::apply. Not Clone/PartialEq-derived as a whole: the Show*Modal variants embed a one-shot reply channel (std::sync::mpsc::Sender/ tokio::sync::oneshot::Sender, neither of which is PartialEq) — tests assert on the resulting TuiState, not on raw Action equality.

Variants§

§

InsertChar(char)

Insert one character at the cursor.

§

Backspace

Delete the character before the cursor.

§

DeleteForward

Delete the character at (after) the cursor.

§

MoveLeft

Move the cursor one character left.

§

MoveRight

Move the cursor one character right.

§

MoveHome

Move the cursor to the start of the composer.

§

MoveEnd

Move the cursor to the end of the composer.

§

Newline

Insert a newline without submitting (multi-line composing).

§

ClearComposerLine

Clear the composer buffer without submitting (non-empty-line Ctrl+C, and vim dd).

§

Submit(String)

The composer’s contents were submitted — apply clears the composer, appends the text to history + the transcript. The CLI event loop is the one that actually calls agent.send(text); it sees this variant in handle_key’s returned Vec<Action> BEFORE calling apply (see the module doc comment on the render layer).

§

ScrollUp

Scroll the transcript up one page.

§

ScrollDown

Scroll the transcript down one page.

§

ToggleTheme

Toggle the dark/light theme.

§

OpenHistorySearch

Enter Ctrl+R cross-session prompt-history search.

§

HistorySearchType(char)

Type one character into the history-search query.

§

HistorySearchBackspace

Delete the last character of the history-search query.

§

HistorySearchNext

Select the next (older) matching history entry.

§

HistorySearchPrev

Select the previous (more recent) matching history entry.

§

HistorySearchConfirm

Accept the selected history entry into the composer.

§

HistorySearchCancel

Leave history search without changing the composer.

§

VimSetMode(VimMode)

Switch vim sub-mode (Normal/Insert).

§

VimMoveLeft

Vim h — move left.

§

VimMoveRight

Vim l — move right.

§

VimMoveHome

Vim 0 — move to line start.

§

VimMoveEnd

Vim $ — move to line end.

§

VimDeleteChar

Vim x — delete the character under the cursor.

§

VimDeleteLine

Vim dd (approximated as one keystroke — see VimMode’s doc comment) — clear the composer line.

§

RequestExternalEditor

The CLI layer should shell out to $EDITORapply only flips a flag (TuiState::external_editor_requested); the actual process spawn is terminal I/O, out of the view-model’s scope.

§

ExternalEditorResult(String)

The CLI layer’s $EDITOR invocation finished — replaces the composer with the edited text.

§

ExternalEditorFailed(String)

F9 (Fable-5 adversarial review — LOW): the CLI layer’s $EDITOR invocation failed to spawn (editor not found, exec error, …) — clears TuiState::external_editor_requested (same as ExternalEditorResult, so run_loop doesn’t keep retrying it every tick) WITHOUT touching the composer, and surfaces message as a system transcript notice so the session stays alive and the user actually sees why nothing happened, instead of the whole TUI process exiting out from under them.

§

PasteImage(String)

An image was pasted/attached (path or a data reference) — appended to the composer as a placeholder token and recorded in TuiState::pending_images for the CLI layer to route into the multimodal read path.

§

ShowApprovalModal(PendingApprovalRequest)

A new top-level Ask-tier approval request arrived — show (or queue) it as a modal.

§

ResolveApproval(ApprovalOutcome)

The user resolved the active approval modal.

§

ShowChildApprovalModal(PendingChildApproval)

A new background-child approval request arrived — show (or queue) it as a modal.

§

ResolveChildApproval(ApprovalOutcome)

The user resolved the active child-approval modal.

§

ShowElicitationModal(PendingElicitation)

A new MCP elicitation request arrived — show (or queue) it as a modal.

§

ElicitationType(char)

Type one character into the elicitation answer buffer.

§

ElicitationBackspace

Delete the last character of the elicitation answer buffer.

§

ResolveElicitationAccept

Accept the elicitation with the typed answer.

§

ResolveElicitationDecline

Decline the elicitation.

§

ResolveElicitationCancel

Cancel/dismiss the elicitation without a decision.

§

ShowOAuthModal(PendingOAuthDisplay)

A new OAuth device-code display arrived — show (or queue) it.

§

DismissOAuthModal

Dismiss the OAuth device-code modal (no reply — see PendingOAuthDisplay’s doc comment).

§

AppendStreamingDelta(String)

A chunk of streaming assistant text arrived.

§

FinalizeStreaming

The in-progress streaming turn is done — move it into the transcript.

§

PushTranscript(TranscriptEntry)

Append one entry directly to the transcript (tool events, system notices raised outside a modal resolution).

§

SetModelLabel(String)

Update the status line’s model label.

§

SetTurnActive(bool)

Update the status line’s turn-in-flight indicator.

§

ArmQuit

First Ctrl+C on an empty, non-modal composer — arms the “press again to exit” notice without quitting yet.

§

Quit

Second consecutive Ctrl+C — actually quit.

§

Noop

A key the current focus/modal doesn’t bind to anything — carries no mutation; apply is a no-op for it. handle_key prefers returning an empty Vec over this where possible; it exists for the rare case a caller wants an explicit “nothing happened” marker (e.g. a disabled modal option).

Trait Implementations§

Source§

impl Debug for Action

Source§

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

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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: 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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