Watch
0
0
Fork
You've already forked hyperhive
0

hive-agent: keep an own /knowledge clone current from the swarm knowledge event

This commit is contained in:
damocles 2026-11-22 17:09:48 +01:00 • committed by mara
commit 989d1d578c

View file

@ -186,6 +186,11 @@ impl Policy {
format!("{}.>", swarm_queue_client::agent_inbox_prefix(agent)),
swarm_queue_client::agent_input_subject(agent),
swarm_queue_client::agent_control_subject(agent),
// The knowledge event: the agent pulls its own clone of the
// shared repo when it hears the repo moved. One empty event
// for every subscriber, so no per-agent subject; the agent
// cannot publish it (nothing here grants that).
swarm_queue_client::KNOWLEDGE_SUBJECT.to_owned(),
]),
// The controller sends a control command as a request, and the
// harness answers it. `allow_responses` lets it reply to that one
@ -1577,7 +1582,7 @@ mod tests {
}
#[test]
fn an_agent_token_may_subscribe_to_its_own_inbox_input_and_control_only() {
fn an_agent_token_may_subscribe_to_its_own_inbox_input_control_and_the_knowledge_event_only() {
use swarm_queue_client::{agent_control_subject, agent_inbox_prefix, agent_input_subject};
let p = policy()
@ -1587,6 +1592,14 @@ mod tests {
assert!(may_subscribe(&atlas, &reply(&agent_inbox_prefix("atlas"))));
assert!(may_subscribe(&atlas, &agent_input_subject("atlas")));
assert!(may_subscribe(&atlas, &agent_control_subject("atlas")));
assert!(may_subscribe(&atlas, swarm_queue_client::KNOWLEDGE_SUBJECT));
// Hearing the event is all an agent gets; publishing it is the
// controller's alone.
assert!(
!atlas
.publish
.contains(&swarm_queue_client::KNOWLEDGE_SUBJECT.to_owned())
);
for refused in [
">".to_owned(),
"$SWARM.term.>".to_owned(),