pub enum StateEnvelope {
State {
for_player: Option<String>,
state: Value,
},
Display {
event: Value,
},
Prompt {
for_player: String,
prompt: Value,
},
Response {
from_player: String,
prompt_id: u32,
action: Value,
},
Directive {
from_player: String,
directive: Value,
},
Log {
from_player: String,
entry: GameLogEntryDto,
},
Snapshot {
from_player: String,
entry: GameSnapshotEventDto,
},
Fatal {
message: String,
},
Error {
for_player: String,
error: Value,
},
RoomRelay {
protocol: String,
version: u32,
message_id: String,
from_player: Option<String>,
target_player: Option<String>,
room_id: Option<String>,
payload: Value,
},
}Expand description
Typed envelope carried inside ClientMessage::BroadcastState.state /
ServerMessage::StateUpdate.state. One discriminator (kind) plus the
payload for that variant. Constructed and parsed in every layer that
touches the relay (engine, bot, host, web/Tauri UI) — anything that needs
to handcraft json!({"kind": "..."}) belongs here instead.
Variants§
State
Display
Prompt
Engine asks a player for a decision. prompt is AgentPrompt for the
Rust engine; the Java bridge emits a different shape, so the payload is
kept as raw Value here and parsed by the receiver.
Response
Player answers a prompt. action is PlayerAction for Rust; raw value
Directive
Log
Engine log entry broadcast to observers.
Snapshot
Engine snapshot broadcast to observers.
Fatal
Error
Engine rejects a response (stale prompt, wrong player, unknown action).
error is ProtocolError; recoverable unless the session is terminated.
RoomRelay
Out-of-band message tunneled through the relay (manual tabletop launch,
self-hosted-node control plane, heartbeats, …). The relay never
interprets the payload.
Implementations§
Source§impl StateEnvelope
impl StateEnvelope
pub fn for_agent_message(for_player: String, message: &AgentMessage) -> Self
Trait Implementations§
Source§impl Clone for StateEnvelope
impl Clone for StateEnvelope
Source§fn clone(&self) -> StateEnvelope
fn clone(&self) -> StateEnvelope
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more