pub struct MplEnvelope {
pub id: String,
pub stype: String,
pub payload: Value,
pub args_stype: Option<String>,
pub profile: Option<String>,
pub sem_hash: Option<String>,
pub provenance: Option<Provenance>,
pub qom_report: Option<QomReport>,
pub features: Vec<String>,
pub timestamp: Option<DateTime<Utc>>,
}Expand description
MPL Envelope - the core message wrapper
Fields§
§id: StringUnique message identifier
stype: StringSemantic type of the payload
payload: ValueThe actual payload data
args_stype: Option<String>Semantic type for arguments (for tool calls)
profile: Option<String>QoM profile used for validation
sem_hash: Option<String>Semantic hash of the canonical payload
provenance: Option<Provenance>Provenance metadata
qom_report: Option<QomReport>QoM evaluation report (typically on responses)
features: Vec<String>Optional feature flags
timestamp: Option<DateTime<Utc>>Timestamp
Implementations§
Source§impl MplEnvelope
impl MplEnvelope
Sourcepub fn new(stype: impl Into<String>, payload: Value) -> Self
pub fn new(stype: impl Into<String>, payload: Value) -> Self
Create a new envelope with a random ID
Sourcepub fn from_stype(stype: &SType, payload: Value) -> Self
pub fn from_stype(stype: &SType, payload: Value) -> Self
Create an envelope from an SType
Sourcepub fn with_args_stype(self, args_stype: impl Into<String>) -> Self
pub fn with_args_stype(self, args_stype: impl Into<String>) -> Self
Set the args SType (for tool calls)
Sourcepub fn with_profile(self, profile: impl Into<String>) -> Self
pub fn with_profile(self, profile: impl Into<String>) -> Self
Set the QoM profile
Sourcepub fn with_provenance(self, provenance: Provenance) -> Self
pub fn with_provenance(self, provenance: Provenance) -> Self
Set provenance metadata
Sourcepub fn with_features(self, features: Vec<String>) -> Self
pub fn with_features(self, features: Vec<String>) -> Self
Add feature flags
Sourcepub fn compute_hash(&mut self) -> Result<()>
pub fn compute_hash(&mut self) -> Result<()>
Compute and set the semantic hash
Sourcepub fn verify_hash(&self) -> Result<bool>
pub fn verify_hash(&self) -> Result<bool>
Verify the semantic hash matches the payload
Sourcepub fn with_qom_report(self, report: QomReport) -> Self
pub fn with_qom_report(self, report: QomReport) -> Self
Attach a QoM report
Sourcepub fn parsed_stype(&self) -> Result<SType>
pub fn parsed_stype(&self) -> Result<SType>
Parse the SType field into a structured SType
Trait Implementations§
Source§impl Clone for MplEnvelope
impl Clone for MplEnvelope
Source§fn clone(&self) -> MplEnvelope
fn clone(&self) -> MplEnvelope
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 MplEnvelope
impl Debug for MplEnvelope
Source§impl<'de> Deserialize<'de> for MplEnvelope
impl<'de> Deserialize<'de> for MplEnvelope
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
Auto Trait Implementations§
impl Freeze for MplEnvelope
impl RefUnwindSafe for MplEnvelope
impl Send for MplEnvelope
impl Sync for MplEnvelope
impl Unpin for MplEnvelope
impl UnwindSafe for MplEnvelope
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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