refactor: rename manager-only annotations to privileged in Request enum

This commit is contained in:
damocles 2026-06-01 11:02:09 +02:00 committed by mara
commit 450efd5429

View file

@ -296,8 +296,8 @@ pub enum CancelLooseEndKind {
} }
/// Unified request enum for both agent and manager sockets. The agent's /// Unified request enum for both agent and manager sockets. The agent's
/// identity is the socket it arrived on. Manager-only variants are marked /// identity is the socket it arrived on. Privileged variants are marked
/// `*(manager only)*` — an agent socket returns `Err` for them server-side. /// `*(privileged)*` — an agent socket returns `Err` for them server-side.
/// ///
/// `AgentRequest` and `ManagerRequest` are type aliases for this enum; /// `AgentRequest` and `ManagerRequest` are type aliases for this enum;
/// existing callers continue to compile unchanged. /// existing callers continue to compile unchanged.
@ -428,57 +428,57 @@ pub enum Request {
/// `docs/conventions.md::Broker delivery + ack cycle`. /// `docs/conventions.md::Broker delivery + ack cycle`.
RequeueInflight, RequeueInflight,
// ---- manager socket only ------------------------------------------------ // ---- privileged (manager socket only for now) ---------------------------
/// *(manager only)* Initialise a brand-new agent's proposed config repo /// *(privileged)* Initialise a brand-new agent's proposed config repo
/// and queue an approval for the operator to review. /// and queue an approval for the operator to review.
RequestInitConfig { RequestInitConfig {
name: String, name: String,
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
description: Option<String>, description: Option<String>,
}, },
/// *(manager only)* Stop a sub-agent (graceful). /// *(privileged)* Stop a sub-agent (graceful).
Kill { name: String }, Kill { name: String },
/// *(manager only)* Start a previously-stopped sub-agent container. /// *(privileged)* Start a previously-stopped sub-agent container.
Start { name: String }, Start { name: String },
/// *(manager only)* Restart a sub-agent container (stop + start). /// *(privileged)* Restart a sub-agent container (stop + start).
Restart { name: String }, Restart { name: String },
/// *(manager only)* Rebuild a sub-agent against the current hyperhive /// *(privileged)* Rebuild a sub-agent against the current hyperhive
/// flake + agent.nix. No approval required. /// flake + agent.nix. No approval required.
Update { name: String }, Update { name: String },
/// *(manager only)* Submit a config commit for the operator to approve. /// *(privileged)* Submit a config commit for the operator to approve.
RequestApplyCommit { RequestApplyCommit {
agent: String, agent: String,
commit_ref: String, commit_ref: String,
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
description: Option<String>, description: Option<String>,
}, },
/// *(manager only)* Fetch recent journal lines for a sub-agent container. /// *(privileged)* Fetch recent journal lines for a sub-agent container.
GetLogs { GetLogs {
agent: String, agent: String,
#[serde(default)] #[serde(default)]
lines: Option<u32>, lines: Option<u32>,
}, },
/// *(manager only)* Queue an approval to run `nix flake update [inputs...]`. /// *(privileged)* Queue an approval to run `nix flake update [inputs...]`.
RequestUpdateMetaInputs { RequestUpdateMetaInputs {
#[serde(default)] #[serde(default)]
inputs: Vec<String>, inputs: Vec<String>,
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
description: Option<String>, description: Option<String>,
}, },
/// *(manager only)* Queue an approval to add a scheduled prompt. /// *(privileged)* Queue an approval to add a scheduled prompt.
RequestSchedulePrompt(SchedulePromptPayload), RequestSchedulePrompt(SchedulePromptPayload),
/// *(manager only)* Cancel a scheduled prompt. /// *(privileged)* Cancel a scheduled prompt.
CancelSchedule { CancelSchedule {
id: i64, id: i64,
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
targets: Option<Vec<String>>, targets: Option<Vec<String>>,
}, },
/// *(manager only)* List every schedule in the queue. /// *(privileged)* List every schedule in the queue.
ListSchedules, ListSchedules,
/// *(manager only)* Fire a scheduled prompt out of band immediately. /// *(privileged)* Fire a scheduled prompt out of band immediately.
FireScheduleNow { id: i64 }, FireScheduleNow { id: i64 },
/// *(manager only)* Edit an existing schedule's mutable fields. /// *(privileged)* Edit an existing schedule's mutable fields.
EditSchedule { EditSchedule {
id: i64, id: i64,
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
@ -497,12 +497,12 @@ pub enum Request {
} }
/// Backwards-compatible aliases. Both sockets now speak the unified `Request` /// Backwards-compatible aliases. Both sockets now speak the unified `Request`
/// / `Response` wire; the server-side privilege gate rejects manager-only /// / `Response` wire; the server-side privilege gate rejects privileged
/// variants on agent sockets with `Err { message: "privileged variant..." }`. /// variants on agent sockets with `Err { message: "privileged variant..." }`.
pub type AgentRequest = Request; pub type AgentRequest = Request;
pub type ManagerRequest = Request; pub type ManagerRequest = Request;
/// Unified response enum for both agent and manager sockets. Manager-only /// Unified response enum for both agent and manager sockets. Privileged
/// variants (`Logs`, `Schedules`) are never returned on agent sockets. /// variants (`Logs`, `Schedules`) are never returned on agent sockets.
/// ///
/// `AgentResponse` and `ManagerResponse` are type aliases for this enum. /// `AgentResponse` and `ManagerResponse` are type aliases for this enum.