Commit 5ac6a2d
committed
feat(agent): add remaining client→server messages and ClientMessage enum
Adds the seven non-Settings client-to-server messages
(UpdateSpeak, UpdateThink, UpdatePrompt, InjectUserMessage,
InjectAgentMessage, FunctionCallResponse, KeepAlive) plus a
unified ClientMessage envelope over all eight.
UpdateSpeak / UpdateThink reuse the one-or-many serde helpers from
InlineAgentConfig: a single provider serializes as a scalar object,
multiple as an array.
InjectAgentMessage carries an optional behavior field
(InjectAgentBehavior::{Default, Queue}) controlling how injection
interacts with an in-progress turn.
FunctionCallResponseMessage is bidirectional in the spec — `id` is
optional so the same struct can serve both client→server replies
(id required) and server→client reports (id may be omitted).
ClientMessage uses #[serde(untagged)] so each inner struct keeps
its own `type` field via a single-variant marker enum, allowing
standalone (de)serialization. The `large_enum_variant` lint is
allowed at the enum level: messages are constructed and immediately
sent (or deserialized and immediately matched), never stored, so
boxing would add a heap allocation per WebSocket send.
16 new round-trip serde tests, 104 passing in the agent module.
The server-to-client AgentResponse enum and the WebSocket
connection helpers follow in subsequent commits.1 parent 26374e2 commit 5ac6a2d
2 files changed
Lines changed: 747 additions & 3 deletions
0 commit comments