get_agent_meta: include hive_name + swarm_name in response (#710)
This commit is contained in:
parent
09c1abe5b4
commit
a91cf4493f
6 changed files with 69 additions and 1 deletions
|
|
@ -273,6 +273,7 @@ async fn dispatch(req: &AgentRequest, agent: &str, coord: &Arc<Coordinator>) ->
|
|||
"agent"
|
||||
}
|
||||
.to_owned();
|
||||
let (hive_name, swarm_name) = crate::container_view::hive_swarm_names();
|
||||
AgentResponse::AgentMeta {
|
||||
name: target.to_owned(),
|
||||
role,
|
||||
|
|
@ -280,6 +281,8 @@ async fn dispatch(req: &AgentRequest, agent: &str, coord: &Arc<Coordinator>) ->
|
|||
hyperhive_rev: crate::auto_update::current_flake_rev(&coord.hyperhive_flake),
|
||||
status_text,
|
||||
status_set_at,
|
||||
hive_name,
|
||||
swarm_name,
|
||||
}
|
||||
}
|
||||
AgentRequest::CancelLooseEnd { kind, id } => crate::questions::handle_cancel_loose_end(
|
||||
|
|
|
|||
|
|
@ -284,6 +284,26 @@ pub async fn read_agent_status_live(name: &str) -> (Option<String>, Option<i64>,
|
|||
(text, set_at, true)
|
||||
}
|
||||
|
||||
/// Host-side hive + swarm display names, read from the c0re service's
|
||||
/// own process env. The `hive-c0re.nix` module sets these from
|
||||
/// `services.hyperhive.{hiveName, swarmName}` (#701). The agent-side
|
||||
/// `hive-ag3nt::identity::{hive_name, swarm_name}` accessors read the
|
||||
/// same env vars after they're forwarded into each sub-agent's
|
||||
/// harness service environment by `meta::render_flake`; surfacing
|
||||
/// them here from c0re's own env keeps the manager + agent
|
||||
/// `GetAgentMeta` paths consistent without a round-trip to the
|
||||
/// target container (#710).
|
||||
///
|
||||
/// Returns `(hive_name, swarm_name)`. Each is `None` when the
|
||||
/// corresponding env var is unset or empty.
|
||||
#[must_use]
|
||||
pub fn hive_swarm_names() -> (Option<String>, Option<String>) {
|
||||
let read = |var: &str| -> Option<String> {
|
||||
std::env::var(var).ok().filter(|s| !s.is_empty())
|
||||
};
|
||||
(read("HYPERHIVE_HIVE_NAME"), read("HYPERHIVE_SWARM_NAME"))
|
||||
}
|
||||
|
||||
/// Read the agent's most recent completed turn from its turn-stats
|
||||
/// `SQLite`: the context-window size (prompt tokens) and the model name.
|
||||
/// Returns `None` when the file is absent or has no rows. Best-effort
|
||||
|
|
|
|||
|
|
@ -545,6 +545,7 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
|
|||
"agent"
|
||||
}
|
||||
.to_owned();
|
||||
let (hive_name, swarm_name) = crate::container_view::hive_swarm_names();
|
||||
ManagerResponse::AgentMeta {
|
||||
name: target.to_owned(),
|
||||
role,
|
||||
|
|
@ -552,6 +553,8 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
|
|||
hyperhive_rev: crate::auto_update::current_flake_rev(&coord.hyperhive_flake),
|
||||
status_text,
|
||||
status_set_at,
|
||||
hive_name,
|
||||
swarm_name,
|
||||
}
|
||||
}
|
||||
ManagerRequest::CancelLooseEnd { kind, id } => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue