Skip to main content

Event

Enum Event 

Source
pub enum Event {
Show 30 variants SessionStarted { session_id: String, project: String, }, SessionDone { session_id: String, status: String, }, SessionCancelled { session_id: String, }, SessionStatusChanged { session_id: String, status: String, }, SessionInput { session_id: String, input: String, }, ToolStarted { session_id: String, tool: String, call_id: String, args_preview: String, }, ToolFinished { session_id: String, tool: String, call_id: String, success: bool, result_preview: String, }, ToolError { session_id: String, tool: String, call_id: String, error: String, }, Log { session_id: String, level: String, message: String, }, Progress { session_id: String, message: String, percent: Option<f32>, }, Message { session_id: String, text: String, }, PmThinking { session_id: String, text: String, }, PmDelegating { session_id: String, agent: String, task_preview: String, }, AgentSpawned { session_id: String, agent: String, }, AgentMessage { session_id: String, agent: String, text: String, }, AgentDone { session_id: String, agent: String, status: String, }, AgentFailed { session_id: String, agent: String, error: String, }, ToolCalled { session_id: String, tool: String, preview: String, }, ToolResult { session_id: String, tool: String, preview: String, }, AstOperation { session_id: String, op: String, detail: String, }, PhaseStarted { session_id: String, phase: String, }, PhaseDone { session_id: String, phase: String, status: String, }, PhaseSkipped { session_id: String, phase: String, persona: String, }, PersonaDetected { session_id: String, persona: String, }, LlmRequested { session_id: String, agent_name: String, model: String, prompt_tokens: Option<u32>, }, LlmResponded { session_id: String, agent_name: String, model: String, completion_tokens: Option<u32>, latency_ms: u64, }, AgentStarted { session_id: String, agent_name: String, runner_type: String, }, ReportGenerated { session_id: String, agent_name: String, word_count: usize, status: String, }, RecapGenerated { session_id: String, summary: String, table_rows: Vec<(String, String)>, }, Ping,
}
Expand description

Real-time event types streamed to UI clients (browser, future Tauri).

Why: A single tagged enum keeps wire-format evolution tractable — serde(tag = "type") produces {"type":"agent_message", ...} so the UI can pattern-match on type and the back-end can grow new variants without breaking older clients (unknown variants degrade to “ignored event”). What: Variants cover the full PM lifecycle plus a Ping keepalive so SSE connections don’t time out behind reverse proxies. session_id correlates events to a specific task; the UI filters by session when scoped to a task view. Test: event_serializes_with_type_tag asserts the wire shape for one variant; Event::Ping round-trips for the keepalive path.

Variants§

§

SessionStarted

Fields

§session_id: String
§project: String
§

SessionDone

Fields

§session_id: String
§status: String
§

SessionCancelled

Fields

§session_id: String
§

SessionStatusChanged

