pub struct ThreadHandle {
pub events: UnboundedReceiver<AgentEvent>,
/* private fields */
}Expand description
A live connection to one thread of a running local system: send it
inputs and receive its events. Created by super::ThreadBuilder::launch
or by reattaching through super::LaunchingSystem::thread_handle.
Dropping the handle detaches it; the thread itself is unaffected.
Fields§
§events: UnboundedReceiver<AgentEvent>The thread’s events, in emission order, starting from the moment the
handle attached. Every event is either reflected in
replay or delivered here, exactly once.
Implementations§
Source§impl ThreadHandle
impl ThreadHandle
Sourcepub fn replay(&self) -> &ReplaySnapshot
pub fn replay(&self) -> &ReplaySnapshot
The state of the thread at the moment the handle attached: committed history plus any in-flight turn and in-progress reasoning.
Sourcepub async fn recv(&mut self) -> Option<AgentEvent>
pub async fn recv(&mut self) -> Option<AgentEvent>
Receive the thread’s next event. Returns None only after the system
has shut down.
Sourcepub async fn send_user_text(
&self,
text: impl Into<String>,
) -> Result<(), ChannelSendError>
pub async fn send_user_text( &self, text: impl Into<String>, ) -> Result<(), ChannelSendError>
Send plain user text to the thread.
Sourcepub async fn send(
&self,
message: InputMessage,
dedup_id: &str,
) -> Result<(), ChannelSendError>
pub async fn send( &self, message: InputMessage, dedup_id: &str, ) -> Result<(), ChannelSendError>
Send an input message to the thread. The message’s group_id is
overwritten with this handle’s thread ID; dedup_id should be stable
across redeliveries of the same message.