#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum BlockType {
Text,
Image,
Video,
Document,
SearchResult,
Thinking,
RedactedThinking,
ToolUse,
ToolResult,
ToolReference,
ServerToolUse,
WebSearchToolResult,
CodeExecutionToolResult,
McpToolUse,
McpToolResult,
ContainerUpload,
}
impl BlockType {
pub fn as_str(&self) -> &'static str {
match self {
BlockType::Text => "text",
BlockType::Image => "image",
BlockType::Video => "video",
BlockType::Document => "document",
BlockType::SearchResult => "search_result",
BlockType::Thinking => "thinking",
BlockType::RedactedThinking => "redacted_thinking",
BlockType::ToolUse => "tool_use",
BlockType::ToolResult => "tool_result",
BlockType::ToolReference => "tool_reference",
BlockType::ServerToolUse => "server_tool_use",
BlockType::WebSearchToolResult => "web_search_tool_result",
BlockType::CodeExecutionToolResult => "code_execution_tool_result",
BlockType::McpToolUse => "mcp_tool_use",
BlockType::McpToolResult => "mcp_tool_result",
BlockType::ContainerUpload => "container_upload",
}
}
}
impl std::fmt::Display for BlockType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum DeltaType {
TextDelta,
InputJsonDelta,
ThinkingDelta,
SignatureDelta,
CitationsDelta,
}
impl DeltaType {
pub fn as_str(&self) -> &'static str {
match self {
DeltaType::TextDelta => "text_delta",
DeltaType::InputJsonDelta => "input_json_delta",
DeltaType::ThinkingDelta => "thinking_delta",
DeltaType::SignatureDelta => "signature_delta",
DeltaType::CitationsDelta => "citations_delta",
}
}
}
impl std::fmt::Display for DeltaType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
pub const EPHEMERAL_MARKER_FIELD: &str = "acosmi_ephemeral";