Watch
0
0
Fork
You've already forked hyperhive
0

swarmctl shares the create-agent, inference and permissions shapes with the controller

This commit is contained in:
atlas 2026-10-19 17:57:21 +02:00
commit 0831b85b73

View file

@ -92,6 +92,19 @@ pub enum Source {
Default,
}
impl Source {
/// The name as it is stored and served.
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::Swarm => "swarm",
Self::AgentNix => "agent_nix",
Self::LocalFile => "local_file",
Self::Default => "default",
}
}
}
/// The model and effort an agent runs on now, and where each comes from.
///
/// Part of the turn-state header the agent publishes on
@ -184,6 +197,20 @@ mod tests {
}
}
#[test]
fn every_source_is_stored_as_its_name() {
for source in [
Source::Swarm,
Source::AgentNix,
Source::LocalFile,
Source::Default,
] {
assert_eq!(
serde_json::to_string(&source).unwrap(),
format!("\"{}\"", source.as_str())
);
}
}
#[test]
fn an_unknown_effort_is_refused() {
for doc in [