#[non_exhaustive]pub struct AgentMessage {
pub message_id: MessageId,
pub content: MaybeUndefined<Vec<ContentBlock>>,
pub meta: MaybeUndefined<Meta>,
}unstable_protocol_v2 only.Expand description
An agent message upsert.
Only AgentMessage::message_id is required. content has patch semantics:
an omitted field leaves existing message content unchanged, null clears the
value, and a concrete array replaces the previous value. For a new
messageId, omitted fields use client defaults. content is replaced as a
whole array; send [] or null to clear it.
Message updates and chunks are applied in the order they are received. When
an agent_message update includes content, that array replaces any
content previously accumulated for the message, including content from
earlier chunks. Later chunks with the same messageId append to the current
content.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.message_id: MessageIdA unique identifier for the message.
content: MaybeUndefined<Vec<ContentBlock>>Complete replacement content for this message.
meta: MaybeUndefined<Meta>The _meta property is reserved by ACP to allow clients and agents to attach additional
metadata to their interactions. Omitted leaves the stored metadata unchanged; null
clears it. An object patches the stored metadata by top-level key: keys it omits are
unchanged, a key set to null is removed, and any other value replaces that key’s
stored value without merging nested objects. Beyond this patch rule, implementations
MUST NOT make assumptions about values at these keys.
See protocol docs: Metadata Patches
Implementations§
Source§impl AgentMessage
impl AgentMessage
Sourcepub fn new(message_id: impl Into<MessageId>) -> Self
pub fn new(message_id: impl Into<MessageId>) -> Self
Builds AgentMessage with the required fields set; optional fields start unset or empty.
Sourcepub fn content(
self,
content: impl IntoMaybeUndefined<Vec<ContentBlock>>,
) -> Self
pub fn content( self, content: impl IntoMaybeUndefined<Vec<ContentBlock>>, ) -> Self
Complete replacement content for this message.
Sourcepub fn meta(self, meta: impl IntoMaybeUndefined<Meta>) -> Self
pub fn meta(self, meta: impl IntoMaybeUndefined<Meta>) -> Self
Patches, clears, or leaves unchanged message metadata.
A concrete object patches stored metadata by top-level key; see
apply_meta_update.
Trait Implementations§
Source§impl Clone for AgentMessage
impl Clone for AgentMessage
Source§impl Debug for AgentMessage
impl Debug for AgentMessage
Source§impl<'de> Deserialize<'de> for AgentMessage
impl<'de> Deserialize<'de> for AgentMessage
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>,
impl Eq for AgentMessage
Source§impl JsonSchema for AgentMessage
impl JsonSchema for AgentMessage
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for AgentMessage
impl PartialEq for AgentMessage
Source§impl Serialize for AgentMessage
impl Serialize for AgentMessage
impl StructuralPartialEq for AgentMessage
Auto Trait Implementations§
impl Freeze for AgentMessage
impl RefUnwindSafe for AgentMessage
impl Send for AgentMessage
impl Sync for AgentMessage
impl Unpin for AgentMessage
impl UnsafeUnpin for AgentMessage
impl UnwindSafe for AgentMessage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.