pub struct TurnPublisher { /* private fields */ }Expand description
Publishes a turn’s events through a sink, under the PublicationGate.
The gate is the reason this type exists rather than a bare sink: the orchestrator advances the phase as it goes, and a block offered too early is dropped instead of published, whatever the caller intended.
Implementations§
Source§impl TurnPublisher
impl TurnPublisher
Sourcepub const fn is_live(&self) -> bool
pub const fn is_live(&self) -> bool
Whether anything is listening: false for Self::null.
compose asks before it goes looking for a
streaming-capable provider, because a turn nobody is watching has no
reason to prefer one.
Sourcepub fn phase_reached(&self, phase: TurnPhase)
pub fn phase_reached(&self, phase: TurnPhase)
Announces a phase and moves the gate to it.
Sourcepub fn publish_step(&self, step: Step)
pub fn publish_step(&self, step: Step)
Publishes one step of the understanding. Steps are not outcomes, so the gate never holds them back.
Sourcepub fn block(&self, block: &ResponseBlock) -> bool
pub fn block(&self, block: &ResponseBlock) -> bool
Publishes one block if the gate admits it, and returns whether it went out.
Sourcepub fn blocks(&self, turn: &AssistantTurn)
pub fn blocks(&self, turn: &AssistantTurn)
Publishes every block of a composed turn, in order.
Sourcepub fn completed(&self, turn: &AssistantTurn)
pub fn completed(&self, turn: &AssistantTurn)
Ends the stream with the turn that was persisted.