Skip to main content

AgentEvent

Enum AgentEvent 

Source
#[non_exhaustive]
pub enum AgentEvent {
Show 25 variants Chunk(String), FullMessage(String), Flush, Typing, Status(String), ToolStart { tool_name: ToolName, command: String, tool_call_id: String, is_mcp: bool, }, ToolOutputChunk { tool_name: ToolName, command: String, chunk: String, tool_call_id: String, }, ToolOutput { tool_name: ToolName, command: String, output: String, success: bool, diff: Option<DiffData>, filter_stats: Option<String>, kept_lines: Option<Vec<usize>>, tool_call_id: String, }, ConfirmRequest { prompt: String, response_tx: Sender<bool>, }, ElicitationRequest { request: ElicitationRequest, response_tx: Sender<ElicitationResponse>, }, QueueCount(usize), DiffReady { diff: DiffData, tool_call_id: String, }, CommandResult { command_id: String, output: String, }, SetCancelSignal(Arc<Notify>), SetMetricsRx(Receiver<MetricsSnapshot>), SetTaskSupervisor(TaskSupervisor), ForegroundSubagentStarted { id: String, name: String, }, ForegroundSubagentCompleted { id: String, name: String, success: bool, }, BackgroundSubagentCompleted { id: String, name: String, success: bool, }, ContextEstimate(usize), FleetSnapshot(FleetSnapshot), DurableSnapshot(DurableSnapshot), ResumeBanner(String), HistoryBackfill(Vec<TranscriptEntry>), SkillCatalog(Arc<[SkillCatalogItem]>),
}
Expand description

Events produced by the agent and forwarded to the TUI via crate::TuiChannel.

Each variant corresponds to a distinct phase or signal in the agent lifecycle (streaming output, tool execution, user confirmation, etc.).

§Examples

use zeph_tui::event::AgentEvent;

let ev = AgentEvent::Chunk("partial response".to_string());
assert!(matches!(ev, AgentEvent::Chunk(_)));

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Chunk(String)

A streaming text chunk from the LLM — appended to the current message.

§

FullMessage(String)

A complete (non-streaming) assistant message.

§

Flush

Signals that streaming is complete; the chat widget stops the cursor.

§

Typing

The agent is waiting for an LLM response (drives the throbber).

§

Status(String)

A short status string to display in the activity bar (e.g. "Searching memory…").

§

ToolStart

A tool call has started; the TUI should display a spinner with the tool name.

Fields

§tool_name: ToolName

Canonical tool name (e.g. "bash", "read_file").

§command: String

The primary command or argument string shown in the status bar.

§tool_call_id: String

Opaque tool-call identifier for correlating subsequent events.

§is_mcp: bool

True when this tool call originates from an MCP server rather than a native tool.

§

ToolOutputChunk

An incremental output chunk from a long-running tool (e.g. streaming shell output).

Fields

§tool_name: ToolName

Tool that produced the chunk.

§command: String

Command argument associated with the tool call.

§chunk: String

The chunk text to append.

§tool_call_id: String

Opaque tool-call identifier for id-based message lookup.

§

ToolOutput

Final tool output, replacing any in-progress chunks for this call.

Fields

§tool_name: ToolName

Tool that produced the output.

§command: String

Command argument associated with the tool call.

§output: String

Full rendered output body.

§success: bool

true if the tool succeeded, false on error.

§diff: Option<DiffData>

Optional diff to display inline in the chat.

§filter_stats: Option<String>

Human-readable filter summary, if output was filtered.

§kept_lines: Option<Vec<usize>>

Indices of lines retained by the filter.

§tool_call_id: String

Opaque tool-call identifier for id-based message lookup.

§

ConfirmRequest

The agent requests a boolean confirmation from the user.

Fields

§prompt: String

Prompt text shown in the confirmation dialog.

§response_tx: Sender<bool>

One-shot channel to send the user’s true/false response.

§

ElicitationRequest

The agent requests structured input via an elicitation dialog.

