swarmctl shares the create-agent, inference and permissions shapes with the controller
This commit is contained in:
parent
249aab6642
commit
0831b85b73
1 changed files with 675 additions and 434 deletions
|
|
@ -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 [
|
||||
|
|
|
|||
Loading…
Reference in a new issue