Watch
0
0
Fork
You've already forked hyperhive
0

the builder reads an agent's icon from its config and the controller writes the swarm's copy

This commit is contained in:
iris 2026-11-16 22:21:21 +01:00 • committed by mara
commit 181ef5f421
2 changed files with 299 additions and 13 deletions

View file

@ -315,6 +315,22 @@ a `nix eval` in its sandbox, and an eval has three outcomes:
and hive-priv keeps what the container's last write chose, as it does for an
agent with no record.
The built reply carries a third option, the agent's icon
(`services.hyperhive.agent.icon`), but the controller doesn't keep it in the
closure record. The same `nix eval` reads the SVG file the option names (the eval
applies `builtins.readFile`, so the builder needs no store path), and the reply's
`icon` is one of:
- `set` with the SVG's text, for an option that names a file of at most 256 KiB;
- `unset`, for a null option or a module that doesn't declare it;
- left out, for a failed eval, a timeout, an empty file or an oversize one.
The controller writes the key `<agent>` of the `agent-icons` KV bucket from a
`set`, deletes it on `unset` and leaves it on a missing field. A write that
fails is logged and doesn't fail the build or the deploy. So an agent's icon
changes when its config is built and deployed, not when its container restarts,
and an agent that has never run has one as soon as its first build succeeds.
Mixed versions:
| builder | controller and hive-c0re | what happens |

View file

@ -266,13 +266,15 @@ arrives, so for up to a minute after the controller starts, and for an agent
whose harness doesn't send it. The row's `paused_by_hive` comes from the same
headers and is `null` in the same cases.
The third thing an agent publishes is its **icon**, the same SVG its own
`GET /icon` serves. It goes into the `agent-icons` KV bucket under the key
The third thing a hive's agent has is its **icon**, the same SVG its own
`GET /icon` serves. It's in the `agent-icons` KV bucket under the key
`<agent>`, with no hive in it, so the swarm can show the icon of an agent that's
stopped or has moved hives. The queue grants the agent's own credential
`$KV.agent-icons.<agent>` and no other key of that bucket. The harness writes
once per start, because a config change reaches an agent by restarting its
container. An agent with no icon deletes its key. Swarm-side,
stopped or has moved hives. The [builder](builder.md) reads it from the agent's
evaluated config when it builds the agent for a deploy, and the controller writes
the key from the reply: an agent with no icon has its key deleted. The harness
still publishes the same file once per start, with its own credential's grant of
`$KV.agent-icons.<agent>`; the controller's write is the one that matters, since it
doesn't need the agent running. Swarm-side,
`GET /api/agents/<name>/icon` serves
the stored bytes, and 404 means the agent has no icon. swarm-ui's agent cards
load it as an `<img>` and show the dimmed default agent icon (a robot head in a