Watch
0
0
Fork
You've already forked hyperhive
0

swarm-wire: take agent_status's wire types

This commit is contained in:
atlas 2026-10-18 12:17:46 +02:00 • committed by mara
commit 9222a051f5
10 changed files with 180 additions and 181 deletions

View file

@ -1,7 +1,7 @@
//! Swarm-wide view of what each agent last said about itself.
//!
//! Sibling of [`crate::status`], not a mode of it — see
//! `swarm_queue_client::agent_status`'s module doc for why the two buckets
//! `swarm_wire::agent_status`'s module doc for why the two buckets
//! stay separate. Everything about *how* a snapshot is read (queue is the
//! store, no cache, freshness derived at read time, rows come from the
//! roster so an empty bucket cannot render as "every agent is fine") is
@ -11,7 +11,7 @@
//! **The roster here is agent *names* only** ([`crate::auth::AuthBridge::list_agent_identities`]) —
//! it does not say which hive an agent lives on. That is not a gap this
//! module needs to close: a *reporting* agent's hive comes straight out of
//! its bucket key (`swarm_queue_client::agent_status::split_key`), and a
//! its bucket key (`swarm_wire::agent_status::split_key`), and a
//! *never-reported* agent's hive is unknowable regardless of what any
//! roster might claim, so [`AgentStatusRow::hive`] is `None` in exactly
//! that one case rather than a second lookup this module would have to
@ -42,7 +42,7 @@ pub struct AgentStatusRow {
pub age_seconds: Option<u64>,
/// The agent's status text + running flag, unopened. `None` exactly
/// when `freshness` is `NeverReported`, or when the stored bytes
/// failed to decode as [`swarm_queue_client::agent_status::AgentStatus`]
/// failed to decode as [`swarm_wire::agent_status::AgentStatus`]
/// (logged as a warning naming the agent).
pub snapshot: Option<serde_json::Value>,
/// The agent's open config PR, if any. Always `None` coming out of
@ -130,7 +130,7 @@ impl AgentStatusReader {
.await
.context("reading the agent-status bucket's key list")?
{
let Some((hive, agent)) = swarm_queue_client::agent_status::split_key(&key) else {
let Some((hive, agent)) = swarm_wire::agent_status::split_key(&key) else {
tracing::warn!(%key, "agent-status bucket key doesn't split into hive/agent, skipping");
continue;
};
@ -142,7 +142,7 @@ impl AgentStatusReader {
continue;
};
let payload = match serde_json::from_slice::<
swarm_queue_client::agent_status::AgentStatus,
swarm_wire::agent_status::AgentStatus,
>(&entry.value)
{
Ok(status) => serde_json::to_value(status).ok(),