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.
20 lines
746 B
Rust
20 lines
746 B
Rust
//! 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
|
|
}
|