Skip to content

vllm_omni.engine.duplex.session.emitter

Everything one duplex session sends to its client.

Emission is the hub of the session runner: near enough every path through the runner ends in an event, which is why this is a collaborator rather than a module of functions. It owns three things the rest of the runner should not have to think about --- the Realtime projection state, the epoch filter that drops output from a superseded turn, and the domain transitions an outbound terminal event applies to the session before it is projected.

The one thing it cannot own is what happens after a terminal promotes deferred overlap audio: that re-enters the mailbox of the runner, so the runner injects it as promote_deferred_overlap.

SessionEmitter

Outbound events for one session.

projector property writable

projector: RealtimeProjectionState | None

The Realtime projection state, or None before anything needs it.

auto_responds

auto_responds() -> bool

Whether the session answers committed input without a response.create.

A model that takes no client commits (supports_client_commit off, a lockstep model) can only auto-respond; for every other model the client opts in through extra_body.auto_response.

emit

emit(payload: dict[str, object]) -> None

Apply the domain effects of an internal event, then project it to typed events and send them.

Only events with domain effects (response / cancel / close terminals) or Realtime projection state (response items, content parts) still travel as internal dictionaries; stateless events are constructed typed at the emit site.

emit_error

emit_error(
    code: str,
    message: str,
    *,
    event_id: object | None = None,
    retryable: bool | None = None,
) -> None

Send one typed error event (event_id is the client event it answers).

emit_events

emit_events(events: list[DuplexEvent]) -> None

is_stale_model_output

is_stale_model_output(payload: dict[str, object]) -> bool

Whether payload belongs to a turn the session has already moved past.

require_projector

require_projector() -> RealtimeProjectionState

The projection state, created on first use.

A session torn down before start() never builds one, so the lazy path here is reachable rather than defensive.