manager: same lifecycle as agents; auto-spawn on hive-c0re start
This commit is contained in:
parent
d81a845dbe
commit
f99ed3fe7a
8 changed files with 168 additions and 65 deletions
|
|
@ -118,6 +118,21 @@ impl Coordinator {
|
|||
Self::manager_dir().join("mcp.sock")
|
||||
}
|
||||
|
||||
/// Ensure a runtime dir + (for sub-agents) per-agent socket exists. For
|
||||
/// the manager, `manager_server::start` owns the socket — just return
|
||||
/// the dir. For sub-agents this is `register_agent` (creates a fresh
|
||||
/// listener bound to `socket_path(name)`). Source directory of the
|
||||
/// `/run/hive/mcp.sock` bind that ends up in `set_nspawn_flags`.
|
||||
pub fn ensure_runtime(&self, name: &str) -> Result<PathBuf> {
|
||||
if name == crate::lifecycle::MANAGER_NAME {
|
||||
let dir = Self::manager_dir();
|
||||
std::fs::create_dir_all(&dir)
|
||||
.with_context(|| format!("create manager dir {}", dir.display()))?;
|
||||
return Ok(dir);
|
||||
}
|
||||
self.register_agent(name)
|
||||
}
|
||||
|
||||
/// Per-agent state root (parent of `config/`, future `prompts/`, etc.).
|
||||
pub fn agent_state_root(name: &str) -> PathBuf {
|
||||
PathBuf::from(format!("{AGENT_STATE_ROOT}/{name}"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue