pub struct Thread {
pub id: String,
pub resource_id: Option<String>,
pub parent_thread_id: Option<String>,
pub metadata: ThreadMetadata,
pub active_run_id: Option<String>,
pub open_run_id: Option<String>,
pub latest_run_id: Option<String>,
pub latest_run_updated_at: Option<u64>,
}Expand description
A persistent conversation thread (metadata only).
Messages are stored separately via ThreadStore::load_messages /
ThreadStore::save_messages to maintain a single source of truth.
Fields§
§id: StringUnique thread identifier (UUID v7).
resource_id: Option<String>External resource or tenant grouping for this thread.
parent_thread_id: Option<String>Parent thread for child or delegated conversations.
metadata: ThreadMetadataThread metadata (timestamps, title, custom data).
active_run_id: Option<String>Run currently executing on a worker for this thread.
open_run_id: Option<String>Current unfinished user intent for this thread. Waiting runs remain open.
latest_run_id: Option<String>Most recently known run for this thread.
latest_run_updated_at: Option<u64>updated_at watermark for the projected latest run.
Implementations§
Source§impl Thread
impl Thread
Sourcepub fn with_id(id: impl Into<String>) -> Thread
pub fn with_id(id: impl Into<String>) -> Thread
Create a new thread with a specific identifier.
Sourcepub fn with_title(self, title: impl Into<String>) -> Thread
pub fn with_title(self, title: impl Into<String>) -> Thread
Set the title.
Sourcepub fn with_resource_id(self, resource_id: impl Into<String>) -> Thread
pub fn with_resource_id(self, resource_id: impl Into<String>) -> Thread
Set the external resource grouping.
Sourcepub fn with_parent_thread_id(
self,
parent_thread_id: impl Into<String>,
) -> Thread
pub fn with_parent_thread_id( self, parent_thread_id: impl Into<String>, ) -> Thread
Set the parent thread identifier.
Sourcepub fn normalize_lineage(&mut self)
pub fn normalize_lineage(&mut self)
Normalize lineage identifiers in-place.
Sourcepub fn validate_for_persist(&self) -> Result<(), StorageError>
pub fn validate_for_persist(&self) -> Result<(), StorageError>
Validate model-level invariants before persisting a thread projection.
Sourcepub fn touch(&mut self, now: u64)
pub fn touch(&mut self, now: u64)
Ensure timestamps are initialized and mark the thread as updated.
Sourcepub fn apply_run_projection(&mut self, run: &RunRecord)
pub fn apply_run_projection(&mut self, run: &RunRecord)
Update the thread’s run pointers from a durable run record.