pub struct VisibleMessageStream { /* private fields */ }Expand description
Per-run message-only replay and broadcast state.
The replay is intentionally not byte-capped: it contains only visible text generated by the current run and remains authoritative until durable history is acknowledged. Selected output may retain it until the existing runner is replaced/evicted. Silently evicting it would make subscribers lose text.
Implementations§
Source§impl VisibleMessageStream
impl VisibleMessageStream
pub fn new() -> Self
Sourcepub fn subscribe_with_snapshot(
&self,
) -> (Receiver<VisibleMessageEvent>, VisibleMessageSnapshot)
pub fn subscribe_with_snapshot( &self, ) -> (Receiver<VisibleMessageEvent>, VisibleMessageSnapshot)
Subscribe before taking the snapshot. Concurrent events are either in the snapshot or queued with a greater version, never neither.
Sourcepub fn selected_output_snapshot(&self) -> Option<SelectedRunOutputSnapshot>
pub fn selected_output_snapshot(&self) -> Option<SelectedRunOutputSnapshot>
Read the same visible-message buffer atomically, including text already acknowledged by history. Ordinary WS snapshots still hide that prefix. Only the owning runner’s lifetime retains these bytes; no new store/TTL.
pub fn begin_round(&self, round_count: u32)
Sourcepub fn start(&self, message_id: String, created_at: DateTime<Utc>)
pub fn start(&self, message_id: String, created_at: DateTime<Utc>)
Start one provider response. Previous segments remain replayable until an explicit discard or the durable-history barrier; a later attempt in the same round does not prove the earlier segment was rolled back.
Sourcepub fn append(&self, content: String)
pub fn append(&self, content: String)
Append visible assistant text. Legacy producers without an explicit start receive a host-minted temporary identity and reconcile on history commit.
pub fn discard(&self, message_id: &str)
pub fn mark_terminal(&self, reason: impl Into<String>)
Sourcepub fn history_committed(&self)
pub fn history_committed(&self)
Reconcile ordinary replay only after durable history publication. Selected output retains the same bytes until its runner is reclaimed.