Watch
0
0
Fork
You've already forked hyperhive
0

swarm: subagent-status KV bucket, the run state of each subagent

One key per subagent (<agent>.<subagent>) holding running/finished, since,
exit, model, effort and the publish time. The controller creates the bucket,
and the agent credential may publish its own keys. Nothing reads or writes
it yet; the daemon publisher and the controller list follow.
This commit is contained in:
iris 2026-11-15 14:39:37 +01:00 • committed by mara
commit c7d7f0df55

View file

@ -0,0 +1,20 @@
//! The connection side of the subagent status KV bucket: opening it. The
//! bucket's name, keys and value are `swarm_wire::subagent_status`.
/// Open the subagent status bucket, creating it if nothing has yet.
///
/// `history: 1`: a reader wants each subagent's current state, not every
/// state it has ever been in.
#[cfg(feature = "kv")]
pub async fn open_or_create(
client: &async_nats::Client,
) -> Result<async_nats::jetstream::kv::Store, crate::Error> {
let js = async_nats::jetstream::new(client.clone());
crate::kv::open_or_create(
&js,
swarm_wire::subagent_status::BUCKET,
"subagent-status",
"Whether each subagent is running, as its daemon last published".to_owned(),
)
.await
}