Watch
0
0
Fork
You've already forked hyperhive
0

move the builder and claude login wire contracts into swarm-wire

This commit is contained in:
atlas 2026-10-18 07:27:43 +02:00 • committed by mara
commit 0c3d128de1
23 changed files with 224 additions and 81 deletions

View file

@ -33,6 +33,8 @@ swarm-queue-client = { workspace = true, features = ["notices"] }
# credentials `swarm-agent-verify` checks a presented token against.
swarm-secret-client.workspace = true
swarm-agent-verify.workspace = true
# The builder and login subjects it grants.
swarm-wire.workspace = true
tokio.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true

View file

@ -281,11 +281,11 @@ impl Policy {
Permissions {
publish: vec![Self::inbox(client_id)],
subscribe: Some(vec![
swarm_queue_client::builder::SUBJECT.to_owned(),
swarm_queue_client::builder::ARCHETYPES_SUBJECT.to_owned(),
swarm_wire::builder::SUBJECT.to_owned(),
swarm_wire::builder::ARCHETYPES_SUBJECT.to_owned(),
Self::inbox(client_id),
]),
responses: Some(swarm_queue_client::builder::REPLY_DEADLINE),
responses: Some(swarm_wire::builder::REPLY_DEADLINE),
}
}
@ -296,10 +296,10 @@ impl Policy {
Permissions {
publish: vec![Self::inbox(client_id)],
subscribe: Some(vec![
swarm_queue_client::claude_login::SUBJECT.to_owned(),
swarm_wire::claude_login::SUBJECT.to_owned(),
Self::inbox(client_id),
]),
responses: Some(swarm_queue_client::claude_login::REPLY_DEADLINE),
responses: Some(swarm_wire::claude_login::REPLY_DEADLINE),
}
}
@ -661,11 +661,11 @@ impl Policy {
// back on this client's inbox, which it already subscribes to.
swarm_queue_client::review_classifier::SUBJECT.to_owned(),
// A build of an agent config, sent as a request the same way.
swarm_queue_client::builder::SUBJECT.to_owned(),
swarm_wire::builder::SUBJECT.to_owned(),
// An archetype evaluation, sent as a request the same way.
swarm_queue_client::builder::ARCHETYPES_SUBJECT.to_owned(),
swarm_wire::builder::ARCHETYPES_SUBJECT.to_owned(),
// An operator's claude login step, sent as a request the same way.
swarm_queue_client::claude_login::SUBJECT.to_owned(),
swarm_wire::claude_login::SUBJECT.to_owned(),
// The wanted-state buckets — one per hive, all created and written
// by this single client.
//
@ -1532,8 +1532,8 @@ mod tests {
#[test]
fn the_builder_hears_its_subject_and_inbox_only_and_answers_by_reply() {
use swarm_queue_client::builder::{ARCHETYPES_SUBJECT, REPLY_DEADLINE, SUBJECT};
use swarm_queue_client::client_inbox_prefix;
use swarm_wire::builder::{ARCHETYPES_SUBJECT, REPLY_DEADLINE, SUBJECT};
let p = policy()
.with_builders(vec![BUILDER.to_owned()])
@ -1562,7 +1562,7 @@ mod tests {
#[test]
fn only_the_reader_may_send_a_build() {
use swarm_queue_client::builder::{ARCHETYPES_SUBJECT, SUBJECT};
use swarm_wire::builder::{ARCHETYPES_SUBJECT, SUBJECT};
let p = with_classifier().with_builders(vec![BUILDER.to_owned()]);
let reader = p.permissions("swarm-controller").expect("the reader");
@ -1589,8 +1589,8 @@ mod tests {
#[test]
fn the_claude_login_minter_hears_its_subject_and_inbox_only_and_answers_by_reply() {
use swarm_queue_client::claude_login::{REPLY_DEADLINE, SUBJECT};
use swarm_queue_client::client_inbox_prefix;
use swarm_wire::claude_login::{REPLY_DEADLINE, SUBJECT};
let p = policy()
.with_claude_logins(vec![CLAUDE_LOGIN.to_owned()])
@ -1602,7 +1602,7 @@ mod tests {
for refused in [
">".to_owned(),
"$SWARM.>".to_owned(),
swarm_queue_client::builder::SUBJECT.to_owned(),
swarm_wire::builder::SUBJECT.to_owned(),
reply(&client_inbox_prefix("swarm-controller")),
] {
assert!(
@ -1618,7 +1618,7 @@ mod tests {
#[test]
fn only_the_reader_may_send_a_login_step() {
use swarm_queue_client::claude_login::SUBJECT;
use swarm_wire::claude_login::SUBJECT;
let p = with_classifier()
.with_builders(vec![BUILDER.to_owned()])