pub enum StreamEvent {
Show 14 variants
Text {
content: String,
},
Thinking {
content: String,
},
ToolUse {
id: String,
name: String,
input: Value,
},
ToolResult {
tool_use_id: String,
content: String,
success: bool,
},
WebSearchResult {
tool_use_id: String,
content: String,
},
Error {
message: String,
code: Option<String>,
},
Done {
usage: Option<Usage>,
},
SessionStarted {
session_id: String,
memory_count: Option<usize>,
},
StatusResponse {
session_id: Option<String>,
message_count: usize,
total_tokens: u64,
is_streaming: bool,
},
MemoryList {
memories: Vec<MemoryEntry>,
},
MemoryStats {
total: usize,
by_category: HashMap<String, usize>,
},
SessionList {
sessions: Vec<SessionInfo>,
},
MemoryAdded {
category: String,
content: String,
},
Log {
level: String,
message: String,
},
}Expand description
Event streamed to VSCode extension
Variants§
Text
Text content (streaming)
Thinking
Thinking content (extended thinking mode)
ToolUse
Tool use request
ToolResult
Tool execution result
WebSearchResult
Server-side web search result (Anthropic)
Error
Error occurred
Done
Request completed
SessionStarted
Session started/loaded
StatusResponse
Status response
MemoryList
Memory list response
Fields
§
memories: Vec<MemoryEntry>MemoryStats
Memory stats response
SessionList
Session list response
Fields
§
sessions: Vec<SessionInfo>MemoryAdded
New memory added
Log
Log message (for debugging)
Implementations§
Source§impl StreamEvent
impl StreamEvent
Sourcepub fn tool_use(
id: impl Into<String>,
name: impl Into<String>,
input: Value,
) -> Self
pub fn tool_use( id: impl Into<String>, name: impl Into<String>, input: Value, ) -> Self
Create a tool use event
Sourcepub fn tool_result(
tool_use_id: impl Into<String>,
content: impl Into<String>,
success: bool,
) -> Self
pub fn tool_result( tool_use_id: impl Into<String>, content: impl Into<String>, success: bool, ) -> Self
Create a tool result event
Sourcepub fn session_started(
session_id: impl Into<String>,
memory_count: Option<usize>,
) -> Self
pub fn session_started( session_id: impl Into<String>, memory_count: Option<usize>, ) -> Self
Create a session started event
Sourcepub fn to_json_line(&self) -> String
pub fn to_json_line(&self) -> String
Serialize to JSON line
Trait Implementations§
Source§impl Debug for StreamEvent
impl Debug for StreamEvent
Source§impl<'de> Deserialize<'de> for StreamEvent
impl<'de> Deserialize<'de> for StreamEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for StreamEvent
impl RefUnwindSafe for StreamEvent
impl Send for StreamEvent
impl Sync for StreamEvent
impl Unpin for StreamEvent
impl UnsafeUnpin for StreamEvent
impl UnwindSafe for StreamEvent
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
Mutably borrows from an owned value. Read more