get_agent_meta: include hive_name + swarm_name in response (#710)

This commit is contained in:
damocles 2026-05-31 12:45:10 +02:00 committed by Mara
commit a91cf4493f
6 changed files with 69 additions and 1 deletions

View file

@ -39,7 +39,7 @@ Tools (hyperhive surface):
<!-- /role:manager -->
- `mcp__hyperhive__remind(message, delay_seconds? | at_unix_timestamp?, file_path?)` — schedule a message to land in your *own* inbox at a future time (sender shows as `reminder`). Set exactly one of `delay_seconds` (relative) or `at_unix_timestamp` (absolute). Use for self-paced follow-ups instead of blocking a whole turn on a long `recv` wait. A large `message` auto-spills to a file under `/agents/{label}/state/reminders/`; pass `file_path` to point at one yourself. Each agent's pending-reminder count is capped (default 50) — the tool will error if the cap is already reached.
- `mcp__hyperhive__set_status(text)` — set a free-text status visible on the operator dashboard. **Call this at the start of every task** to say what you're working on (e.g. `"processing matrix messages"`, `"fixing #319 model priority"`, `"idle"`). Single line, ≤200 chars — the dashboard renders this as a short chip, so longer multi-line text is rejected. Pass an empty string to clear. Persists across harness restarts.
- `mcp__hyperhive__get_agent_meta(name?)` — fetch identity + status metadata for an agent: canonical `name`, `role` (`agent` / `manager`), current `hyperhive_rev`, plus self-reported `status` text (set via `set_status`) and how long ago it was set. Pass `name` to query a peer (e.g. check whether iris is idle before pinging them). Omit `name` to get your own trustworthy identity stamp — useful for state files, commit messages, cross-agent attribution that won't drift across renames or session-continue boundaries where the system-prompt label could be stale.
- `mcp__hyperhive__get_agent_meta(name?)` — fetch identity + status metadata for an agent: canonical `name`, `role` (`agent` / `manager`), current `hyperhive_rev`, plus self-reported `status` text (set via `set_status`) and how long ago it was set. Also returns the hive + swarm display names (`hive_name`, `swarm_name`) when the operator has configured `services.hyperhive.{hiveName, swarmName}`; both lines omitted when unset. Pass `name` to query a peer (e.g. check whether iris is idle before pinging them). Omit `name` to get your own trustworthy identity stamp — useful for state files, commit messages, cross-agent attribution that won't drift across renames or session-continue boundaries where the system-prompt label could be stale.
<!-- role:agent -->
- `mcp__hyperhive__request_next_turn()` — ask the harness to start another turn immediately after this one ends, even if the inbox is empty. Use for multi-turn tasks (long builds, sequential steps) where you want to continue without waiting for an external message. The next turn starts with `from: "self"` and `body: "continue"`. No-op if new inbox messages arrive before this turn ends (the harness already loops immediately on pending messages). No args.

View file

@ -59,6 +59,8 @@ pub enum SocketReply {
hyperhive_rev: Option<String>,
status_text: Option<String>,
status_set_at: Option<i64>,
hive_name: Option<String>,
swarm_name: Option<String>,
},
}
@ -83,6 +85,8 @@ impl From<hive_sh4re::AgentResponse> for SocketReply {
hyperhive_rev,
status_text,
status_set_at,
hive_name,
swarm_name,
} => Self::AgentMeta {
name,
role,
@ -90,6 +94,8 @@ impl From<hive_sh4re::AgentResponse> for SocketReply {
hyperhive_rev,
status_text,
status_set_at,
hive_name,
swarm_name,
},
}
}
@ -118,6 +124,8 @@ impl From<hive_sh4re::ManagerResponse> for SocketReply {
hyperhive_rev,
status_text,
status_set_at,
hive_name,
swarm_name,
} => Self::AgentMeta {
name,
role,
@ -125,6 +133,8 @@ impl From<hive_sh4re::ManagerResponse> for SocketReply {
hyperhive_rev,
status_text,
status_set_at,
hive_name,
swarm_name,
},
}
}
@ -298,11 +308,23 @@ pub fn format_agent_meta(resp: Result<SocketReply, anyhow::Error>) -> String {
hyperhive_rev,
status_text,
status_set_at,
hive_name,
swarm_name,
}) => {
let rev = hyperhive_rev.as_deref().unwrap_or("<unknown>");
let run = if running { "yes" } else { "no" };
let mut out =
format!("name: {name}\nrole: {role}\nhyperhive_rev: {rev}\nrunning: {run}");
// #710: surface hive + swarm display names only when set,
// so single-hive deployments don't see noisy `<none>` lines.
if let Some(hn) = hive_name.as_deref() {
use std::fmt::Write as _;
let _ = write!(out, "\nhive_name: {hn}");
}
if let Some(sn) = swarm_name.as_deref() {
use std::fmt::Write as _;
let _ = write!(out, "\nswarm_name: {sn}");
}
match status_text {
None => out.push_str("\nstatus: <none>"),
Some(s) => {