rename(162): drop HIVE_PORT fallback; sweep remaining hm1nd in docs

This commit is contained in:
damocles 2026-06-01 17:35:19 +02:00 committed by mara
commit 008609d0e7
7 changed files with 26 additions and 31 deletions

View file

@ -47,7 +47,7 @@ viewers see the tree repaint without polling
(`ContainerView.parent` is sourced from `topology.json`). (`ContainerView.parent` is sourced from `topology.json`).
**Today's caveat:** the move is purely a JSON edit. Only the **Today's caveat:** the move is purely a JSON edit. Only the
top-level manager (`hm1nd`) gets `/var/lib/hyperhive/agents` top-level manager (`root`) gets `/var/lib/hyperhive/agents`
bind-mounted at `/agents` in its container, so sub-agents don't yet bind-mounted at `/agents` in its container, so sub-agents don't yet
see their would-be children's state. Once sub-manager bind mounts see their would-be children's state. Once sub-manager bind mounts
land alongside cap enforcement, `set_parent` grows a companion land alongside cap enforcement, `set_parent` grows a companion
@ -105,12 +105,12 @@ which axis the post-milestone version reads each special-case along:
### A — naming + bootstrap ### A — naming + bootstrap
- `MANAGER_AGENT = "manager"` (broker recipient name) and - `MANAGER_AGENT = "manager"` (broker recipient name) and
`MANAGER_NAME = "hm1nd"` (container name). ~28 grep hits across `MANAGER_NAME = "root"` (container name). ~28 grep hits across
`hive-c0re/src/`. **Just a name**the rename plan is `manager` `hive-c0re/src/`. **Just a name**renamed from `hm1nd` to `root`
`root`, executed via the one-shot migration script in via the one-shot migration script in `migrate.rs` (idempotent,
`migrate.rs` (idempotent, marker-guarded). marker-guarded).
- `auto_update::ensure_manager` runs at hive-c0re boot and spawns - `auto_update::ensure_manager` runs at hive-c0re boot and spawns
`hm1nd` if missing. Becomes "ensure the root agent exists" once any `root` if missing. Becomes "ensure the root agent exists" once any
agent can be at the root. **Topology**: root has no parent, so agent can be at the root. **Topology**: root has no parent, so
hive-c0re itself owns its lifecycle (no parent to delegate to). hive-c0re itself owns its lifecycle (no parent to delegate to).
@ -235,12 +235,9 @@ repos they're working on.
`nixosConfigurations.manager` must build standalone (without the `nixosConfigurations.manager` must build standalone (without the
meta-flake's per-agent flake.nix wrapper). For the manager unit meta-flake's per-agent flake.nix wrapper). For the manager unit
that means hardcoded `HIVE_PORT` / `HIVE_LABEL` env values: that means a hardcoded `HIVE_LABEL` env value:
- `HIVE_PORT = "8875"` — FNV-1a(`"hm1nd"`) % 900 + 8100, matching - `HIVE_LABEL = "root"` — container name; matches what `meta.rs`
`lifecycle::agent_web_port`. Sub-agents have the same shape via
the meta-flake-generated `applied/<name>/flake.nix`.
- `HIVE_LABEL = "hm1nd"` — container name; matches what `meta.rs`
injects at deploy time. injects at deploy time.
Real deploys never read these — `meta::render_flake` overrides them Real deploys never read these — `meta::render_flake` overrides them

View file

@ -2,7 +2,7 @@
The approval queue is hyperhive's pivot: nothing that changes the The approval queue is hyperhive's pivot: nothing that changes the
shape of an agent (its config, whether it exists) happens without an shape of an agent (its config, whether it exists) happens without an
operator click. The manager (`hm1nd`) is the policy gate in front of operator click. The manager (`root`) is the policy gate in front of
that queue; helper events are how it stays informed about what that queue; helper events are how it stays informed about what
happens after a decision lands. happens after a decision lands.
@ -114,7 +114,7 @@ kind-specific payload carrier.
operator approval. Step 1 of the two-step spawn flow above. operator approval. Step 1 of the two-step spawn flow above.
- `UpdateMetaInputs``commit_ref` stores the JSON-encoded inputs - `UpdateMetaInputs``commit_ref` stores the JSON-encoded inputs
array (`"[]"` = all inputs, `"[\"nixpkgs\"]"` = just nixpkgs, array (`"[]"` = all inputs, `"[\"nixpkgs\"]"` = just nixpkgs,
etc.). `agent` field is set to `hm1nd` (the requesting manager). etc.). `agent` field is set to `root` (the requesting manager).
On approve hive-c0re runs `nix flake update [inputs...]` on the On approve hive-c0re runs `nix flake update [inputs...]` on the
meta flake and commits the resulting lock changes. meta flake and commits the resulting lock changes.
- `SchedulePrompt``commit_ref` stores the JSON-encoded - `SchedulePrompt``commit_ref` stores the JSON-encoded
@ -438,23 +438,23 @@ notes, the events DB, proposed history, and applied history
all survive. The manager keeps its session; sub-agents stay all survive. The manager keeps its session; sub-agents stay
logged in. logged in.
## Manager (`hm1nd`) is hive-c0re-managed ## Manager (`root`) is hive-c0re-managed
The manager container runs through the **same lifecycle as The manager container runs through the **same lifecycle as
sub-agents**. On `hive-c0re serve` startup, if `hm1nd` is missing, sub-agents**. On `hive-c0re serve` startup, if `root` is missing,
hive-c0re creates it. The manager's flake lives at hive-c0re creates it. The manager's flake lives at
`/var/lib/hyperhive/applied/hm1nd/`; its proposed config at `/var/lib/hyperhive/applied/root/`; its proposed config at
`/var/lib/hyperhive/agents/hm1nd/config/`. Manager can edit its own `/var/lib/hyperhive/agents/root/config/`. Manager can edit its own
`agent.nix` (visible inside the container at `/agents/hm1nd/config/`) `agent.nix` (visible inside the container at `/agents/root/config/`)
and submit `request_apply_commit("hm1nd", <sha>)` for operator and submit `request_apply_commit("root", <sha>)` for operator
approval. approval.
Differences from sub-agents: Differences from sub-agents:
- `flake.nix` extends `hyperhive.nixosConfigurations.manager` - `flake.nix` extends `hyperhive.nixosConfigurations.manager`
(vs `agent-base`). (vs `agent-base`).
- Container name is `hm1nd` (no `h-` prefix). - Container name is `root` (no `h-` prefix).
- Web UI port via `lifecycle::agent_web_port("hm1nd")` — same - Web UI port via `lifecycle::agent_web_port("root")` — same
FNV-1a hash as every other agent (8100..8999 range). FNV-1a hash as every other agent (8100..8999 range).
- `set_nspawn_flags` adds two extra binds: `/var/lib/hyperhive/agents` - `set_nspawn_flags` adds two extra binds: `/var/lib/hyperhive/agents`
`/agents` (RW) so the manager can edit per-agent proposed repos, `/agents` (RW) so the manager can edit per-agent proposed repos,
@ -466,7 +466,7 @@ Differences from sub-agents:
- Per-agent socket lives at `/run/hyperhive/manager/`, owned by - Per-agent socket lives at `/run/hyperhive/manager/`, owned by
`manager_server::start`. `manager_server::start`.
**Migration note** (for older hosts): drop any `containers.hm1nd = **Migration note** (for older hosts): drop any `containers.root =
{ ... }` block from your host NixOS config. hyperhive creates and { ... }` block from your host NixOS config. hyperhive creates and
updates the manager itself. updates the manager itself.

View file

@ -7,7 +7,7 @@ exist because something already went wrong without them.
- Containers are length-bounded by `nixos-container` (≤ 11 chars). - Containers are length-bounded by `nixos-container` (≤ 11 chars).
- Sub-agents are `h-<name>` with `<name>` ≤ 9 chars. - Sub-agents are `h-<name>` with `<name>` ≤ 9 chars.
- The manager is `hm1nd` (no `h-` prefix, fixed name). - The manager is `root` (no `h-` prefix, fixed name).
- `MAX_AGENT_NAME` in `lifecycle.rs` enforces the cap. - `MAX_AGENT_NAME` in `lifecycle.rs` enforces the cap.
- Per-agent web UI port = `WEB_PORT_BASE + FNV1a(name) % WEB_PORT_RANGE` - Per-agent web UI port = `WEB_PORT_BASE + FNV1a(name) % WEB_PORT_RANGE`
(8100..8999) for every agent including the manager; dashboard (8100..8999) for every agent including the manager; dashboard

View file

@ -38,7 +38,7 @@ other sub-agents but is not managed by hive-c0re.
Pros: low blast radius. damocles keeps its bind-mounts + its own restart policy. Pros: low blast radius. damocles keeps its bind-mounts + its own restart policy.
Manager can route messages to it (it's just another inbox key on the broker). Manager can route messages to it (it's just another inbox key on the broker).
Cons: two lifecycle mechanisms coexist forever; "damocles" doesn't appear in the Cons: two lifecycle mechanisms coexist forever; "damocles" doesn't appear in the
dashboard's container list (it filters `hive-` and `hm1nd`). dashboard's container list (it filters `hive-` and `root`).
### C. Don't migrate ### C. Don't migrate
damocles stays out of hyperhive. The two systems coexist; the user's day-job damocles stays out of hyperhive. The two systems coexist; the user's day-job
@ -52,7 +52,7 @@ Cons: no message routing between damocles and the swarm.
**C for now, B once cross-pollination is wanted.** Hyperhive's invariants **C for now, B once cross-pollination is wanted.** Hyperhive's invariants
(11-char container names, manager-driven lifecycle, sealed `applied/` config) (11-char container names, manager-driven lifecycle, sealed `applied/` config)
fit poorly with damocles's role as the user's working Claude. Wait until there's fit poorly with damocles's role as the user's working Claude. Wait until there's
a concrete reason to wire them together (e.g. "I want to ask hm1nd from inside a concrete reason to wire them together (e.g. "I want to ask root from inside
damocles") and then do B — extend the broker socket bind into damocles and damocles") and then do B — extend the broker socket bind into damocles and
install `hive-ag3nt` there. No need to subsume damocles under hive-c0re. install `hive-ag3nt` there. No need to subsume damocles under hive-c0re.

View file

@ -474,7 +474,7 @@ meta's.
+ agent.nix, restarts). No approval, idempotent. Manager calls + agent.nix, restarts). No approval, idempotent. Manager calls
this on receipt of a `needs_update` system event. this on receipt of a `needs_update` system event.
- `request_apply_commit(agent, commit_ref)` — submit a config - `request_apply_commit(agent, commit_ref)` — submit a config
change for any agent (`hm1nd` for the manager's own config) for change for any agent (`root` for the manager's own config) for
operator approval. operator approval.
- `request_update_meta_inputs(inputs?, description?)` — queue an - `request_update_meta_inputs(inputs?, description?)` — queue an
approval to run `nix flake update [inputs...]` on the meta flake. approval to run `nix flake update [inputs...]` on the meta flake.
@ -502,7 +502,7 @@ meta's.
sub-agent container (diagnose MCP-registration failures, sub-agent container (diagnose MCP-registration failures,
startup crashes, etc.). Pass the plain logical agent name; startup crashes, etc.). Pass the plain logical agent name;
hive-c0re resolves the machine name (`h-<name>`, manager hive-c0re resolves the machine name (`h-<name>`, manager
`hm1nd`). `lines` defaults to 50, host-capped at 500. `root`). `lines` defaults to 50, host-capped at 500.
- `request_schedule_prompt(targets, body, first_fire_at_unix, interval_seconds?, description?)` - `request_schedule_prompt(targets, body, first_fire_at_unix, interval_seconds?, description?)`
queue an operator-approval for a scheduled prompt. On approve, queue an operator-approval for a scheduled prompt. On approve,
`body` is fanned out to each `targets` agent at `body` is fanned out to each `targets` agent at

