trusty-mpm 1.8.2

trusty-mpm: unified multi-agent orchestration platform (core, daemon, CLI, TUI, Telegram)
//! 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,
}