harness: remove deprecated manager-side request_spawn surface (closes #442)

This commit is contained in:
damocles 2026-05-27 18:58:04 +02:00
commit dca62fda40
8 changed files with 56 additions and 124 deletions

View file

@ -36,8 +36,8 @@ enum Cmd {
},
/// Run the manager MCP server on stdio. Spawned by claude via
/// `--mcp-config`; same shape as `hive-ag3nt mcp` but with the
/// manager tool surface (`request_spawn`, `kill`, `start`, `restart`,
/// `request_apply_commit`, `ask`, `answer`, `remind`).
/// manager tool surface (`request_init_config`, `request_apply_commit`,
/// `kill`, `start`, `restart`, `ask`, `answer`, `remind`, …).
Mcp,
}

View file

@ -10,8 +10,8 @@
//!
//! Two server flavors:
//! - `AgentServer` — sub-agent tools (`send`, `recv`).
//! - `ManagerServer` — agent tools + lifecycle (`request_spawn`, `kill`,
//! `request_apply_commit`).
//! - `ManagerServer` — agent tools + lifecycle (`kill`,
//! `request_init_config`, `request_apply_commit`).
//!
//! Both go through the same `run_tool_envelope` helper so logging + status
//! line stay uniform.
@ -792,26 +792,16 @@ pub async fn serve_manager_stdio(socket: PathBuf) -> Result<()> {
pub struct RequestInitConfigArgs {
/// New sub-agent name (≤9 chars). Queues an `InitConfig` approval; on
/// approval hive-c0re seeds the proposed config repo at
/// `/agents/<name>/config/agent.nix` with the default template.
/// After the approval the manager can edit and commit the config before
/// calling `request_spawn`.
/// `/agents/<name>/config/agent.nix` with the default template. After
/// the approval the manager edits + commits the config and calls
/// `request_apply_commit` to pin the customised sha for the container's
/// first build.
pub name: String,
/// Optional description shown on the dashboard approval card.
#[serde(default)]
pub description: Option<String>,
}
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
pub struct RequestSpawnArgs {
/// New sub-agent name (≤9 chars). Queues a Spawn approval; the
/// operator approves on the dashboard before the container is created.
pub name: String,
/// Optional description shown on the dashboard approval card so the
/// operator knows what the new agent is for without a separate message.
#[serde(default)]
pub description: Option<String>,
}
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
pub struct KillArgs {
/// Sub-agent name (without the `h-` container prefix).
@ -1121,8 +1111,9 @@ impl ManagerServer {
repo and queue an InitConfig approval. On operator approval hive-c0re seeds \
`/agents/<name>/config/agent.nix` with the default template so the manager can \
customise it before spawning. After the ConfigReady helper event arrives, edit \
agent.nix, commit the changes, then call `request_spawn`. Fails if a config repo \
for this name already exists (use `request_apply_commit` to update an existing agent)."
agent.nix, commit the changes, then call `request_apply_commit` with the commit \
sha that's what creates the container. Fails if a config repo for this name \
already exists (use `request_apply_commit` directly to update an existing agent)."
)]
async fn request_init_config(
&self,
@ -1149,34 +1140,6 @@ impl ManagerServer {
.await
}
#[tool(
description = "Step 2 of 2 for creating a new agent: queue a Spawn approval after \
the config has been initialised and customised via `request_init_config`. Requires \
a prior approved InitConfig so the manager can review and edit agent.nix first. \
Fails if no proposed config repo exists for the given name."
)]
async fn request_spawn(&self, Parameters(args): Parameters<RequestSpawnArgs>) -> String {
let log = format!("{args:?}");
let name = args.name.clone();
run_tool_envelope("request_spawn", log, async move {
let (resp, retries) = self
.dispatch(hive_sh4re::ManagerRequest::RequestSpawn {
name: args.name,
description: args.description,
})
.await;
annotate_retries(
format_ack(
resp,
"request_spawn",
format!("spawn approval queued for {name}"),
),
retries,
)
})
.await
}
#[tool(
description = "Stop a sub-agent container (graceful). The state dir is kept; \
recreating reuses prior config + Claude credentials. No approval required."
@ -1711,10 +1674,12 @@ impl ManagerServer {
#[tool_handler(
instructions = "You are the hyperhive manager (hm1nd). You coordinate sub-agents and \
relay between them and the operator. Use `send` to talk to agents/operator, `recv` \
to drain your inbox. Privileged: `request_init_config` + `request_spawn` (two-step \
new agent creation - init config first, customise agent.nix, then spawn, both \
gated on operator approval), `kill` (graceful stop), `request_apply_commit` (config change for \
any agent including yourself), `ask` (structured question to the operator or a \
to drain your inbox. Privileged: `request_init_config` (step 1 of new-agent \
creation seeds the proposed config repo so you can customise agent.nix; \
operator-approved), `kill` (graceful stop), `request_apply_commit` (config \
change for any agent including yourself also doubles as step 2 of new-agent \
creation: the first ApplyCommit on a freshly-init'd config creates the \
container), `ask` (structured question to the operator or a \
sub-agent non-blocking, answer arrives later as a `question_answered` event), \
`answer` (respond to a `question_asked` event directed at you), \
`get_loose_ends` (hive-wide loose ends pending approvals + unanswered \
@ -1771,7 +1736,6 @@ pub fn allowed_mcp_tools(flavor: Flavor) -> Vec<String> {
"send",
"recv",
"request_init_config",
"request_spawn",
"kill",
"start",
"restart",