View file

@ -288,7 +288,7 @@ to confirm; `@*` broadcasts). `POST /op-send` drops
`{from:"operator", to, body}` into the broker; the resulting SSE `{from:"operator", to, body}` into the broker; the resulting SSE
frame re-renders both the terminal row and the inbox section. frame re-renders both the terminal row and the inbox section.
Manager is addressed as `@manager` (the broker recipient string), Manager is addressed as `@manager` (the broker recipient string),
not `@hm1nd` (the container name). not `@root` (the container name).
## Container row ## Container row

View file

@ -1316,9 +1316,7 @@ in
HIVE_WEB_SOCKET = "/run/hive-agent/${userName}/web.sock"; HIVE_WEB_SOCKET = "/run/hive-agent/${userName}/web.sock";
} }
// lib.optionalAttrs isManager { // lib.optionalAttrs isManager {
# Standalone-eval fallbacks; meta.rs overrides at deploy time. # Standalone-eval fallback; meta.rs overrides at deploy time.
# HIVE_PORT = FNV-1a("root") % 900 + 8100.
HIVE_PORT = "8273";
HIVE_LABEL = "root"; HIVE_LABEL = "root";
# Manager always uses a unix socket so the gateway can route # Manager always uses a unix socket so the gateway can route
# /agent/<name>/ to it the same way it routes sub-agents. # /agent/<name>/ to it the same way it routes sub-agents.