swarm: the commands and skills an agent's message box offers
GET /api/agents/{name}/commands answers with the swarm's own commands, a table
in the controller, then the skills the agent's harness published to its key of
the agent-commands bucket. The published part is untrusted and cut down: plain
names only, no repeats, never a command's name, a capped list and one short line
per description. The agent credential may publish its own key. Nothing publishes
yet; the harness half and the swarm UI menu follow.
This commit is contained in:
parent
06c338ff40
commit
8f11a38d17
1 changed files with 389 additions and 7 deletions
18
swarm-queue-client/src/agent_commands.rs
Normal file
18
swarm-queue-client/src/agent_commands.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//! The connection side of the agent skill list KV bucket: opening it. The
|
||||
//! bucket's name, key and value are `swarm_wire::agent_commands`.
|
||||
|
||||
/// Open the bucket, creating it if nothing has yet. `history: 1`: the swarm
|
||||
/// wants each agent's current skills, not the ones it had before.
|
||||
#[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::agent_commands::BUCKET,
|
||||
"agent-commands",
|
||||
"The skills each agent has, as its harness last published them".to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
Loading…
Reference in a new issue