diff --git a/docs/networking/network.md b/docs/networking/network.md
index a8ef44e63..4c889e70e 100644
--- a/docs/networking/network.md
+++ b/docs/networking/network.md
@@ -295,10 +295,9 @@ host. It never decrypts TLS, so it holds no signing key. It caches nothing.
(): `api.anthropic.com` for
the model API and the usage probe (`hive-agent/src/claude_usage_watch.rs`),
`claude.ai` for the account login, and `platform.claude.com` for the OAuth
- token exchange and refresh. An agent whose `ANTHROPIC_BASE_URL` or ACP
- provider points elsewhere needs that host added to the option: the value
- sits in the agent's own environment file, which the host doesn't read. The
- list omits the plugin marketplace clone from `github.com`, since a failed add
+ token exchange and refresh. An agent whose `ANTHROPIC_BASE_URL` points
+ elsewhere needs no entry here: the swarm controller adds that host to the
+ agent's own swarm entries (see _Swarm allow-list_ below). The list omits the plugin marketplace clone from `github.com`, since a failed add
isn't fatal. The rules below still refuse an entry that resolves to a
private address.
- **Allow-list.** `services.hyperhive.squid.allowedDomains` defaults to empty,
@@ -308,8 +307,8 @@ host. It never decrypts TLS, so it holds no signing key. It caches nothing.
which the rules below refuse, and agents reach them directly. Each entry
matches that exact name, or with a leading dot the name and its subdomains. A user on the unrestricted list reaches any
other name too, on ports 80 and 443. Everyone else gets a 403 for it.
- `allowedDomains` is the hive's own list. Squid uses it until the swarm has a
- list of its own (next bullet).
+ `allowedDomains` is the hive's own list, always allowed whether or not the
+ swarm has a list of its own (next bullet).
- **Swarm allow-list.** The operator adds domains in the swarm UI
([allowed domains](../swarm/ui.md#allowed-domains)); the swarm controller
keeps them in one value of the `egress-allow` bucket, each for every agent
@@ -333,11 +332,30 @@ host. It never decrypts TLS, so it holds no signing key. It caches nothing.
you add the entry, and `hive-c0re` checks each name again and skips one that
fails, or that the base list or the canary covers, or that another entry of
the same list covers. A name that resolves to a private address stays a 403.
- The swarm's list replaces the hive's `allowedDomains` as soon as it exists,
- even when empty: add the names the hive allowed to the swarm's list
- before relying on it. Until the controller has a list (it predates the
+ The controller also adds entries itself, and only from the operator's save
+ of an agent's API-key environment in the swarm UI: it takes the host from
+ `ANTHROPIC_BASE_URL` and from every variable named `*_BASE_URL` (the
+ address an ACP agent that loads the same file reads), and keeps one
+ `derived` entry for that agent per host. Each host passes the same check as
+ an operator's entry, so an IP address, `localhost` and a base-list name get
+ none. A save or a delete of the environment replaces the agent's derived
+ entries, and destroying the agent drops all its entries. The agent can
+ create its own `backend-env` leaf while the leaf is empty, so text found in
+ the store never creates an entry: when the controller starts, it only
+ drops derived entries whose exact host the stored environment no longer
+ names, and logs a host it didn't derive. An environment saved before this
+ existed gets its entries when the operator saves it once more. An agent on
+ the hand-placed `backendEnvironmentFile` alone, and the `opencode` preset's
+ `acp.opencode.provider.baseUrl`, get no derived entry, so add one in the
+ swarm UI. A `hive-c0re` that predates the field renders a derived entry
+ like any other.
+ The swarm's list adds to the hive's `allowedDomains`: `allowedFile` holds
+ those names plus the swarm-wide entries, so removing an entry never removes a
+ name the hive lists itself. Until the controller has a list (it predates the
feature, or nobody added an entry) `allowedFile` holds `allowedDomains` and
- `agent-allow.conf` is empty. A queue that stops answering for the bucket
+ `agent-allow.conf` is empty. A `hive-c0re` older than this rule replaces
+ `allowedDomains` with the swarm's list once the controller has one, so every
+ hive must run the new `hive-c0re` before the controller's first entry exists. A queue that stops answering for the bucket
leaves a file the swarm wrote untouched, and a failed read leaves both
files untouched. The first line of a file written from the swarm's list is a
`# source: swarm` comment. The queue grant a hive needs to read the list
diff --git a/docs/swarm/ui.md b/docs/swarm/ui.md
index 8df40093b..c198a1896 100644
--- a/docs/swarm/ui.md
+++ b/docs/swarm/ui.md
@@ -633,6 +633,13 @@ name the proxy's private-range rules leave. **remove** drops one entry;
**add** opens a dialog with a domain box and a tick for every agent in the
swarm. The tick is off by default, so an entry is for this agent alone.
+An entry with the badge **automatic** has no **remove**: the controller keeps
+it from the host in the agent's stored API-key environment
+(`ANTHROPIC_BASE_URL`, or any `*_BASE_URL` variable), so a restricted agent on
+another provider reaches it. Saving or removing the environment changes it, and
+the API refuses to add or remove one (`400` and `409`). An agent that only has
+the hand-placed environment file gets none; add its provider's host here.
+
A domain is a DNS name of at least two labels, such as `github.com`. One
leading dot, as in `.githubusercontent.com`, also allows every subdomain; the
dot form is the only wildcard, because exact names can't list a service that
@@ -648,9 +655,8 @@ an entry that exists changes nothing.
A saved change isn't instant. Each hive reads the list about every 30
seconds and reloads its proxy, so the name is reachable within a minute. The
proxy's private-range rules still apply: an entry whose name resolves to a
-loopback, private or bridge address stays blocked. The first entry makes the
-swarm's list replace the names a hive's own `allowedDomains` lists, so add
-those names here too; a hive keeps its own list until then. See [the egress
+loopback, private or bridge address stays blocked. An entry adds to the names a
+hive's own `allowedDomains` lists, which stay allowed. See [the egress
proxy](../networking/network.md#egress-proxy-squid) for what each hive does
when the controller is old or unreachable.
diff --git a/docs/turn-loop/config.md b/docs/turn-loop/config.md
index f55c6139f..b4f22e0cc 100644
--- a/docs/turn-loop/config.md
+++ b/docs/turn-loop/config.md
@@ -299,6 +299,15 @@ text. An agent whose file has content creates the leaf from it again within 2
minutes; one without a file keeps its copy in `/run` until the container
restarts.
+A save also keeps the host of `ANTHROPIC_BASE_URL` (and of every `*_BASE_URL`
+variable) as an automatic allowed-domain entry for the agent, so a restricted
+agent reaches its provider through the hive's proxy; **Remove** drops it. The
+controller derives only from an operator's save, never from text it finds in the
+store, so an environment saved before this existed needs one more save. An
+agent that has just the file gets no entry, and an operator adds its
+provider's host in the swarm UI (see
+[allowed domains](../swarm/ui.md#allowed-domains)).
+
Provision the file once, out of band (never through nix — an API key in
the store is world-readable and travels with the flake closure):
diff --git a/frontend/packages/swarm-ui/src/agent/detail/AllowedDomains.tsx b/frontend/packages/swarm-ui/src/agent/detail/AllowedDomains.tsx
index 8d690b598..7341e405c 100644
--- a/frontend/packages/swarm-ui/src/agent/detail/AllowedDomains.tsx
+++ b/frontend/packages/swarm-ui/src/agent/detail/AllowedDomains.tsx
@@ -10,12 +10,14 @@
// allows everyone) shows as it arrives, next to the box. The hive reads a
// change within about 30 seconds.
//
-// The first entry makes the swarm's list replace the names the hive's own
-// configuration allows, so a name the hive allowed and the swarm's list lacks
-// stops being allowed once hives read it. An agent that holds the unrestricted
+// An entry adds to the names the hive's own configuration allows, which stay
+// allowed. An agent that holds the unrestricted
// internet flag reaches any name the proxy's private-range rules leave, so an
// entry matters only to a restricted one.
//
+// An entry the controller keeps from the agent's backend environment (`derived`)
+// shows as automatic with no remove control; the route refuses to remove it.
+//
// Its state belongs to one agent: callers key it by agent name.
import { useEffect, useState } from "preact/hooks";
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
@@ -117,19 +119,32 @@ export function AllowedDomains({ agent }: { agent: string }) {
{shown.length > 0 ? (
{shown.map((e) => (
- -
+
-
{" "}
- void remove(e)}
- />
+ {e.derived === true ? null : (
+ void remove(e)}
+ />
+ )}
))}
@@ -207,9 +222,8 @@ function AddForm({
such as github.com; a leading dot, as in{" "}
.githubusercontent.com, also allows every subdomain. IP
addresses and wildcards are refused. A name that resolves to a private
- address stays blocked. The first entry makes the swarm's list replace
- the names each hive's own configuration allows. The hive reads a change
- within about 30 seconds.
+ address stays blocked. The entry adds to the names each hive's own
+ configuration allows. The hive reads a change within about 30 seconds.