Fields

§request: ElicitationRequest

The elicitation schema and prompt.

§response_tx: Sender<ElicitationResponse>

One-shot channel to send the user’s response.

§

QueueCount(usize)

Updated count of messages queued for the agent (shown in the input bar).

§

DiffReady

A diff is ready for immediate display in the diff panel.

Fields

§diff: DiffData

The diff payload to attach to the corresponding tool message.

§tool_call_id: String

Identifies which tool call produced this diff.

§

CommandResult

Result from a slash-command dispatched to the agent.

Fields

§command_id: String

The slash-command identifier that produced this result.

§output: String

Formatted command output to display.

§

SetCancelSignal(Arc<Notify>)

Wire a cancel signal into the TUI App after early startup (Phase 2).

§

SetMetricsRx(Receiver<MetricsSnapshot>)

Wire a metrics receiver into the TUI App after early startup (Phase 2).

§

SetTaskSupervisor(TaskSupervisor)

Wire a zeph_common::task_supervisor::TaskSupervisor into the TUI App after early startup (Phase 2), so the task registry panel reflects live task state instead of reporting “supervisor not available”.

§

ForegroundSubagentStarted

A foreground subagent has been spawned; the TUI should switch view to its transcript.

Fields

§id: String

Stable sub-agent identifier (task_id from SubAgentManager).

§name: String

Human-readable agent definition name.

§

ForegroundSubagentCompleted

A foreground subagent has reached a terminal state; the TUI should return to Main view.

Fields

§id: String

Stable sub-agent identifier.

§name: String

Human-readable agent definition name.

§success: bool

true if Completed state, false if Failed/Canceled.

§

BackgroundSubagentCompleted

A background subagent (/agent bg) has reached a terminal state.

Fires for every background subagent, not just one the parent turn is blocking on. The TUI only acts on it when id matches the subagent currently being viewed via the sidebar’s manual transcript view — resetting to Main and rendering a terminal marker, since the sidebar list and the transcript reload trigger both key off MetricsSnapshot::sub_agents, which no longer contains a completed agent by the time this event is observed (#6570). Subagents not being viewed need no action here: their completion notice is already pushed to Main chat via AgentEvent::FullMessage from Channel::send in notify_completed_subagents.

Fields

§id: String

Stable sub-agent identifier.

§name: String

Human-readable agent definition name.

§success: bool

true if Completed state, false if Failed/Canceled.

§

ContextEstimate(usize)

Current context token count estimate, updated after each context assembly.

The value is an approximation based on character-level heuristics and may diverge slightly from the actual token count sent to the LLM. Stale between turns (the previous turn’s estimate remains displayed until the next assembly).

§

FleetSnapshot(FleetSnapshot)

Updated fleet snapshot from the background DB poll task (#3884).

§

DurableSnapshot(DurableSnapshot)

Updated durable execution snapshot from the background poll task (spec-064, #4949).

§

ResumeBanner(String)

A non-empty prior conversation was resumed at startup (spec-068 §13.5).

Renders as a persistent banner in the header/status area — unlike AgentEvent::Status, it must remain visible once the first prompt scrolls the transient status line out of view. Never sent for a fresh (system-prompt-only) conversation (§13.4, AC-16).

§

HistoryBackfill(Vec<TranscriptEntry>)

Bounded /history transcript slice to backfill into the display buffer (spec-068 §13.6-§13.7).

Pushed as distinct chat messages via App::backfill_history_display_only, split from input_history/up-arrow recall (INV-SP-6, AC-20) — never routed through App::load_history, which also feeds input_history.

§

SkillCatalog(Arc<[SkillCatalogItem]>)

Full skill catalog (name + description), emitted once at agent startup and re-emitted on skill hot-reload (spec 084 §6, issue #6648). Stored into App::skill_catalog and used to refresh an open mention picker’s Skills tab.

Trait Implementations§

Source§

impl Debug for AgentEvent

Source§

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

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> 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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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