pub struct SessionEvent {
pub id: String,
pub timestamp: String,
pub parent_id: Option<String>,
pub ephemeral: Option<bool>,
pub agent_id: Option<String>,
pub debug_cli_received_at_ms: Option<i64>,
pub debug_ws_forwarded_at_ms: Option<i64>,
pub event_type: String,
pub data: Value,
}Expand description
A single event in a session’s timeline.
Events form a linked chain via parent_id. The event_type string
identifies the kind (e.g. "assistant.message_delta", "session.idle",
"tool.execution_start"). Event-specific payload is in data as
untyped JSON.
Fields§
§id: StringUnique event ID (UUID v4).
timestamp: StringISO 8601 timestamp.
parent_id: Option<String>ID of the preceding event in the chain.
ephemeral: Option<bool>Transient events that are not persisted to disk.
agent_id: Option<String>Sub-agent instance identifier. Absent for events emitted by the root/main agent and for session-level events.
debug_cli_received_at_ms: Option<i64>Debug timestamp: when the CLI received this event (ms since epoch).
debug_ws_forwarded_at_ms: Option<i64>Debug timestamp: when the event was forwarded over WebSocket.
event_type: StringEvent type string (e.g. "assistant.message", "session.idle").
data: ValueEvent-specific data. Structure depends on event_type.
Implementations§
Source§impl SessionEvent
impl SessionEvent
Sourcepub fn parsed_type(&self) -> SessionEventType
pub fn parsed_type(&self) -> SessionEventType
Parse the string event_type into a typed SessionEventType enum.
Returns SessionEventType::Unknown for unrecognized event types,
ensuring forward compatibility with newer CLI versions.
Sourcepub fn typed_data<T: DeserializeOwned>(&self) -> Option<T>
pub fn typed_data<T: DeserializeOwned>(&self) -> Option<T>
Deserialize the event data field into a typed struct.
Returns None if deserialization fails (e.g. unknown event type
or schema mismatch). Prefer typed data accessors for specific
event types where you need strongly-typed field access.
Sourcepub fn is_transient_error(&self) -> bool
pub fn is_transient_error(&self) -> bool
model_call errors are transient — the CLI agent loop continues
after them and may succeed on the next turn. These should not be
treated as session-ending errors.
Trait Implementations§
Source§impl Clone for SessionEvent
impl Clone for SessionEvent
Source§fn clone(&self) -> SessionEvent
fn clone(&self) -> SessionEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more