swarmctl shares the create-agent, inference and permissions shapes with the controller
This commit is contained in:
parent
249aab6642
commit
0831b85b73
26 changed files with 675 additions and 434 deletions
|
|
@ -15,6 +15,8 @@ use axum::extract::State;
|
|||
use hive_types::Permission;
|
||||
use problem_details::ProblemDetails;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use swarm_controller_api::inference::InferenceSettings;
|
||||
use swarm_controller_api::limits::Caps;
|
||||
use swarm_queue_client::archetypes::{ArchetypeMeta, BUILTIN_SOURCE, SourceRecord};
|
||||
use swarm_wire::builder::{
|
||||
ARCHETYPES_DEADLINE, ARCHETYPES_SUBJECT, ArchetypesReply, EvalArchetypes,
|
||||
|
|
@ -39,9 +41,9 @@ struct DeclaredMeta {
|
|||
#[serde(default)]
|
||||
permissions: Option<Vec<Permission>>,
|
||||
#[serde(default)]
|
||||
limits: Option<agent_limits::Caps>,
|
||||
limits: Option<Caps>,
|
||||
#[serde(default)]
|
||||
inference: Option<inference::InferenceSettings>,
|
||||
inference: Option<InferenceSettings>,
|
||||
}
|
||||
|
||||
/// `meta` as stored, or why a create would refuse it.
|
||||
|
|
@ -68,12 +70,13 @@ fn check(name: &str, meta: serde_json::Value) -> Result<ArchetypeMeta, String> {
|
|||
permissions,
|
||||
limits: declared
|
||||
.limits
|
||||
.map(agent_limits::Caps::into_stored)
|
||||
.as_ref()
|
||||
.map(agent_limits::into_stored)
|
||||
.transpose()
|
||||
.map_err(|e| format!("limits: {e}"))?,
|
||||
inference: declared
|
||||
.inference
|
||||
.map(inference::InferenceSettings::into_stored)
|
||||
.map(inference::into_stored)
|
||||
.transpose()
|
||||
.map_err(|e| format!("inference: {e}"))?,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue