#[non_exhaustive]pub struct AgentMessage {
pub message_id: MessageId,
pub content: MaybeUndefined<Vec<ContentBlock>>,
pub meta: MaybeUndefined<Map<String, Value>>,
}unstable_protocol_v2 only.Expand description
An agent message upsert.
Only AgentMessage::message_id is required. Other fields have patch
semantics: omitted fields leave the existing message value unchanged, null
clears or unsets the value, and concrete values replace 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<Map<String, Value>>The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Implementations§
Source§impl AgentMessage
impl AgentMessage
Sourcepub fn new(message_id: impl Into<MessageId>) -> AgentMessage
pub fn new(message_id: impl Into<MessageId>) -> AgentMessage
Builds AgentMessage with the required fields set; optional fields start unset or empty.
Sourcepub fn content(
self,
content: impl IntoMaybeUndefined<Vec<ContentBlock>>,
) -> AgentMessage
pub fn content( self, content: impl IntoMaybeUndefined<Vec<ContentBlock>>, ) -> AgentMessage
Complete replacement content for this message.
Sourcepub fn meta(
self,
meta: impl IntoMaybeUndefined<Map<String, Value>>,
) -> AgentMessage
pub fn meta( self, meta: impl IntoMaybeUndefined<Map<String, Value>>, ) -> AgentMessage
The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Trait Implementations§
Source§impl Clone for AgentMessage
impl Clone for AgentMessage
Source§fn clone(&self) -> AgentMessage
fn clone(&self) -> AgentMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§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<AgentMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
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§fn eq(&self, other: &AgentMessage) -> bool
fn eq(&self, other: &AgentMessage) -> bool
self and other values to be equal, and is used by ==.