#[non_exhaustive]pub enum SessionEvent {
Show 19 variants
Thinking,
ToolCallStart {
name: String,
arguments: String,
},
ToolCallComplete {
name: String,
output: String,
success: bool,
duration_ms: u64,
},
TextChunk(String),
TextComplete(String),
ThinkingComplete(String),
UsageReport {
prompt_tokens: usize,
completion_tokens: usize,
duration_ms: u64,
model: String,
},
SessionSync(Box<Session>),
Done,
Error(String),
TokenEstimate(TokenEstimate),
TokenUsage(TokenDelta),
RlmProgress(RlmProgressEvent),
RlmComplete(RlmCompletion),
CompactionStarted(CompactionStart),
CompactionCompleted(CompactionOutcome),
CompactionFailed(CompactionFailure),
ContextTruncated(ContextTruncation),
RlmSubcallFallback(RlmSubcallFallback),
}Expand description
Events emitted during session processing for real-time UI updates and durable telemetry.
§Stability
This enum is #[non_exhaustive]. match expressions must include a
wildcard arm; new variants may be added without breaking consumers.
§Examples
use codetether_agent::session::SessionEvent;
let ev = SessionEvent::Thinking;
assert!(!ev.is_durable());
assert!(matches!(ev, SessionEvent::Thinking));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Thinking
The agent is thinking / waiting on the model.
ToolCallStart
A tool call has started.
ToolCallComplete
A tool call has completed.
Fields
TextChunk(String)
Partial assistant text output for streaming UIs.
TextComplete(String)
Final (per-step) assistant text output.
ThinkingComplete(String)
Model thinking/reasoning output (for reasoning-capable models).
UsageReport
Token usage and timing for one LLM round-trip (legacy aggregate).
Prefer SessionEvent::TokenUsage for new code — it carries a
TokenSource so RLM sub-calls and
tool-embedded LLM calls are attributed separately.
Fields
SessionSync(Box<Session>)
Updated session state so the caller can sync its in-memory copy.
Done
Processing is complete.
Error(String)
An error occurred during processing.
TokenEstimate(TokenEstimate)
Pre-flight estimate of the next request’s token footprint. Ephemeral.
TokenUsage(TokenDelta)
Observed token consumption for one LLM round-trip, attributed by
TokenSource. Durable.
RlmProgress(RlmProgressEvent)
Per-iteration progress tick from an in-flight RLM loop. Ephemeral.
RlmComplete(RlmCompletion)
Terminal record for an RLM invocation. Durable.
CompactionStarted(CompactionStart)
A context-compaction pass has begun. Durable.
CompactionCompleted(CompactionOutcome)
A context-compaction pass has finished successfully. Durable.
CompactionFailed(CompactionFailure)
Every compaction strategy failed to fit under budget. Durable.
ContextTruncated(ContextTruncation)
The terminal truncation fallback dropped part of the transcript.
Durable; emitted in addition to SessionEvent::CompactionCompleted
when the final strategy is
FallbackStrategy::Truncate.
RlmSubcallFallback(RlmSubcallFallback)
A configured subcall_model could not be resolved so the router
fell back to the root model. Durable — this is a cost signal.
Implementations§
Source§impl SessionEvent
impl SessionEvent
Sourcepub fn is_durable(&self) -> bool
pub fn is_durable(&self) -> bool
Returns true if this variant carries data that must reach the
durable sink (see the module docs for the full split).
§Examples
use codetether_agent::session::{SessionEvent, TokenDelta, TokenSource};
let delta = TokenDelta {
source: TokenSource::Root,
model: "m".into(),
prompt_tokens: 1, completion_tokens: 1, duration_ms: 0,
};
assert!(SessionEvent::TokenUsage(delta).is_durable());
assert!(!SessionEvent::Thinking.is_durable());
assert!(!SessionEvent::TextChunk("x".into()).is_durable());Trait Implementations§
Source§impl Clone for SessionEvent
impl Clone for SessionEvent
Source§fn clone(&self) -> SessionEvent
fn clone(&self) -> SessionEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SessionEvent
impl !RefUnwindSafe for SessionEvent
impl Send for SessionEvent
impl Sync for SessionEvent
impl Unpin for SessionEvent
impl UnsafeUnpin for SessionEvent
impl !UnwindSafe for SessionEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request