A session’s lifecycle status changed (#2054 session-attach protocol).

Why: SessionStarted/SessionDone/SessionCancelled cover the two endpoints of a session’s life, but the daemon-owned Session model (vision spec Axiom 4) also transitions through intermediate states (e.g. created -> running) that a freshly-session.attached client should see. This variant is the generic “status is now X” signal crate::session::registry::SessionRegistry emits on every transition, including the two endpoints (so a client that attaches mid-stream sees a uniform status trail rather than mixing this variant with the older ones). What: status is a lowercase string matching session::model::SessionStatus’s serde representation ("created", "running", "cancelled", "finished", "failed"). Test: session::registry::tests::create_publishes_started_and_status_events.

Fields

§session_id: String
§status: String
§

SessionInput

Input was received for a session via session.send (#2054).

Why: distinct from AgentMessage (sub-agent -> PM activity) — this is the client -> daemon direction. Emitting it is what makes session.send observably reach a freshly-session.attached client in M1, ahead of any real agent-loop wiring (task.*, #2056). What: input is the raw string the caller passed to session.send. Test: session::registry::tests::send_publishes_input_event.

Fields

§session_id: String
§input: String
§

ToolStarted

A tool invocation began. Distinct from the older ToolCalled (which has no started/finished/error distinction or call-correlation id, and predates the session-attach protocol) — this is the tcode session.attach taxonomy’s tool-lifecycle kind.

Why: call_id correlates this with the matching ToolFinished/ ToolError when a session runs multiple tool calls in sequence or concurrently. What: args_preview is truncated via preview() before emission. Test: session::registry::registry_tests::record_tool_started_publishes_event.

Fields

§session_id: String
§tool: String
§call_id: String
§args_preview: String
§

ToolFinished

A tool invocation completed (success or failure signalled by success, not a separate error variant — use ToolError for exceptional failures the caller wants to narrate distinctly, e.g. a timeout).

Fields

§session_id: String
§tool: String
§call_id: String
§success: bool
§result_preview: String
§

ToolError

A tool invocation raised an exceptional error (as opposed to completing with success: false) — e.g. the tool process crashed or timed out rather than returning a normal failure result.

Fields

§session_id: String
§tool: String
§call_id: String
§error: String
§

Log

A structured log line scoped to a session, for operators/UIs that want daemon-side diagnostics without parsing stderr.

Fields

§session_id: String
§level: String

"debug" | "info" | "warn" | "error".

§message: String
§

Progress

A coarse progress update for a long-running session operation. percent is None when progress isn’t quantifiable (e.g. “still searching”) — the UI falls back to an indeterminate spinner.

Fields

§session_id: String
§message: String
§percent: Option<f32>
§

Message

A generic, freeform session-scoped message that doesn’t fit any more specific kind — the taxonomy’s catch-all, used sparingly.

Fields

§session_id: String
§text: String
§

PmThinking

Fields

§session_id: String
§text: String
§

PmDelegating

Fields

§session_id: String
§agent: String
§task_preview: String
§

AgentSpawned

Fields

§session_id: String
§agent: String
§

AgentMessage

Fields

§session_id: String
§agent: String
§text: String
§

AgentDone

Fields

§session_id: String
§agent: String
§status: String
§

AgentFailed

Fields

§session_id: String
§agent: String
§error: String
§

ToolCalled

Fields

§session_id: String
§tool: String
§preview: String
§

ToolResult

Fields

§session_id: String
§tool: String
§preview: String
§

AstOperation

Emitted when an AST-native tool performs a structural code operation (symbol lookup, edit, insert, import, validation, patch apply, or project pre-indexing). Surfaces in the REPL’s thinking-step display so users can see structural analysis happening in real time.

Why: AST-native tools replace whole-file rewrites with surgical edits. Without dedicated telemetry the user only sees opaque ToolCalled events and loses the narrative of “indexed project → looked up symbol → staged edit → applied patch”. This event makes the AST narrative visible. What: op is a short label (index, lookup, edit, insert, import, validate, patch); detail is a human-readable substring (e.g. “42 symbols from src/” or “fn parse_args in main.rs”). Test: ast_operation_round_trips_through_subscribe round-trips one variant through the bus.

Fields

§session_id: String
§detail: String
§

PhaseStarted

Fields

§session_id: String
§phase: String
§

PhaseDone

Fields

§session_id: String
§phase: String
§status: String
§

PhaseSkipped

#196: a phase was skipped because the active persona opts out of it.

Why: Operators and the UI need visibility when persona-aware skipping changes the executed workflow shape (e.g. [hacker] skipping QA). Without this event the run looks like phases silently disappeared. What: Carries the phase name and the persona that triggered the skip.

Fields

§session_id: String
§phase: String
§persona: String
§

PersonaDetected

#196: emitted once per workflow run when a persona is detected from the task text. Lets the UI surface “running in [hacker] mode” before any phases execute, so users immediately see why the pipeline shape may differ from the default.

Fields

§session_id: String
§persona: String
§

LlmRequested

Emitted just before any LLM chat-completion HTTP call leaves the process. Pairs with LlmResponded so consumers can compute latency independently and surface in-flight calls in the UI.

Why: Operators debugging slow runs need to see WHICH model is in flight at any moment, not just retroactively in totals. prompt_tokens is optional because we don’t always know the prompt size up front. What: agent_name may be empty for top-level PM calls; model is the resolved provider/model string sent on the wire.

Fields

§session_id: String
§agent_name: String
§model: String
§prompt_tokens: Option<u32>
§

LlmResponded

Emitted after every LLM chat-completion HTTP call returns successfully. Carries the wall-clock latency so the UI can render “model X took Yms” badges without waiting for end-of-run perf aggregation.

Fields

§session_id: String
§agent_name: String
§model: String
§completion_tokens: Option<u32>
§latency_ms: u64
§

AgentStarted

Emitted when an agent’s actual work loop begins — distinct from AgentSpawned, which fires when the subprocess is kicked off. AgentStarted fires AFTER the spawn handshake (or at the start of an in-process runner loop) so the UI can show “spawning…” vs. “running” states. runner_type is one of “subprocess”, “claude-code”, “inline”.

Fields

§session_id: String
§agent_name: String
§runner_type: String
§

ReportGenerated

Emitted when an agent produces its final result before returning to the PM. Lets the UI render “agent X returned a Y-word report” badges without parsing the result body.

Why: A coarse signal of agent productivity that complements AgentDone. word_count is a cheap whitespace-split count; status mirrors the agent’s IPC status field (“success” or “error”).

Fields

§session_id: String
§agent_name: String
§word_count: usize
§status: String
§

RecapGenerated

Emitted when a session recap is generated after N completed tasks (#371). Carries the session ID, a one-line prose summary, and structured table rows. Consumed by TUI (renders ※ recap: banner) and SSE → GUI (RecapPanel).

Fields

§session_id: String
§summary: String

One-line prose summary, e.g. “Fixed a bug where X. Y is now deployed.”

§table_rows: Vec<(String, String)>

Structured rows for the recap table: [(step_label, result_text)]

§

Ping

Implementations§

Source§

impl Event

Source

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

Return the event’s session_id if it has one. Used by the SSE handler to filter the broadcast stream to a single task subscription.

Why: Variants without a session (currently just Ping) must always pass the filter — losing keepalives would defeat their purpose. What: Returns Some(&str) for variants that carry a session, None for keepalives. The SSE filter treats None as “always include”.

Source

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

The stable kind string for this event — identical to the serde "type" tag #[serde(tag = "type", rename_all = "snake_case")] produces on the wire.

Why (#2055): SessionEventEnvelope carries kind as a top-level field (vision spec’s envelope requirement) so a client can filter/ route on it without parsing into the nested event payload. Hand- written rather than derived from serde reflection (no such API exists without an extra dependency) — kind_matches_serde_tag_for_every_variant guards the two from drifting apart. What: Returns the exact snake_case tag string for every variant. Test: kind_matches_serde_tag_for_every_variant.

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

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 Event

Source§

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

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

impl<'de> Deserialize<'de> for Event

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Event

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

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin for Event

§

impl UnwindSafe for Event

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
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> 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.
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