refactor(#1202): introduce HiveEnv + AgentPaths to reduce arg repetition
This commit is contained in:
parent
e7785b4948
commit
29c7f64bd3
8 changed files with 131 additions and 235 deletions
|
|
@ -77,9 +77,8 @@ pub async fn rebuild_agent(
|
|||
let agent_dir = coord
|
||||
.ensure_runtime(name)
|
||||
.with_context(|| format!("ensure_runtime {name}"))?;
|
||||
let applied_dir = Coordinator::agent_applied_dir(name);
|
||||
let claude_dir = Coordinator::agent_claude_dir(name);
|
||||
let notes_dir = Coordinator::agent_notes_dir(name);
|
||||
let hive = coord.hive_env();
|
||||
let paths = Coordinator::agent_paths(name, agent_dir);
|
||||
// Suppress crash_watch during the stop+start window inside
|
||||
// lifecycle::rebuild. Dashboard rebuilds already do this via
|
||||
// lifecycle_action; this catches the auto-update scan + any
|
||||
|
|
@ -87,18 +86,8 @@ pub async fn rebuild_agent(
|
|||
let guard = coord.transient_guard(name, crate::coordinator::TransientKind::Rebuilding);
|
||||
let result = lifecycle::rebuild(
|
||||
name,
|
||||
&coord.hyperhive_flake,
|
||||
&coord.nixpkgs_flake,
|
||||
&coord.nixpkgs_unstable_flake,
|
||||
&agent_dir,
|
||||
&applied_dir,
|
||||
&claude_dir,
|
||||
¬es_dir,
|
||||
coord.dashboard_port,
|
||||
&coord.operator_pronouns,
|
||||
&coord.context_window_tokens,
|
||||
&coord.agent_cpu_quota,
|
||||
&coord.agent_memory_max,
|
||||
&hive,
|
||||
&paths,
|
||||
&|step| coord.set_queue_step(queue_entry_id, step),
|
||||
)
|
||||
.await;
|
||||
|
|
@ -190,27 +179,9 @@ pub async fn ensure_root_agent(coord: &Arc<Coordinator>) -> Result<()> {
|
|||
}
|
||||
tracing::info!("manager container missing — spawning");
|
||||
let runtime = coord.ensure_runtime(MANAGER_NAME)?;
|
||||
let proposed = Coordinator::agent_proposed_dir(MANAGER_NAME);
|
||||
let applied = Coordinator::agent_applied_dir(MANAGER_NAME);
|
||||
let claude_dir = Coordinator::agent_claude_dir(MANAGER_NAME);
|
||||
let notes_dir = Coordinator::agent_notes_dir(MANAGER_NAME);
|
||||
lifecycle::spawn(
|
||||
MANAGER_NAME,
|
||||
&coord.hyperhive_flake,
|
||||
&coord.nixpkgs_flake,
|
||||
&coord.nixpkgs_unstable_flake,
|
||||
&runtime,
|
||||
&proposed,
|
||||
&applied,
|
||||
&claude_dir,
|
||||
¬es_dir,
|
||||
coord.dashboard_port,
|
||||
&coord.operator_pronouns,
|
||||
&coord.context_window_tokens,
|
||||
&coord.agent_cpu_quota,
|
||||
&coord.agent_memory_max,
|
||||
)
|
||||
.await?;
|
||||
let hive = coord.hive_env();
|
||||
let paths = Coordinator::agent_paths(MANAGER_NAME, runtime);
|
||||
lifecycle::spawn(MANAGER_NAME, &hive, &paths).await?;
|
||||
if let Some(rev) = current_rev {
|
||||
let _ = std::fs::write(rev_marker_path(MANAGER_NAME), &rev);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue