subagent: add status tool, cut docs down to operator-facing + no cli flags

This commit is contained in:
damocles 2026-09-09 19:02:27 +02:00
commit c2fb3c6e3e
7 changed files with 136 additions and 195 deletions

View file

@ -235,6 +235,30 @@ fn spawn_and_track(
Ok(format!("subagent `{name}` started"))
}
/// Report whether `name` is currently running — a zero-cost check that
/// never launches a process, unlike `continue`. Distinguishes three
/// states: running, idle (a session exists but nothing is in flight), and
/// no such session at all.
///
/// # Errors
///
/// An invalid name, or no session — running or on disk — under `name`.
pub fn status(state: &State, name: &str) -> anyhow::Result<String> {
validate_name(name)?;
if state.is_running(name) {
return Ok(format!("subagent `{name}` is running"));
}
let config = build_config(name, None, None);
let store = build_store(&config)?;
if store.find_by_title(name).is_some() {
Ok(format!(
"subagent `{name}` is idle — its last turn finished; `continue` to give it another"
))
} else {
anyhow::bail!("no subagent named `{name}` exists — `start` creates one")
}
}
/// Signal `name`'s running process — `force` picks SIGKILL over SIGINT (see
/// `hive_claude::Cancel::cancel`). Refuses a name with nothing running:
/// there's no queued/pending state to cancel pre-emptively any more (see