Skip to main content

RunEvent

Enum RunEvent 

Source
#[non_exhaustive]
pub enum RunEvent { Started { run_id: String, }, Session { run_id: String, session_id: Option<String>, model: Option<String>, }, Text { run_id: String, delta: String, }, Thinking { run_id: String, delta: String, }, ToolStart { run_id: String, tool_call_id: String, name: String, input: Option<String>, tool_kind: ToolKind, }, ToolEnd { run_id: String, tool_call_id: String, ok: bool, output: Option<String>, }, SuggestedEdits { run_id: String, edits: Vec<SuggestedEdit>, }, Activity { run_id: String, message: String, }, Usage { run_id: String, input_tokens: Option<u64>, output_tokens: Option<u64>, total_tokens: Option<u64>, }, AskQuestion { run_id: String, request_id: String, questions: Vec<Question>, }, Error { run_id: String, message: String, }, Exited { run_id: String, exit_code: Option<i32>, cancelled: bool, }, }
Expand description

The normalized event stream. #[serde(tag = "kind")] + camelCase mirrors the existing ProcessEvent wire contract the TS store already reads (event.kind, event.runId, …), so the front-end consumes one shape regardless of which harness produced it.

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

Started

First event, before any output. UI shows “thinking…”. Fired the instant the process spawns — before the CLI reports its session/model, which arrive separately as RunEvent::Session.

Fields

§run_id: String
§

Session

The agent session is established — its id and the model in use. Distinct from Started because it arrives a beat later, in the CLI’s first output line (bob’s init, Claude’s system/init, codex’s thread.started); keeping Started instant matters for the “thinking…” feedback. Either field may be absent when the CLI doesn’t report it (e.g. codex gives a thread id but no model).

Fields

§run_id: String
§session_id: Option<String>
§

Text

A chunk of assistant text. Appended to the active message.

Fields

§run_id: String
§delta: String
§

Thinking

A chunk of model reasoning (“thinking”), rendered distinctly from Text so the UI can show reasoning without mixing it into the answer (e.g. Claude’s thinking_delta).

Fields

§run_id: String
§delta: String
§

ToolStart

A tool call started — render a state-ful card keyed by id. input is the call’s arguments when delivered inline (omitted from the wire when absent, e.g. Claude streams them separately).

Fields

§run_id: String
§tool_call_id: String
§name: String
§tool_kind: ToolKind
§

ToolEnd

A tool call finished (matched to its start by id). output is the tool’s result when the harness reports it inline (omitted when absent).

Fields

§run_id: String
§tool_call_id: String
§ok: bool
§output: Option<String>
§

SuggestedEdits

One or more proposed edits. The app prepares + previews them.

Fields

§run_id: String
§

Activity

A human-readable status line (tool call, file touch, edit count). Replaces the message’s transient activity text.

Fields

§run_id: String
§message: String
§

Usage

Token accounting for the run, emitted near its end (from the CLI’s result / turn.completed). Neutral tokens only — harness-specific costs/credits (bob’s coins) are NOT here; a consumer that wants them reads the harness’s own output. Any field may be absent when the CLI doesn’t break usage down.

Fields

§run_id: String
§input_tokens: Option<u64>
§output_tokens: Option<u64>
§total_tokens: Option<u64>
§

AskQuestion

The agent is asking the user one or more multiple-choice questions (Claude’s AskUserQuestion, Codex’s tool/requestUserInput). The host renders the options as selectable chips; the user’s pick is sent back as their next message on the existing chat path (which resumes the session), so the agent continues with the answer in hand. Carrying the questions as a neutral event keeps the harness-specific tool shape in the adapter — the host never name-checks AskUserQuestion (cf. ToolKind).

Fields

§run_id: String
§request_id: String

Identifies this question instance (the harness’s tool-call id), so the host can tie the answer + clear the chips for the right one.

§questions: Vec<Question>
§

Error

Spawn / IO / parse failure. Terminal — followed by Exited.

Fields

§run_id: String
§message: String
§

Exited

The run finished. Sent exactly once.

Fields

§run_id: String
§exit_code: Option<i32>
§cancelled: bool

Trait Implementations§

Source§

impl Clone for RunEvent

Source§

fn clone(&self) -> RunEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RunEvent

Source§

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

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

impl Eq for RunEvent

Source§

impl PartialEq for RunEvent

Source§

fn eq(&self, other: &RunEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for RunEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RunEvent

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.