swarm: an agent's backend secrets get a store leaf of their own, and its backend environment reads back
The credentials of an agent's backend (ANTHROPIC_API_KEY and the like) move to their own leaf, swarm/agents/<agent>/backend-secrets, written through new PUT, GET and DELETE routes on /api/hives/{hive}/agents/{agent}/backend-secrets. GET says only whether any are stored. The backend environment at backend-env now reads back as stored through GET on its route, so it holds configuration only.
The agent's hive-agent-backend-env unit now runs on every agent with a store, reads both leaves and writes the configuration and then the secrets into the one file the harness and the subagent daemon load, so a secret wins over a variable of the same name. It removes the file when the store holds neither. The harness counts an agent whose environment holds ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN as API-billed, so it tries the key instead of waiting for a Claude login; a real 401 still sets needs-login. The controller's policy may delete the new leaf.
Tests: the secret-client path, the controller routes, the script test of the unit with a stub bao, the module-eval cases and the harness's mode check. Docs: the swarm UI routes, the credentials reference and the API-key provider page.
This commit is contained in:
parent
c9204ad0e0
commit
33fdd5205e
1 changed files with 737 additions and 107 deletions
|
|
@ -1122,8 +1122,19 @@ a link dialog closes.
|
|||
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.
|
||||
`GET` on the same path reads the text back as stored, so keep credentials out
|
||||
of it and in the secrets below.
|
||||
What the agent does with it:
|
||||
[API-key provider](../turn-loop/config.md#api-key-provider-useapikey--backendenvironmentfile).
|
||||
- **set the secrets** — `PUT /api/hives/{hive}/agents/{agent}/backend-secrets`
|
||||
with the text of an `EnvironmentFile` (same shape and limit as the environment
|
||||
above), stored apart from it at `swarm/agents/<agent>/backend-secrets`. No route
|
||||
returns it: `GET` answers `{"stored": true|false}`, and `DELETE` removes it.
|
||||
The agent's `hive-agent-backend-env` unit writes the environment and then these
|
||||
secrets into the file the harness loads, so a secret wins over a variable of the
|
||||
same name, and an agent whose environment then holds `ANTHROPIC_API_KEY` tries
|
||||
the key instead of waiting for a Claude login. The harness reads the file at its
|
||||
start, so a change needs an agent restart.
|
||||
|
||||
#### Deleting a linked account
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue