Watch
0
0
Fork
You've already forked hyperhive
0

let the operator set, replace and remove an agent's backend env from the swarm ui

This commit is contained in:
atlas 2026-10-28 01:33:52 +01:00 • committed by mara
commit 57b04d6c49

View file

@ -663,10 +663,12 @@ The [swarm README](README.md#an-agents-agentsmd) has the wire details.
### Linking external accounts
Each agent on `/agents` opens three dialogs that write a credential for it
into the swarm secret store through swarm-controller. All three are blind
Each agent on `/agents` opens four dialogs that write a credential for it
into the swarm secret store through swarm-controller. All four are blind
set actions: no route hands a token back. swarm-controller refuses to link a
name that already holds an account; delete that account first to replace it.
The fourth, the API-key environment, is the exception: a save overwrites what the
store holds.
The agent's detail panel lists its linked accounts under **accounts**, one row
per account: kind, name and host. Opening an agent makes one request,
@ -677,11 +679,12 @@ permissions, it
shows the reason as text. A list the panel already loaded stays on screen
beneath the error.
| kind | one row per | name | host |
| ------- | ------------------------------------------- | ----------- | ------------------------ |
| matrix | `swarm/agents/<agent>/matrix/<account>` | the account | its `homeserver`, if set |
| forgejo | `swarm/agents/<agent>/forge/<label>` | the label | its `url` |
| github | `swarm/agents/<agent>/github-token`, if any | `github` | `github.com` |
| kind | one row per | name | host |
| --------- | ------------------------------------------- | ------------- | ------------------------ |
| matrix | `swarm/agents/<agent>/matrix/<account>` | the account | its `homeserver`, if set |
| forgejo | `swarm/agents/<agent>/forge/<label>` | the label | its `url` |
| github | `swarm/agents/<agent>/github-token`, if any | `github` | `github.com` |
| `backend` | `swarm/agents/<agent>/backend-env`, if any | `backend-env` | none |
The route names the second kind `forgejo`; the panel shows it as **forge**,
the word the link menu uses.
@ -711,6 +714,14 @@ a link dialog closes.
poller read. A `github-token` already in place stays when the store holds
none. What the token needs and how the agent uses it:
[GitHub accounts](../integrations/github.md).
- **set the API-key environment** — `PUT /api/hives/{hive}/agents/{agent}/backend-env`
with the text of a systemd `EnvironmentFile` (`NAME=VALUE` lines, at most
16 KiB), stored at `swarm/agents/<agent>/backend-env`. A save replaces the
stored text, including text the agent wrote into an empty leaf. The box is
write-only and starts empty; **remove** sends the `DELETE` below. A
swarm-controller without the route answers 404, and the dialog says so.
What the agent does with it:
[API-key provider](../turn-loop/config.md#api-key-provider-useapikey--backendenvironmentfile).
#### Deleting a linked account
@ -718,11 +729,12 @@ Every row except the matrix `main` row has a **delete** action. Its
confirmation names the account and its host, and confirming sends one
request:
| kind | route |
| ------- | ------------------------------------------------------------------- |
| matrix | `DELETE /api/hives/{hive}/agents/{agent}/matrix-accounts/{account}` |
| forgejo | `DELETE /api/hives/{hive}/agents/{agent}/forge-accounts/{label}` |
| github | `DELETE /api/hives/{hive}/agents/{agent}/github-account` |
| kind | route |
| --------- | ------------------------------------------------------------------- |
| matrix | `DELETE /api/hives/{hive}/agents/{agent}/matrix-accounts/{account}` |
| forgejo | `DELETE /api/hives/{hive}/agents/{agent}/forge-accounts/{label}` |
| github | `DELETE /api/hives/{hive}/agents/{agent}/github-account` |
| `backend` | `DELETE /api/hives/{hive}/agents/{agent}/backend-env` |
swarm-controller removes every version of the entry from the swarm secret
store, and answers 404 when the store holds nothing there. It refuses `main`: the