pub struct MessageMetadata { /* private fields */ }Expand description
Metadata attached to every message in the conversation history.
Skipped during serialization when None to preserve backward compatibility
with all existing persistence formats (session archives, snapshots, etc.).
Implementations§
Source§impl MessageMetadata
impl MessageMetadata
Sourcepub fn user_input(timestamp: u64, estimated_tokens: usize) -> Self
pub fn user_input(timestamp: u64, estimated_tokens: usize) -> Self
Create metadata for a message originating from a user.
Sourcepub fn llm_response(timestamp: u64, estimated_tokens: usize) -> Self
pub fn llm_response(timestamp: u64, estimated_tokens: usize) -> Self
Create metadata for a message originating from an LLM response.
Sourcepub fn tool_result(timestamp: u64, estimated_tokens: usize) -> Self
pub fn tool_result(timestamp: u64, estimated_tokens: usize) -> Self
Create metadata for a tool result message.
Sourcepub fn system(timestamp: u64, estimated_tokens: usize) -> Self
pub fn system(timestamp: u64, estimated_tokens: usize) -> Self
Create metadata for a system message.
Sourcepub fn synthetic(timestamp: u64, estimated_tokens: usize) -> Self
pub fn synthetic(timestamp: u64, estimated_tokens: usize) -> Self
Create metadata for a synthetic (e.g., recovery/injected) message.
Sourcepub fn harness_notice(timestamp: u64, estimated_tokens: usize) -> Self
pub fn harness_notice(timestamp: u64, estimated_tokens: usize) -> Self
Create metadata for a harness-generated notice injected as a User-role
turn (recovery nudges, tracker continuations, evaluator retries).
The role stays User because providers only accept user-role steering,
but the provenance is machine-generated: reverse history must not offer
it as something the user typed.
Sourcepub fn is_synthetic(&self) -> bool
pub fn is_synthetic(&self) -> bool
Return whether this message was generated by the harness rather than typed by the user.
Sourcepub fn source(&self) -> Option<&str>
pub fn source(&self) -> Option<&str>
Return the recorded message origin (user_input, llm_response,
tool_result, system, or synthetic).
Sourcepub fn with_intent_id(self, intent_id: impl Into<String>) -> Self
pub fn with_intent_id(self, intent_id: impl Into<String>) -> Self
Associate this metadata with a queued steering intent.