hivectl: add start/stop agent verbs, rename spawn to create

This commit is contained in:
damocles 2026-08-02 18:30:55 +02:00 committed by mara
commit 3421925442
7 changed files with 127 additions and 35 deletions

View file

@ -99,14 +99,26 @@ pub enum ReconcileDirection {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "cmd", rename_all = "snake_case")]
pub enum HostRequest {
/// Create and start a sub-agent container directly, bypassing the
/// approval queue. Privileged-context only. See
/// `docs/approvals.md::Approval kinds (wire shapes)`.
/// Create and start a brand-new sub-agent container directly (full
/// first-time provisioning: proposed/applied repos, state subvolume,
/// meta-flake sync, `nixos-container create`), bypassing the approval
/// queue. Privileged-context only. Exposed on the CLI as `hivectl
/// agent <name> create`. See `docs/approvals.md::Approval kinds
/// (wire shapes)`. Wire name kept as `Spawn` (unrenamed underneath
/// the CLI-verb rename — `hivectl agent <name> start` reuses the
/// existing scope-based [`HostRequest::Start`] below instead of a
/// new per-agent variant, see its doc comment).
Spawn { name: Ident },
/// Submit a spawn request for the operator to approve. See
/// Submit a first-creation request for the operator to approve. See
/// `docs/approvals.md::Approval kinds (wire shapes)` (`Spawn`).
/// Exposed on the CLI as `hivectl agent <name> request-create`.
RequestSpawn { name: Ident },
/// Stop a managed container (graceful).
/// Hard stop a managed container. Exposed on the CLI as `hivectl
/// agent <name> kill` — kept distinct from the new graceful-only
/// `hivectl agent <name> stop` (which reuses the scope-based
/// [`HostRequest::Stop`] below with `graceful: true`); `Kill`
/// escalates to a hard stop, `Stop` never does. Wire name kept as
/// `Kill`.
Kill { name: Ident },
/// Tear down a sub-agent container, optionally purging state.
/// See `docs/approvals.md::Destroy semantics`.