Skip to main content

Module stream

Module stream 

Source
Expand description

Safe streaming (spec §18.5).

Streaming is where a careful runtime is most likely to lie, because the natural thing to send first is the sentence and the sentence is the part that is not true yet. So publication is gated by the turn’s own phase:

  • Nothing that states an outcome leaves before commit. A ResponseBlock::Receipt, and every model-authored block, is refused by PublicationGate until the turn reaches TurnPhase::Committed. There is no configuration that relaxes it.
  • Model-authored text goes out only once the plan is safe to publish. Which, for this runtime, is the same moment: composition runs after the commit bundle has landed.
  • Cards and receipts are atomic typed events. They travel as whole TurnEvent::Block values, never as a stream of characters a client would have to reassemble into a button.
  • A click-only turn returns immediately. TurnStream::immediate yields a finished turn with no model call behind it (§9).

§Prose arrives whole

A reply is reviewed before it is shown, so model-authored text is published as one finished TurnEvent::Block, under the same gate as every other block.

§Progress is not an outcome

While the turn is interpreting and committing, the only thing on the wire is TurnEvent::Phase. It is what a client hangs an activity indicator on, and it says nothing about what will happen — which is exactly the point: a phase marker cannot be misread as a receipt.

Structs§

ChannelSink
A sink that forwards to a TurnStream.
NullSink
A sink that drops everything, for a caller that does not stream.
PublicationGate
Decides what may go on the wire at the phase the turn has reached.
RecordingSink
A sink that records every event, for tests and for a caller that wants the whole trace at the end.
TurnPublisher
Publishes a turn’s events through a sink, under the PublicationGate.
TurnStream
The events of one turn, as a Stream.

Enums§

TurnEvent
One thing a client learns while a turn is being handled.

Traits§

TurnSink
Receives the events of a turn as it runs.

Functions§

publishes_outcomes
Returns true once a turn’s effects are settled, so a block that states an outcome may be published (spec §18.5).