hive-ag3nt: identity module with hive-qualified label (#589 phase A, first PR)
First chunk of #589 v0 phase A: plumbing the hive-qualified 'name@hive' form through the per-agent surfaces that the harness itself owns. Broker from/to + dashboard rendering + container_view follow in subsequent PRs once damocles ships the HYPERHIVE_HIVE_DOMAIN env var in harness-base.nix. - new hive_ag3nt::identity module: label() / hive_domain() / qualified_label() / qualify(label). Reads HYPERHIVE_HIVE_DOMAIN (set by hive-c0re.nix module from hyperhive.domain) — when unset or empty, qualified_label degrades to just the short label so existing single-hive deployments are unchanged. Six unit tests cover the set / unset / empty / arbitrary-label paths. - prompt::render gains {qualified_label} substitution alongside the existing {label}. system.md template uses both: the agent intro now reads 'You are hyperhive agent iris (qualified: iris@darkest.space) in a multi-agent system. ... When you're talking to or about a peer on a different hive, use the qualified form (name@hive) so the operator + the manager can disambiguate'. Manager flavor gets the same treatment. - /api/state gains qualified_label: String. Always present, equals label when no domain is configured. - frontend setHeader takes the qualified_label, drives the browser tab title (so two tabs from different hives are distinguishable in the tab bar) while the glyphic #title stays short for the cinematic header. Gated on env var presence — no behaviour change for single-hive deployments. Pairs with damocles's upcoming harness-base.nix HYPERHIVE_HIVE_DOMAIN ship; safe to land in either order.
This commit is contained in:
parent
977bb16678
commit
f44bf19707
6 changed files with 178 additions and 5 deletions
|
|
@ -40,6 +40,13 @@ use crate::mcp::Flavor;
|
|||
/// fixture and production reads it once at harness startup via
|
||||
/// [`hive_sh4re::assets::prompt_template`] (`$HIVE_ASSETS_DIR/prompts/
|
||||
/// system.md`).
|
||||
///
|
||||
/// `{label}` and `{operator_pronouns}` are substituted in the filtered body.
|
||||
/// `{qualified_label}` (#589) is also substituted — it's `${label}@${hive}`
|
||||
/// in federated deployments, or the same as `{label}` when no hive domain is
|
||||
/// configured (single-hive deployments). Templates that always want the
|
||||
/// fully-qualified form can use `{qualified_label}` and stay correct in
|
||||
/// both shapes.
|
||||
#[must_use]
|
||||
pub fn render(template: &str, flavor: Flavor, label: &str, operator_pronouns: &str) -> String {
|
||||
let target = match flavor {
|
||||
|
|
@ -47,7 +54,9 @@ pub fn render(template: &str, flavor: Flavor, label: &str, operator_pronouns: &s
|
|||
Flavor::Manager => "manager",
|
||||
};
|
||||
let body = filter_role_blocks(template, target);
|
||||
let qualified = crate::identity::qualify(label);
|
||||
body.replace("{label}", label)
|
||||
.replace("{qualified_label}", &qualified)
|
||||
.replace("{operator_pronouns}", operator_pronouns)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue