swarm-controller: agent permissions and inference take the settings sub-state

This commit is contained in:
atlas 2026-11-30 14:31:22 +01:00 • committed by mara
commit 4a7df3f804

View file

@ -82,9 +82,10 @@ impl FromRef<AppState> for AgentReadersState {
}
}
/// What the agent settings handlers (schedules, limits) may reach of
/// [`AppState`]: the queue reader, and the wanted-state writer and hive list
/// that say which agents are live.
/// What the agent settings handlers (schedules, limits, permissions,
/// inference) may reach of [`AppState`]: the queue reader, the wanted-state
/// writer and hive list that say which agents are live, and what the agents
/// reported (login capabilities, inference in use).
///
/// Derived per request from [`AppState`] (`FromRef`), so each field is a clone
/// of the same `Arc` and nothing is held twice.
@ -93,6 +94,8 @@ pub(crate) struct AgentSettingsState {
pub(crate) status: Option<Arc<crate::status::StatusReader>>,
pub(crate) wanted: Option<Arc<crate::wanted::WantedWriter>>,
pub(crate) hives: Arc<Vec<crate::routes::hives::HiveEntry>>,
pub(crate) agent_login: Option<Arc<agent_login::Reported>>,
pub(crate) reported_inference: Option<Arc<inference::Reported>>,
}
impl FromRef<AppState> for AgentSettingsState {
@ -101,6 +104,8 @@ impl FromRef<AppState> for AgentSettingsState {
status: state.status.clone(),
wanted: state.wanted.clone(),
hives: Arc::clone(&state.hives),
agent_login: state.agent_login.clone(),
reported_inference: state.reported_inference.clone(),
}
}
}