Skip to main content

roder_protocol/
agent_node.rs

1//! Agent-node protocol DTOs (roadmap phase 67, Stage 3).
2//!
3//! `node/status` lets any client ask which node is serving it and how the
4//! connection is authorized. Locally-served app-servers answer with
5//! `served: false`; agent-node servers fill the identity that is also
6//! injected into `initialize` metadata. Enrollment and revocation are
7//! deliberately CLI-only operations on the node host (they mutate the
8//! node's local trust store), not public app-server methods.
9
10use serde::{Deserialize, Serialize};
11
12#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
13#[serde(rename_all = "camelCase")]
14pub struct NodeIdentity {
15    pub node_id: String,
16    pub name: String,
17    /// SHA-256 fingerprint of the node certificate (hex).
18    pub fingerprint: String,
19    /// `mtls` or `pairing-token-enrolled` for the current connection.
20    #[serde(default, skip_serializing_if = "Option::is_none")]
21    pub auth_mode: Option<String>,
22    pub protocol_version: String,
23    #[serde(default, skip_serializing_if = "Option::is_none")]
24    pub workspace: Option<String>,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
28#[serde(rename_all = "camelCase")]
29pub struct NodeStatusResult {
30    /// True when this app-server is being served as a remote agent node.
31    pub served: bool,
32    #[serde(default, skip_serializing_if = "Option::is_none")]
33    pub node: Option<NodeIdentity>,
34}