Commit 5d4d4f6
committed
feat(agent): add server→client AgentResponse enum
Adds the full server-emitted JSON event surface for the Voice Agent
WebSocket (16 typed variants plus an Unknown(serde_json::Value)
catch-all for forward compatibility).
Variants mirror AgentV1*Event in
api/specs/asyncapi/schemas/agent/schemas.agent.v1.yml:
- Welcome (request_id)
- SettingsApplied
- ConversationText (role, content, +languages/languages_hinted on
user-role messages with flux-general-multi)
- UserStartedSpeaking
- AgentThinking (content)
- FunctionCallRequest (functions[]: id, name, arguments, client_side,
thought_signature?)
- AgentStartedSpeaking (total/tts/ttt latency floats; experimental)
- AgentAudioDone
- Error / Warning (description, code)
- History (reuses HistoryMessage — same wire shape as
agent.context.messages[])
- PromptUpdated, SpeakUpdated, ThinkUpdated
- InjectionRefused (message)
- FunctionCallResponse (reuses the bidirectional
FunctionCallResponseMessage from messages.rs)
Wire dispatch follows the same #[serde(untagged)] + per-variant marker
enum pattern as ClientMessage. Unknown is the tail variant so any
unrecognized server message round-trips its raw JSON instead of
failing deserialization — matches the FluxResponse forward-compat
strategy.
Audio frames sent by the server are binary WebSocket frames and are
not part of this enum; they'll be delivered out-of-band by the
connection layer when that surface lands.
21 new round-trip serde tests, 125 passing across the agent module.1 parent 5ac6a2d commit 5d4d4f6
2 files changed
Lines changed: 769 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | | - | |
26 | | - | |
| 32 | + | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
| 41 | + | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
| |||
54 | 62 | | |
55 | 63 | | |
56 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
57 | 74 | | |
58 | 75 | | |
59 | 76 | | |
| |||
0 commit comments