backendEnvironmentFile: use the harness dir, not state, per review
This commit is contained in:
parent
535ba0c11c
commit
1aa35974ee
2 changed files with 18 additions and 10 deletions
|
|
@ -244,7 +244,7 @@ programmatically and do not pass `--message-format json` themselves.
|
||||||
```nix
|
```nix
|
||||||
hyperhive.useApiKey = true; # default: false
|
hyperhive.useApiKey = true; # default: false
|
||||||
hyperhive.backendEnvironmentFile =
|
hyperhive.backendEnvironmentFile =
|
||||||
"/agents/myagent/state/openrouter.env"; # default: null
|
"/agents/myagent/harness/openrouter.env"; # default: null
|
||||||
hyperhive.model = "anthropic/claude-3.5-sonnet"; # provider-specific model string
|
hyperhive.model = "anthropic/claude-3.5-sonnet"; # provider-specific model string
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -275,14 +275,17 @@ the store is world-readable and travels with the flake closure):
|
||||||
```sh
|
```sh
|
||||||
# on the host, once per agent that should use an api-key backend
|
# on the host, once per agent that should use an api-key backend
|
||||||
sudo install -m 0600 -o root /dev/stdin \
|
sudo install -m 0600 -o root /dev/stdin \
|
||||||
/var/lib/hyperhive/agents/<name>/state/openrouter.env <<KEYS
|
/var/lib/hyperhive/agents/<name>/harness/openrouter.env <<KEYS
|
||||||
ANTHROPIC_BASE_URL=https://openrouter.ai/api/v1
|
ANTHROPIC_BASE_URL=https://openrouter.ai/api/v1
|
||||||
ANTHROPIC_API_KEY=sk-or-...
|
ANTHROPIC_API_KEY=sk-or-...
|
||||||
KEYS
|
KEYS
|
||||||
```
|
```
|
||||||
|
|
||||||
The file lives in the agent's bind-mounted state dir, so it survives
|
The file lives in the agent's bind-mounted **harness** dir, not `state/`
|
||||||
container rebuilds (not `--purge`) without needing to be re-provisioned.
|
— `harness/` survives container rebuilds exactly like `state/` does, but
|
||||||
|
(unlike `state/`) is never bind-mounted into a parent agent's container
|
||||||
|
(see `docs/persistence.md`'s "Parent access to child state"), so an API
|
||||||
|
key placed here is reachable by nothing but this agent and the host.
|
||||||
|
|
||||||
⚠️ Verified end-to-end against OpenRouter has not happened as of this
|
⚠️ Verified end-to-end against OpenRouter has not happened as of this
|
||||||
writing — `ANTHROPIC_BASE_URL` support in the shipped Claude CLI is
|
writing — `ANTHROPIC_BASE_URL` support in the shipped Claude CLI is
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ in
|
||||||
options.hyperhive.backendEnvironmentFile = lib.mkOption {
|
options.hyperhive.backendEnvironmentFile = lib.mkOption {
|
||||||
type = lib.types.nullOr lib.types.str;
|
type = lib.types.nullOr lib.types.str;
|
||||||
default = null;
|
default = null;
|
||||||
example = "/agents/myagent/state/openrouter.env";
|
example = "/agents/myagent/harness/openrouter.env";
|
||||||
description = ''
|
description = ''
|
||||||
Path (outside the nix store) to a systemd `EnvironmentFile` loaded
|
Path (outside the nix store) to a systemd `EnvironmentFile` loaded
|
||||||
by the harness service — the mechanism for supplying
|
by the harness service — the mechanism for supplying
|
||||||
|
|
@ -148,11 +148,16 @@ in
|
||||||
ANTHROPIC_BASE_URL=https://openrouter.ai/api/v1
|
ANTHROPIC_BASE_URL=https://openrouter.ai/api/v1
|
||||||
```
|
```
|
||||||
|
|
||||||
Place the file inside the agent's bind-mounted state dir (e.g.
|
Place the file inside the agent's bind-mounted **harness** dir (e.g.
|
||||||
`/agents/<name>/state/openrouter.env`) so it survives container
|
`/agents/<name>/harness/openrouter.env`, `$HYPERHIVE_HARNESS_DIR`),
|
||||||
rebuilds; permissions should be `0600`, owned by the agent's unix
|
not `state/` — `harness/` survives container rebuilds exactly like
|
||||||
user. Loaded with a leading `-` (optional `EnvironmentFile`), so a
|
`state/` does, but is never bind-mounted into a parent agent's
|
||||||
path that doesn't exist yet — an operator setting this option
|
container (unlike `state/`, which a parent gets read-write for child
|
||||||
|
recovery — see `docs/persistence.md`'s "Parent access to child
|
||||||
|
state"), so this credential is reachable by nothing but this agent
|
||||||
|
and the host. Permissions should be `0600`, owned by the agent's
|
||||||
|
unix user. Loaded with a leading `-` (optional `EnvironmentFile`),
|
||||||
|
so a path that doesn't exist yet — an operator setting this option
|
||||||
before creating the file, or a fresh host rebuild before state is
|
before creating the file, or a fresh host rebuild before state is
|
||||||
restored — makes systemd skip it rather than refuse to start the
|
restored — makes systemd skip it rather than refuse to start the
|
||||||
harness. See `hyperhive.useApiKey`'s doc for the option this one is
|
harness. See `hyperhive.useApiKey`'s doc for the option this one is
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue