Skip to main content

Module session

Module session 

Source
Expand description

Per-connection realtime session: the bridge from RHP frames to existing Core seams (PROTOCOL.md §4).

One HardwareSession exists per live WS connection. It owns the per-turn state and routes work IN-PROCESS (never self-HTTP) to:

  • chat: [crate::sidecar::adapters::run_text_turn] (the same non-stream text-turn primitive the off-chat AgentRunner uses) for the model turn, plus [crate::server::voice] for ASR/TTS.
  • ambient: the crate::ingest::MeetingIngest seam (MeetingIngest::append_segment) feeding the long-running meeting that is the ambient session — inverted so this crate never links ryu_meetings.

Opus decode/encode happens at the codec edge (super::codec) so the rest of Core sees PCM/WAV. The WS upgrade + frame pump lives in server::hardware_ws; this type holds the logic the pump drives.

§Streaming model

[run_text_turn] is non-streaming (it returns the full reply text). For v1 we emit the reply as sentence-chunked chat_deltas + a chat_end, then synthesize the whole reply to TTS. True per-token deltas would require consuming the SSE chat adapter — out of scope for the device link.

Modules§

live
Process-global registry of live device WS senders, so out-of-band producers (the dashboard refresh loop, the ambient rolling-summary) can push a control message to a connected device without holding its socket. Keyed by device_id; the WS handler registers a clone of its outbound mpsc::Sender on connect and removes it on disconnect (review gap #4: the desk e-ink got no content because nothing ever told it to re-poll).

Structs§

HardwareSession
Live state for one connected device.

Enums§

SessionOutput
What the session wants the WS pump to send back to the device. The pump serializes control variants to TEXT frames and audio to BINARY frames.
TurnInput
The user input that opens a chat turn.