Skip to main content

systemprompt_models/agui/
event_type.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
5pub enum AgUiEventType {
6    RunStarted,
7    RunFinished,
8    RunError,
9    StepStarted,
10    StepFinished,
11    TextMessageStart,
12    TextMessageContent,
13    TextMessageEnd,
14    ToolCallStart,
15    ToolCallArgs,
16    ToolCallEnd,
17    ToolCallResult,
18    StateSnapshot,
19    StateDelta,
20    MessagesSnapshot,
21    Custom,
22}
23
24impl AgUiEventType {
25    pub const fn as_str(&self) -> &'static str {
26        match self {
27            Self::RunStarted => "RUN_STARTED",
28            Self::RunFinished => "RUN_FINISHED",
29            Self::RunError => "RUN_ERROR",
30            Self::StepStarted => "STEP_STARTED",
31            Self::StepFinished => "STEP_FINISHED",
32            Self::TextMessageStart => "TEXT_MESSAGE_START",
33            Self::TextMessageContent => "TEXT_MESSAGE_CONTENT",
34            Self::TextMessageEnd => "TEXT_MESSAGE_END",
35            Self::ToolCallStart => "TOOL_CALL_START",
36            Self::ToolCallArgs => "TOOL_CALL_ARGS",
37            Self::ToolCallEnd => "TOOL_CALL_END",
38            Self::ToolCallResult => "TOOL_CALL_RESULT",
39            Self::StateSnapshot => "STATE_SNAPSHOT",
40            Self::StateDelta => "STATE_DELTA",
41            Self::MessagesSnapshot => "MESSAGES_SNAPSHOT",
42            Self::Custom => "CUSTOM",
43        }
44    }
45}