pub enum InfinityMessage {
User {
content: UserContent,
},
Assistant {
content: AssistantContent,
},
ToolCall {
call: ToolCall,
display_as: Option<String>,
},
ToolResult {
result: ToolResult,
display_segments: Option<Vec<DisplaySegment>>,
},
SubscriptionEvent {
result: Box<ToolResult>,
tool_call_id: String,
child_thread_id: Option<ThreadId>,
invocation: Option<Box<ToolCall>>,
},
}Expand description
Wraps message content with optional display metadata that survives serialization. On replay the display metadata is used directly instead of being reconstructed or stored as sidecar data.
Each variant stores the type-specific content struct directly rather than
a full Message. Use into_messages to
reconstruct the Messages for LLM calls.
Variants§
User
Plain user text message.
Fields
content: UserContentAssistant
Assistant text or reasoning message.
Fields
content: AssistantContentToolCall
Assistant tool call with optional pretty-printed display string.
ToolResult
User tool result with optional display segments for the UI.
SubscriptionEvent
Synthetic subscription event injected into history. The display name is recomputed on replay from the original tool call in history.
The payloads are boxed to keep this rare variant from inflating the
size of every InfinityMessage (histories store many of these enums
inline). Box is transparent to serde, so the wire format is
unchanged.
Implementations§
Source§impl InfinityMessage
impl InfinityMessage
Sourcepub fn into_messages(self) -> Vec<Message>
pub fn into_messages(self) -> Vec<Message>
Reconstruct Messages for LLM calls.
Most variants produce one message; SubscriptionEvent with an
invocation produces two (tool call + tool result).
Sourcepub fn tool_result(&self) -> Option<&ToolResult>
pub fn tool_result(&self) -> Option<&ToolResult>
The tool result carried by a ToolResult or SubscriptionEvent
message, if any.
Sourcepub fn from_message(msg: Message) -> Self
pub fn from_message(msg: Message) -> Self
Auto-classify a bare Message into the appropriate InfinityMessage
variant. Display metadata fields are set to None/defaults.
Trait Implementations§
Source§impl Clone for InfinityMessage
impl Clone for InfinityMessage
Source§fn clone(&self) -> InfinityMessage
fn clone(&self) -> InfinityMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more