pub enum StreamChunk {
Show 27 variants
Thinking(String),
Narration {
narration: PublicNarration,
stage: NarrationStage,
},
Text(String),
ToolCallStart {
id: String,
name: String,
},
ToolCallArgs(String),
ToolCallEnd,
ToolCallResult {
name: String,
success: bool,
output: String,
duration_ms: u64,
},
RetryAttempt {
attempt: u32,
max_attempts: u32,
delay_ms: u64,
error_message: String,
},
ContextCompacted {
messages_before: usize,
messages_after: usize,
tokens_saved: usize,
summary: String,
},
TokenUsageUpdate {
estimated: usize,
limit: usize,
percentage: u8,
status: TokenUsageStatus,
estimated_cost: f64,
},
Status {
message: String,
},
ConfigRequest {
operation: String,
key: String,
value: Option<String>,
requires_confirmation: bool,
},
ToolConfirmationRequired {
confirmation_id: String,
tool_name: String,
tool_args: String,
description: String,
risk_level: u8,
category: String,
},
ToolBlocked {
tool_name: String,
reason: String,
},
MemoryBankSaved {
file_path: String,
session_id: String,
summary: String,
messages_saved: usize,
},
AgentLoopIteration {
iteration: u32,
},
TaskRuntimeSnapshot {
snapshot: TaskRuntimeSnapshot,
},
ShellOutput {
process_id: String,
shell_session_id: Option<String>,
stream: ShellOutputStream,
data: String,
},
ShellLifecycle {
process_id: String,
shell_session_id: Option<String>,
state: ShellProcessState,
exit_code: Option<i32>,
duration_ms: Option<u64>,
command: String,
cwd: Option<String>,
},
ShellSessionLifecycle {
shell_session_id: String,
state: ShellSessionState,
cwd: Option<String>,
active_process_id: Option<String>,
active_command: Option<String>,
available_for_reuse: bool,
interactive: bool,
user_managed: bool,
},
Done(Option<TokenUsage>),
Cancelled,
Paused,
Error(String),
ContextOverflow {
error_message: String,
},
ReflectionStarted {
reason: String,
},
ReflectionComplete {
summary: String,
stored: bool,
promoted: bool,
},
}Expand description
A chunk of streaming response
Variants§
Thinking(String)
Content from the model’s thinking process
Narration
Public-facing narration explaining the current direction.
Fields
narration: PublicNarrationStructured public narration content for user-facing progress updates.
stage: NarrationStageText(String)
A text chunk from the LLM
ToolCallStart
Start of a tool call
ToolCallArgs(String)
Arguments delta for the current tool call
ToolCallEnd
End of the current tool call (LLM finished specifying the call)
ToolCallResult
Result of tool execution with status and output
Fields
RetryAttempt
Retry attempt notification for user feedback
Fields
ContextCompacted
Context compaction notification for user feedback
Fields
TokenUsageUpdate
Token usage notification for user feedback Provides real-time visibility into context window utilization
Fields
status: TokenUsageStatusStatus indicator: Green (<70%), Yellow (70-90%), Red (>90%)
Status
A user-facing status message intended for UIs.
This is for short, transient notifications that should not count as streamed “output” (i.e., it must not prevent retry when a provider attempt fails before any actual response content is forwarded).
ConfigRequest
A request from the agent to change configuration.
This is surfaced to UIs (GUI/TUI) so they can prompt for confirmation or apply changes immediately in permissive mode.
Fields
ToolConfirmationRequired
Tool execution requires user confirmation before proceeding.
This is emitted when a tool call is detected but the session’s permission level requires user approval before execution. The UI should display a confirmation dialog and respond via the confirmation channel.
Fields
ToolBlocked
Tool execution was blocked by permission settings.
This is emitted when a tool call is detected but the session’s permission level blocks the operation entirely (e.g., Sandbox mode blocking writes).
MemoryBankSaved
Memory bank entry saved notification for user feedback Emitted when context is saved to persistent memory bank file
Fields
AgentLoopIteration
Agentic loop iteration boundary marker.
Emitted at the start of each agentic loop iteration. When iteration > 0,
it signals that the text following this marker is the LLM’s intermediate
reasoning about previous tool results (not the final response). UIs should
render this text differently (e.g., with a ◆ prefix or distinct styling)
and clearly delineate iteration boundaries.
TaskRuntimeSnapshot
Runtime-authored task-state snapshot.
Fields
snapshot: TaskRuntimeSnapshotAuthoritative runtime snapshot for the tracked task tree.
ShellOutput
Real-time shell output chunk (stdout or stderr).
Emitted while a shell command is executing so the UI can stream output into an embedded terminal component. Each chunk is a small fragment of text (typically one or a few lines).
Fields
stream: ShellOutputStreamWhether this chunk comes from stdout or stderr.
ShellLifecycle
Shell process lifecycle event.
Emitted when a shell process transitions between states (started, completed, failed, stopped, paused, resumed). The UI uses this to update the console header, show exit codes, and enable/disable control buttons.
Fields
state: ShellProcessStateNew state of the process.
ShellSessionLifecycle
Interactive shell session lifecycle event.
Fields
state: ShellSessionStateNew state of the shell session.
Done(Option<TokenUsage>)
Stream completed successfully with optional token usage
Cancelled
Stream was cancelled
Paused
Stream was paused (cancelled with the intent to resume later).
The caller is responsible for capturing the PausedExecutionState from the
accumulated streaming context. This variant is a signal to the UI to render
a resumable pause marker rather than a hard cancellation.
Error(String)
An error occurred
ContextOverflow
Context overflow error - requires compaction before retry.
This is emitted when the LLM request exceeds the model’s context window. Unlike generic errors, this signals to the pipeline that it should:
- Compact the context (summarize history, remove old messages)
- Retry the request with the reduced context
- Optionally learn the model’s actual limit for future requests
ReflectionStarted
Experiential reflection phase has started (ERL-inspired).
UIs can use this to surface that the pipeline is performing a post-answer self-review step rather than continuing normal tool use.
ReflectionComplete
Experiential reflection phase completed (ERL-inspired).
This reports both the learned summary and whether the result stayed only in short-term/session storage or was also promoted into long-term memory.
Trait Implementations§
Source§impl Clone for StreamChunk
impl Clone for StreamChunk
Source§fn clone(&self) -> StreamChunk
fn clone(&self) -> StreamChunk
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 StreamChunk
impl RefUnwindSafe for StreamChunk
impl Send for StreamChunk
impl Sync for StreamChunk
impl Unpin for StreamChunk
impl UnwindSafe for StreamChunk
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].