refactor(#2285): drop coordinator 1:1 path accessors, callers use paths:: directly
This commit is contained in:
parent
187c364feb
commit
cfb84b420a
13 changed files with 38 additions and 56 deletions
|
|
@ -537,7 +537,7 @@ impl Coordinator {
|
|||
|
||||
/// Assemble the per-agent filesystem paths for `name`. `agent_dir`
|
||||
/// is the runtime directory (`/run/hyperhive/agents/<name>`), obtained
|
||||
/// from `Coordinator::agent_dir(name)` (pure path) or from
|
||||
/// from `crate::paths::agent_runtime_dir(name)` (pure path) or from
|
||||
/// `lifecycle::ensure_agent_runtime_dir(name)` when the dir must be
|
||||
/// created. All other paths are derived statically from `name`.
|
||||
#[must_use]
|
||||
|
|
@ -545,7 +545,7 @@ impl Coordinator {
|
|||
AgentPaths {
|
||||
agent_dir,
|
||||
proposed_dir: Self::agent_proposed_dir(name),
|
||||
applied_dir: Self::agent_applied_dir(name),
|
||||
applied_dir: crate::paths::applied_dir(name),
|
||||
claude_dir: Self::agent_claude_dir(name),
|
||||
notes_dir: Self::agent_notes_dir(name),
|
||||
}
|
||||
|
|
@ -1124,7 +1124,7 @@ impl Coordinator {
|
|||
// Idempotent: drop any existing listener so re-registration (e.g. on rebuild,
|
||||
// or after a hive-c0re restart cleared /run/hyperhive) gets a fresh socket.
|
||||
self.unregister_agent(name);
|
||||
let agent_dir = Self::agent_dir(name);
|
||||
let agent_dir = crate::paths::agent_runtime_dir(name);
|
||||
std::fs::create_dir_all(&agent_dir)
|
||||
.with_context(|| format!("create agent dir {}", agent_dir.display()))?;
|
||||
let socket_path = Self::socket_path(name);
|
||||
|
|
@ -1432,25 +1432,14 @@ impl Coordinator {
|
|||
errors
|
||||
}
|
||||
|
||||
pub fn agent_dir(name: &str) -> PathBuf {
|
||||
crate::paths::agent_runtime_dir(name)
|
||||
}
|
||||
|
||||
pub fn socket_path(name: &str) -> PathBuf {
|
||||
Self::agent_dir(name).join("mcp.sock")
|
||||
}
|
||||
|
||||
/// Ensure a runtime dir + (for sub-agents) per-agent socket exists.
|
||||
///
|
||||
/// Per-agent state root (parent of `config/`, future `prompts/`, etc.).
|
||||
pub fn agent_state_root(name: &str) -> PathBuf {
|
||||
crate::paths::agent_state_dir(name)
|
||||
crate::paths::agent_runtime_dir(name).join("mcp.sock")
|
||||
}
|
||||
|
||||
/// Manager-editable proposed config repo. Bind-mounted into the manager
|
||||
/// container as `/agents/<name>/config/`.
|
||||
pub fn agent_proposed_dir(name: &str) -> PathBuf {
|
||||
Self::agent_state_root(name).join("config")
|
||||
crate::paths::agent_state_dir(name).join("config")
|
||||
}
|
||||
|
||||
/// Per-agent Claude credentials dir. Bind-mounted RW into the agent
|
||||
|
|
@ -1458,14 +1447,14 @@ impl Coordinator {
|
|||
/// destroy/recreate. Each agent owns its own token lineage — sharing
|
||||
/// would break on the first refresh-token rotation.
|
||||
pub fn agent_claude_dir(name: &str) -> PathBuf {
|
||||
Self::agent_state_root(name).join("claude")
|
||||
crate::paths::agent_state_dir(name).join("claude")
|
||||
}
|
||||
|
||||
/// Per-agent durable knowledge dir. Bind-mounted RW into the agent
|
||||
/// container at `/agents/{name}/state`. Survives destroy/recreate.
|
||||
/// Agent-visible — claude is told to write long-lived notes here.
|
||||
pub fn agent_notes_dir(name: &str) -> PathBuf {
|
||||
Self::agent_state_root(name).join("state")
|
||||
crate::paths::agent_state_dir(name).join("state")
|
||||
}
|
||||
|
||||
/// Per-agent harness-internal state dir. Bind-mounted RW into the
|
||||
|
|
@ -1475,12 +1464,7 @@ impl Coordinator {
|
|||
/// from the agent-visible `state/` so claude's "my notes" view is
|
||||
/// uncluttered and the host vacuum has a clean sweep root.
|
||||
pub fn agent_harness_dir(name: &str) -> PathBuf {
|
||||
Self::agent_state_root(name).join("harness")
|
||||
}
|
||||
|
||||
/// Authoritative applied config repo. Hive-c0re-only.
|
||||
pub fn agent_applied_dir(name: &str) -> PathBuf {
|
||||
crate::paths::applied_dir(name)
|
||||
crate::paths::agent_state_dir(name).join("harness")
|
||||
}
|
||||
|
||||
/// Enumerate names that have a persistent state dir under
|
||||
|
|
@ -1514,7 +1498,7 @@ impl Coordinator {
|
|||
.into_iter()
|
||||
.filter(|n| {
|
||||
Self::agent_proposed_dir(n).join(".git").exists()
|
||||
&& !Self::agent_applied_dir(n).join(".git").exists()
|
||||
&& !crate::paths::applied_dir(n).join(".git").exists()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue