pub struct ThreadContext {
pub thread_ref: String,
pub platform: String,
pub platform_metadata: HashMap<String, String>,
pub participants: HashMap<String, Participant>,
}Expand description
Thread-level context for multi-user conversations.
A ThreadContext is created when a session is bound to a platform thread and accumulates participants as messages arrive. Platform adapters update this when new users join a thread.
Fields§
§thread_ref: StringPlatform-specific thread identifier (e.g. Slack thread_ts, Discord channel_id).
platform: StringSource platform (e.g. “slack”, “discord”, “teams”).
platform_metadata: HashMap<String, String>Platform-specific channel/workspace context.
participants: HashMap<String, Participant>Known participants in this thread, keyed by actor_id for O(1) lookup.
Implementations§
Source§impl ThreadContext
impl ThreadContext
Sourcepub fn new(thread_ref: impl Into<String>, platform: impl Into<String>) -> Self
pub fn new(thread_ref: impl Into<String>, platform: impl Into<String>) -> Self
Create a new thread context for a platform thread.
Sourcepub fn track_participant(&mut self, actor: &ExternalActor) -> bool
pub fn track_participant(&mut self, actor: &ExternalActor) -> bool
Record a participant. Updates first_seen_at only if new. Returns true if this is a newly seen participant.
Sourcepub fn participant_count(&self) -> usize
pub fn participant_count(&self) -> usize
Number of distinct participants.
Sourcepub fn participants_summary(&self) -> String
pub fn participants_summary(&self) -> String
Build a summary line for LLM context injection. e.g. “Thread participants: Alice, Bob, Charlie”
Trait Implementations§
Source§impl Clone for ThreadContext
impl Clone for ThreadContext
Source§fn clone(&self) -> ThreadContext
fn clone(&self) -> ThreadContext
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 ThreadContext
impl Debug for ThreadContext
Source§impl<'de> Deserialize<'de> for ThreadContext
impl<'de> Deserialize<'de> for ThreadContext
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>,
Source§impl PartialEq for ThreadContext
impl PartialEq for ThreadContext
Source§fn eq(&self, other: &ThreadContext) -> bool
fn eq(&self, other: &ThreadContext) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ThreadContext
impl Serialize for ThreadContext
impl StructuralPartialEq for ThreadContext
Auto Trait Implementations§
impl Freeze for ThreadContext
impl RefUnwindSafe for ThreadContext
impl Send for ThreadContext
impl Sync for ThreadContext
impl Unpin for ThreadContext
impl UnsafeUnpin for ThreadContext
impl UnwindSafe for ThreadContext
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<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request