pub struct ActivitySnapshotEvent {
pub base: BaseEvent,
pub message_id: MessageId,
pub activity_type: String,
pub content: JsonValue,
pub replace: Option<bool>,
}Expand description
Event containing a complete activity snapshot.
This event creates a new activity message or replaces an existing one. Activity messages track structured agent activities like planning or research.
§Example
use ag_ui_core::event::ActivitySnapshotEvent;
use ag_ui_core::MessageId;
use serde_json::json;
let event = ActivitySnapshotEvent::new(
MessageId::random(),
"PLAN",
json!({"steps": ["research", "implement", "test"]}),
);Fields§
§base: BaseEventCommon event fields (timestamp, rawEvent).
message_id: MessageIdThe message ID for this activity.
activity_type: StringThe type of activity (e.g., “PLAN”, “RESEARCH”).
content: JsonValueThe activity content as a flexible JSON object.
replace: Option<bool>Whether to replace the existing activity content (default: true).
Implementations§
Source§impl ActivitySnapshotEvent
impl ActivitySnapshotEvent
Sourcepub fn new(
message_id: impl Into<MessageId>,
activity_type: impl Into<String>,
content: JsonValue,
) -> Self
pub fn new( message_id: impl Into<MessageId>, activity_type: impl Into<String>, content: JsonValue, ) -> Self
Creates a new ActivitySnapshotEvent with the given message ID, type, and content.
Sourcepub fn with_replace(self, replace: bool) -> Self
pub fn with_replace(self, replace: bool) -> Self
Sets whether to replace the existing activity content.
Sourcepub fn with_timestamp(self, timestamp: f64) -> Self
pub fn with_timestamp(self, timestamp: f64) -> Self
Sets the timestamp for this event.
Trait Implementations§
Source§impl Clone for ActivitySnapshotEvent
impl Clone for ActivitySnapshotEvent
Source§fn clone(&self) -> ActivitySnapshotEvent
fn clone(&self) -> ActivitySnapshotEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ActivitySnapshotEvent
impl Debug for ActivitySnapshotEvent
Source§impl<'de> Deserialize<'de> for ActivitySnapshotEvent
impl<'de> Deserialize<'de> for ActivitySnapshotEvent
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
Source§impl PartialEq for ActivitySnapshotEvent
impl PartialEq for ActivitySnapshotEvent
Source§impl Serialize for ActivitySnapshotEvent
impl Serialize for ActivitySnapshotEvent
impl StructuralPartialEq for ActivitySnapshotEvent
Auto Trait Implementations§
impl Freeze for ActivitySnapshotEvent
impl RefUnwindSafe for ActivitySnapshotEvent
impl Send for ActivitySnapshotEvent
impl Sync for ActivitySnapshotEvent
impl Unpin for ActivitySnapshotEvent
impl UnsafeUnpin for ActivitySnapshotEvent
impl UnwindSafe for ActivitySnapshotEvent
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