1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Codeoid wire protocol — Rust port of `src/protocol/types.ts` from the daemon.
//!
//! This crate is pure data: no I/O, no async, no Tokio. It defines serde-
//! compatible types for every message that flows between a Codeoid client and
//! the daemon's WebSocket server.
//!
//! # Design notes
//!
//! * **Discriminated unions.** TypeScript uses `type: "foo"` and `kind: "bar"`
//! as discriminants. In Rust these map to `#[serde(tag = "type")]` and
//! `#[serde(tag = "kind")]` tagged enums.
//! * **Forward compatibility.** The daemon's design explicitly says "frontends
//! ignore unknown kinds". We mirror that by using `#[serde(other)]` on a
//! trailing `Unknown` variant and `#[serde(flatten)]` on extensible metadata
//! maps. Adding new server-side message kinds never breaks an old Rust
//! client — they deserialize into [`DaemonMessage::Unknown`] and the TUI
//! logs + skips them.
//! * **Tool state as full replacement.** [`ToolState`] is a tagged enum where
//! each phase carries its own shape. When a [`SessionMessageDelta`] arrives
//! with `tool_state_update`, replace the whole [`ToolInfo::state`] — do not
//! merge fields.
//!
//! # Versioning
//!
//! [`PROTOCOL_VERSION`] is compared against the `protocol_version` field the
//! daemon sends on `auth.ok`. Mismatch is non-fatal (the daemon's additive
//! changes keep old clients working), but the client warns the user so they
//! can upgrade.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// Wire protocol version this crate speaks.
///
/// Compared against [`AuthOkMsg::protocol_version`] on connect. Bump this
/// alongside the daemon's `PROTOCOL_VERSION` on any breaking change.
pub const PROTOCOL_VERSION: u32 = 1;