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:
parent
c9c2e75091
commit
c7d7f0df55
2 changed files with 214 additions and 0 deletions
|
|
@ -200,6 +200,11 @@ pub mod wanted;
|
|||
/// merge, are in `swarm_wire::agent_status`.
|
||||
pub mod agent_status;
|
||||
|
||||
/// Opening the bucket each agent's subagent daemon publishes the run state of
|
||||
/// its subagents into: one key per subagent. The name, keys and value are
|
||||
/// `swarm_wire::subagent_status`; opening the bucket needs `kv`.
|
||||
pub mod subagent_status;
|
||||
|
||||
/// Opening the bucket agent icons are published into: one key per agent, with
|
||||
/// no hive in it, unlike [`agent_status`]. The name, media type and subject,
|
||||
/// and why the placement stays out of the key, are in `swarm_wire::agent_icon`.
|
||||
|
|
|
|||
20
swarm-queue-client/src/subagent_status.rs
Normal file
20
swarm-queue-client/src/subagent_status.rs
Normal 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
|
||||
}
|
||||
Loading…
Reference in a new issue