feat(#2039): list matrix identities in get_agent_meta

This commit is contained in:
damocles 2026-06-27 11:51:34 +02:00 committed by mara
commit 5b442796ca
3 changed files with 59 additions and 0 deletions

View file

@ -845,6 +845,10 @@ pub enum Response {
hive_name: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
swarm_name: Option<String>,
/// Matrix identities this agent can act as (one per configured +
/// live account). Empty for agents with no matrix provisioning.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
matrix_accounts: Vec<MatrixIdentity>,
},
/// `GetLogs` result: journal lines for the requested container.
/// Returned on the manager socket only.
@ -918,6 +922,26 @@ pub struct AgentStatusRow {
pub parent: Option<String>,
}
/// One matrix identity an agent can act as, surfaced in `GetAgentMeta`'s
/// `matrix_accounts`. Field names match the daemon's `matrix-accounts.json`
/// snapshot (written by `hive-matrix-mcp`'s account registry) so hive-c0re
/// deserializes the snapshot straight into `Vec<MatrixIdentity>`; the
/// snapshot's `live` field is ignored here (only live accounts are listed).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MatrixIdentity {
/// Logical account name (the `account` arg on the matrix MCP tools).
pub name: String,
/// Matrix user id (`@user:server`). `None` if the session restored
/// without a known user id yet.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user_id: Option<String>,
/// Homeserver base URL this account is on.
pub homeserver: String,
/// Whether this is the primary account (selected when a matrix tool
/// call omits `account`).
pub is_primary: bool,
}
/// Serde default for the `running` field; keeps wire backwards-compat
/// with pre-running-field payloads. See
/// `docs/conventions.md::Agent metadata`.