harness: surface hive + swarm display names to agents (#701)

This commit is contained in:
damocles 2026-05-31 11:35:47 +02:00 committed by Mara
commit c41bf1b562
5 changed files with 239 additions and 16 deletions

View file

@ -48,7 +48,47 @@ in
`matrix.''${services.hyperhive.domain}` when `serverName` is
null). No default subsystems that opt to require it assert
non-null in their own config and fail eval with a helpful
message if it's missing.
message if it's missing. Exposed to agents as
`HYPERHIVE_HIVE_DOMAIN`; consumed by
`hive-ag3nt::identity::hive_domain()` for `<name>@<domain>`
qualified labels (#589).
'';
};
# Display-name identities for the swarm + hive — distinct from the
# DNS domain above, which is the machine-readable address. The
# display names are how humans address the constellation in
# conversation (`pr1ma`, `constellat1on`); the DNS subdomain may
# carry the hive name as its leftmost label by convention but the
# convention isn't machine-readable. Both nullable + default null
# so existing deploys evaluate unchanged (#701).
options.services.hyperhive.hiveName = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "pr1ma";
description = ''
Human-readable name of this single-host hive instance.
Distinct from `services.hyperhive.domain` (the machine-
addressable DNS name): the domain may carry the hive name as
its leftmost label by convention, but this option is the
canonical readable identity. Exposed to agents as
`HYPERHIVE_HIVE_NAME`; surfaced in the dashboard chrome and
per-agent system prompt when set. Null falls back to the
pre-#701 behaviour (chrome shows the domain, prompt doesn't
mention a hive name).
'';
};
options.services.hyperhive.swarmName = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "constellat1on";
description = ''
Human-readable name of the wider swarm this hive belongs to.
Hives at different DNS domains can share a swarm name when
they federate together (#589). Exposed to agents as
`HYPERHIVE_SWARM_NAME`; surfaced in the dashboard chrome and
per-agent system prompt when set.
'';
};
@ -248,6 +288,25 @@ in
# `forge.rs` reads the avatar PNGs from here on startup.
HIVE_ASSETS_DIR = "${cfg.assets}/share/hyperhive";
}
// lib.optionalAttrs (config.services.hyperhive.domain != null) {
# Canonical hive DNS domain — surfaced to identity.rs as
# HYPERHIVE_HIVE_DOMAIN. meta.rs forwards the same env var
# into every sub-agent's harness service env so they all see
# a consistent qualified label (#589 + #701).
HYPERHIVE_HIVE_DOMAIN = config.services.hyperhive.domain;
}
// lib.optionalAttrs (config.services.hyperhive.hiveName != null) {
# Display name of this hive instance (#701). meta.rs
# forwards into sub-agent harness env so identity.rs can
# expose hive_name() to claude.
HYPERHIVE_HIVE_NAME = config.services.hyperhive.hiveName;
}
// lib.optionalAttrs (config.services.hyperhive.swarmName != null) {
# Display name of the wider swarm this hive belongs to (#701).
# meta.rs forwards into sub-agent harness env so identity.rs
# can expose swarm_name() to claude.
HYPERHIVE_SWARM_NAME = config.services.hyperhive.swarmName;
}
// lib.optionalAttrs config.services.hyperhive.forge.enable {
# Agents poll this URL for Forgejo notifications. Derived from
# services.hyperhive.forge.{domain,httpPort} so it tracks forge config changes.