Protocol Types
Protocol types define the message schemas for Server-Sent Events (SSE) communication between the hub and clients.Message Categories
The protocol is organized into these categories:- Room messages - Room lifecycle events (create, join, leave)
- LLM messages - Request/response streaming for LLM completions
- TUI messages - Terminal UI registration and state
- Host messages - Host-specific events
- List messages - Room listing requests/responses
Room Messages
RoomCreateMessage
Client request to create a new room.Message type discriminator
Display name for the new room
RoomCreatedMessage
Server response after successfully creating a room.Message type discriminator
Human-readable room code for joining
Unique room identifier
RoomJoinMessage
Client request to join an existing room.Message type discriminator
Room code to join
Participant information for registration
RoomJoinedMessage
Server response after successfully joining a room.Message type discriminator
Room identifier
List of all participants currently in the room
RoomParticipantJoinedMessage
Broadcast when a new participant joins the room.Message type discriminator
Information about the participant who joined
RoomParticipantLeftMessage
Broadcast when a participant leaves the room.Message type discriminator
ID of the participant who left
RoomErrorMessage
Server error response for room operations.Message type discriminator
Error message description
LLM Messages
LlmRequestMessage
Client request to generate LLM completion.Message type discriminator
Unique identifier for tracking this request
Target participant ID or routing pattern (e.g., “model:llama3”, ”*”)
Input prompt for generation
Optional generation parameters to override participant defaults
LlmTokenMessage
Streaming token response during generation.Message type discriminator
Request identifier this token belongs to
ID of the participant generating the response
Generated text token
Sequence number for ordering tokens
LlmCompleteMessage
Completion signal with metrics after generation finishes.Message type discriminator
Request identifier
ID of the participant who completed the generation
Performance metrics for the generation. See LlmMetrics.
LlmErrorMessage
Error response during LLM generation.Message type discriminator
Request identifier
ID of the participant that encountered the error
Error message description
TUI Messages
TuiRegisterMessage
Terminal UI client registration.Message type discriminator
Optional room code to focus on
TuiRegisteredMessage
Server response with initial TUI state.Message type discriminator
List of all active rooms
List of all active participants
Host Messages
HostRegisterMessage
Host registration for receiving room-specific events.Message type discriminator
Room identifier to monitor
HostRegisteredMessage
Server response with room state for host.Message type discriminator
Room information
Current participants in the room
List Messages
ListRoomsMessage
Client request to list all rooms.Message type discriminator
ListRoomsResponseMessage
Server response with room list.Message type discriminator
Array of rooms with participant counts
Supporting Types
LlmMetrics
Performance metrics for LLM generation.Total number of tokens generated
Time in milliseconds until the first token was generated
Total generation duration in milliseconds
Throughput rate (tokens/second)
Message Unions
ClientMessage
Discriminated union of all client-to-server messages.ServerMessage
Discriminated union of all server-to-client messages.Usage Example
Related Types
- ParticipantInfo - Participant metadata used in messages
- RoomInfo - Room metadata used in messages
- GenerationConfig - Generation parameters