Phase 5b: per-agent config flakes; approve validates + advances commit
This commit is contained in:
parent
22b65d35f3
commit
433c0d212e
6 changed files with 182 additions and 25 deletions
|
|
@ -14,22 +14,25 @@ use crate::broker::Broker;
|
|||
|
||||
const AGENT_RUNTIME_ROOT: &str = "/run/hyperhive/agents";
|
||||
const MANAGER_RUNTIME_ROOT: &str = "/run/hyperhive/manager";
|
||||
const AGENT_STATE_ROOT: &str = "/var/lib/hyperhive/agents";
|
||||
|
||||
pub struct Coordinator {
|
||||
pub broker: Arc<Broker>,
|
||||
pub approvals: Arc<Approvals>,
|
||||
pub agent_flake: String,
|
||||
/// URL of the hyperhive flake (no fragment). Inlined into per-agent
|
||||
/// `flake.nix` files as `inputs.hyperhive.url`.
|
||||
pub hyperhive_flake: String,
|
||||
agents: Mutex<HashMap<String, AgentSocket>>,
|
||||
}
|
||||
|
||||
impl Coordinator {
|
||||
pub fn open(db_path: &Path, agent_flake: String) -> Result<Self> {
|
||||
pub fn open(db_path: &Path, hyperhive_flake: String) -> Result<Self> {
|
||||
let broker = Broker::open(db_path).context("open broker")?;
|
||||
let approvals = Approvals::open(db_path).context("open approvals")?;
|
||||
Ok(Self {
|
||||
broker: Arc::new(broker),
|
||||
approvals: Arc::new(approvals),
|
||||
agent_flake,
|
||||
hyperhive_flake,
|
||||
agents: Mutex::new(HashMap::new()),
|
||||
})
|
||||
}
|
||||
|
|
@ -69,4 +72,8 @@ impl Coordinator {
|
|||
pub fn manager_socket_path() -> PathBuf {
|
||||
Self::manager_dir().join("mcp.sock")
|
||||
}
|
||||
|
||||
pub fn agent_config_dir(name: &str) -> PathBuf {
|
||||
PathBuf::from(format!("{AGENT_STATE_ROOT}/{name}/config"))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue