phase 8 step 2: approval-gated spawn + dashboard spinner
This commit is contained in:
parent
a42fdb3a5c
commit
c59fa8541c
10 changed files with 382 additions and 90 deletions
|
|
@ -12,8 +12,16 @@ use serde::{Deserialize, Serialize};
|
|||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(tag = "cmd", rename_all = "snake_case")]
|
||||
pub enum HostRequest {
|
||||
/// Create and start a sub-agent container `hive-agent-<name>`.
|
||||
/// Create and start a sub-agent container directly (no approval). Use
|
||||
/// this from privileged contexts (operator on the host); it bypasses the
|
||||
/// approval queue intentionally so test scripts and one-off recoveries
|
||||
/// don't need a separate approve step.
|
||||
Spawn { name: String },
|
||||
/// Submit a spawn request for the user to approve. On approval the host
|
||||
/// creates and starts the container. Mirrors the manager's
|
||||
/// `RequestSpawn` — exposed on the admin socket so the dashboard and CLI
|
||||
/// can also queue spawns through the approval flow.
|
||||
RequestSpawn { name: String },
|
||||
/// Stop a managed container (graceful).
|
||||
Kill { name: String },
|
||||
/// Tear down a sub-agent container: stop + remove + drop the systemd
|
||||
|
|
@ -48,6 +56,9 @@ pub struct HostResponse {
|
|||
pub struct Approval {
|
||||
pub id: i64,
|
||||
pub agent: String,
|
||||
#[serde(default)]
|
||||
pub kind: ApprovalKind,
|
||||
/// For `ApplyCommit`: the git sha to apply. For `Spawn`: empty.
|
||||
pub commit_ref: String,
|
||||
pub requested_at: i64,
|
||||
pub status: ApprovalStatus,
|
||||
|
|
@ -57,6 +68,17 @@ pub struct Approval {
|
|||
pub note: Option<String>,
|
||||
}
|
||||
|
||||
/// What action the approval, when granted, will trigger.
|
||||
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ApprovalKind {
|
||||
/// Apply a manager-proposed config commit (existing flow).
|
||||
#[default]
|
||||
ApplyCommit,
|
||||
/// Create + start a new sub-agent container with the given name.
|
||||
Spawn,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ApprovalStatus {
|
||||
|
|
@ -181,8 +203,10 @@ pub enum ManagerRequest {
|
|||
body: String,
|
||||
},
|
||||
Recv,
|
||||
/// Spawn a sub-agent. Phase 5 will gate this on user approval.
|
||||
Spawn {
|
||||
/// Submit a spawn request for the user to approve. On approval the host
|
||||
/// creates and starts the container. Brand-new agent names only — if an
|
||||
/// agent of the same name already exists, the approval will fail.
|
||||
RequestSpawn {
|
||||
name: String,
|
||||
},
|
||||
/// Stop a sub-agent (graceful).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue