pub struct SdkEvent {Show 15 fields
pub event_type: String,
pub subtype: SdkEventType,
pub task_id: Option<String>,
pub tool_use_id: Option<String>,
pub description: Option<String>,
pub task_type: Option<String>,
pub workflow_name: Option<String>,
pub prompt: Option<String>,
pub usage: Option<SdkEventUsage>,
pub last_tool_name: Option<String>,
pub summary: Option<String>,
pub workflow_progress: Option<Vec<Value>>,
pub status: Option<String>,
pub output_file: Option<String>,
pub state: Option<String>,
}Expand description
A single SDK event with all possible fields (matching TS union type).
Fields§
§event_type: StringAlways “system” for internal SDK events.
subtype: SdkEventTypeThe event subtype discriminator.
task_id: Option<String>The task ID this event relates to (optional).
tool_use_id: Option<String>The tool use ID that triggered the task (optional).
description: Option<String>Human-readable description of the task (optional).
task_type: Option<String>The type of task (e.g. “local_agent”, “local_bash”) (optional).
workflow_name: Option<String>The workflow name for workflow-based tasks (optional).
prompt: Option<String>The prompt for dream tasks (optional).
usage: Option<SdkEventUsage>Usage statistics for task progress (optional).
last_tool_name: Option<String>Last tool name used during task progress (optional).
summary: Option<String>Summary of progress (optional).
workflow_progress: Option<Vec<Value>>Workflow progress data (optional).
status: Option<String>For task_notification: terminal status of the task.
output_file: Option<String>For task_notification: path to the task output file.
state: Option<String>For session_state_changed: the new session state.
Implementations§
Source§impl SdkEvent
impl SdkEvent
Sourcepub fn task_started(
task_id: String,
tool_use_id: Option<String>,
description: String,
task_type: Option<String>,
workflow_name: Option<String>,
prompt: Option<String>,
) -> Self
pub fn task_started( task_id: String, tool_use_id: Option<String>, description: String, task_type: Option<String>, workflow_name: Option<String>, prompt: Option<String>, ) -> Self
Create a new task_started event.
Sourcepub fn task_progress(
task_id: String,
tool_use_id: Option<String>,
description: String,
usage: SdkEventUsage,
last_tool_name: Option<String>,
summary: Option<String>,
workflow_progress: Option<Vec<Value>>,
) -> Self
pub fn task_progress( task_id: String, tool_use_id: Option<String>, description: String, usage: SdkEventUsage, last_tool_name: Option<String>, summary: Option<String>, workflow_progress: Option<Vec<Value>>, ) -> Self
Create a new task_progress event.
Sourcepub fn task_notification(
task_id: String,
tool_use_id: Option<String>,
status: String,
output_file: String,
summary: String,
usage: Option<SdkEventUsage>,
) -> Self
pub fn task_notification( task_id: String, tool_use_id: Option<String>, status: String, output_file: String, summary: String, usage: Option<SdkEventUsage>, ) -> Self
Create a new task_notification event for a terminal task.
Sourcepub fn session_state_changed(state: String) -> Self
pub fn session_state_changed(state: String) -> Self
Create a new session_state_changed event.