pub struct OutboundMessage {
pub channel: String,
pub to: Recipient,
pub body: String,
pub idempotency_key: Option<String>,
}Expand description
One outbound message, as the runtime hands it to a sink.
Fields§
§channel: StringChannel name — “imessage”, or any name a host adapter answers to. The runtime keeps no list of valid channels; the sink is the authority.
to: RecipientWho the message is for.
body: StringThe message text, as the human will read it.
idempotency_key: Option<String>Caller-supplied dedup key. A retry after a delivered-but-timed-out send
is the classic duplicate-message bug — the transport succeeded, the
acknowledgement did not arrive, the caller retries, and the human gets
the same message twice. A sink that honours this key makes the retry
safe. None means “no dedup”, which is the right answer for a message
the caller genuinely wants sent again.
Implementations§
Source§impl OutboundMessage
impl OutboundMessage
Sourcepub fn from_tool_params(params: &Value) -> Result<Self, String>
pub fn from_tool_params(params: &Value) -> Result<Self, String>
Parse the messaging.send tool parameters into a message.
Errors are written for two readers at once: the model, which has to fix the call on its next turn, and the operator reading the event log. Both need to know which field was wrong and what a correct one looks like, so every message names the offending key and the accepted shape.
There is deliberately exactly one accepted spelling of the address
parameter: to, the name the schema advertises. Policy rules match the
LITERAL parameter key, so an alias would be an ungoverned spelling of a
governed field — a rule written as allow_tool_param { param = "to" }
would simply not see a call that spelled it differently.
Trait Implementations§
Source§impl Clone for OutboundMessage
impl Clone for OutboundMessage
Source§fn clone(&self) -> OutboundMessage
fn clone(&self) -> OutboundMessage
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 OutboundMessage
impl Debug for OutboundMessage
Source§impl<'de> Deserialize<'de> for OutboundMessage
impl<'de> Deserialize<'de> for OutboundMessage
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 OutboundMessage
Source§impl PartialEq for OutboundMessage
impl PartialEq for OutboundMessage
Source§impl Serialize for OutboundMessage
impl Serialize for OutboundMessage
impl StructuralPartialEq for OutboundMessage
Auto Trait Implementations§
impl Freeze for OutboundMessage
impl RefUnwindSafe for OutboundMessage
impl Send for OutboundMessage
impl Sync for OutboundMessage
impl Unpin for OutboundMessage
impl UnsafeUnpin for OutboundMessage
impl UnwindSafe for OutboundMessage
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more