Phase 5a: approval queue (request_apply_commit, pending/approve/deny)

This commit is contained in:
müde 2026-05-14 22:50:19 +02:00
parent 4a73340150
commit f12837fe32
7 changed files with 270 additions and 0 deletions

View file

@ -9,6 +9,7 @@ use std::sync::{Arc, Mutex};
use anyhow::{Context, Result};
use crate::agent_server::{self, AgentSocket};
use crate::approvals::Approvals;
use crate::broker::Broker;
const AGENT_RUNTIME_ROOT: &str = "/run/hyperhive/agents";
@ -16,6 +17,7 @@ const MANAGER_RUNTIME_ROOT: &str = "/run/hyperhive/manager";
pub struct Coordinator {
pub broker: Arc<Broker>,
pub approvals: Arc<Approvals>,
pub agent_flake: String,
agents: Mutex<HashMap<String, AgentSocket>>,
}
@ -23,8 +25,10 @@ pub struct Coordinator {
impl Coordinator {
pub fn open(db_path: &Path, agent_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,
agents: Mutex::new(HashMap::new()),
})