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
//! Shared response-body types used by the CLI HTTP handlers.
//!
//! Why: the thin CLI handlers deserialize daemon API responses into typed
//! structs; centralising them keeps the handler files free of boilerplate
//! and avoids duplicate definitions.
//! What: `SessionRow` and `EventRow` mirror the shapes returned by
//! `GET /sessions` and `GET /events/poll`. `ProjectRow` (the `GET /projects`
//! shape) went away with #5994 — `tm project list` reads the persistent
//! registry through `DaemonClient` and its typed `Project` record instead.
//! Test: deserialization is exercised indirectly by the handler unit tests.
use serde::Deserialize;
/// One session row as returned by `GET /sessions`.
#[derive(Debug, Deserialize)]
pub(crate) struct SessionRow {
/// Session id — serde writes the `SessionId` newtype transparently, so the
/// wire value is the bare string `"<uuid>"` (#7805).
pub(crate) id: serde_json::Value,
/// Working directory.
pub(crate) workdir: String,
/// Lifecycle status string.
pub(crate) status: serde_json::Value,
/// Number of active delegations.
#[serde(default)]
pub(crate) active_delegations: u32,
}
/// One event row as returned by `GET /events`.
#[derive(Debug, Deserialize)]
pub(crate) struct EventRow {
/// Originating session id, in the same bare-string wire form (#7805).
pub(crate) session: serde_json::Value,
/// Claude Code wire event name.
pub(crate) event: String,
/// RFC3339 timestamp the daemon received the event.
pub(crate) at: String,
/// Raw event payload (shape varies per event).
#[serde(default)]
pub(crate) payload: serde_json::Value,
}