Compare commits
27 changed files with 144 additions and 206 deletions
|
|
@ -19,17 +19,17 @@ needed — an agent gains GitHub by having a PAT stored for it.
|
||||||
|
|
||||||
<!-- vale write-good.Passive = YES -->
|
<!-- vale write-good.Passive = YES -->
|
||||||
|
|
||||||
To turn it off for the whole swarm, set the swarm option:
|
To turn it off for the whole hive, set the host option:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
services.hyperhive.swarm.github.enable = false;
|
services.hyperhive.github.enable = false;
|
||||||
```
|
```
|
||||||
|
|
||||||
hive-c0re's meta-flake renderer then injects `services.hyperhive.agent.github.enable = false`
|
hive-c0re's meta-flake renderer then injects `services.hyperhive.agent.github.enable = false`
|
||||||
into every agent, so no agent ships the `gh` wrapper, the credential helper
|
into every agent, so no agent ships the `gh` wrapper, the credential helper
|
||||||
or the token fetch.
|
or the token fetch.
|
||||||
(`services.hyperhive.agent.github.enable` also exists per-agent for completeness, but the
|
(`services.hyperhive.agent.github.enable` also exists per-agent for completeness, but the
|
||||||
swarm-wide switch is the intended control.)
|
hive-wide host switch is the intended control.)
|
||||||
|
|
||||||
github.com only. The token **value** never touches nix — the agent writes it
|
github.com only. The token **value** never touches nix — the agent writes it
|
||||||
to `<state>/github-token` at runtime (see [Provisioning](#provisioning)).
|
to `<state>/github-token` at runtime (see [Provisioning](#provisioning)).
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ The name sits under the swarm domain so authelia's session cookie reaches it, wh
|
||||||
|
|
||||||
nginx is the one external entry point. The per-agent web-port range (`8100`–`8999`) stays closed: agents serve their UI on a unix socket ([Per-agent unix-socket upstream](#per-agent-unix-socket-upstream)), and the hashed TCP port (`lifecycle::agent_web_port`) is only a fallback bind for an agent missing `HIVE_WEB_SOCKET` — the gateway never proxies through it.
|
nginx is the one external entry point. The per-agent web-port range (`8100`–`8999`) stays closed: agents serve their UI on a unix socket ([Per-agent unix-socket upstream](#per-agent-unix-socket-upstream)), and the hashed TCP port (`lifecycle::agent_web_port`) is only a fallback bind for an agent missing `HIVE_WEB_SOCKET` — the gateway never proxies through it.
|
||||||
|
|
||||||
The dashboard port (`services.hyperhive.deploy.hive-controller.dashboardPort`, default 7000) binds `127.0.0.1` only, so remote dashboard access goes through the gateway. The dashboard can stop, rebuild and destroy agents; don't expose it without a reverse proxy in front.
|
The dashboard port (`services.hyperhive.c0re.dashboardPort`, default 7000) binds `127.0.0.1` only, so remote dashboard access goes through the gateway. The dashboard can stop, rebuild and destroy agents; don't expose it without a reverse proxy in front.
|
||||||
|
|
||||||
nginx serves its `stub_status` counters on `127.0.0.1:<statusPort>` (`services.hyperhive.gateway.statusPort`, default 8085) at `/stub_status`, from a server of its own outside the vhost tree. The hive's collector reads them with its `nginx` receiver, and the `gateway` Grafana dashboard plots them. The receiver only dials `http://`, which is why this is loopback TCP rather than a unix socket.
|
nginx serves its `stub_status` counters on `127.0.0.1:<statusPort>` (`services.hyperhive.gateway.statusPort`, default 8085) at `/stub_status`, from a server of its own outside the vhost tree. The hive's collector reads them with its `nginx` receiver, and the `gateway` Grafana dashboard plots them. The receiver only dials `http://`, which is why this is loopback TCP rather than a unix socket.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ exist because something already went wrong without them.
|
||||||
- `MAX_AGENT_NAME` in `hive-c0re/src/lifecycle/mod.rs` enforces the cap.
|
- `MAX_AGENT_NAME` in `hive-c0re/src/lifecycle/mod.rs` enforces the cap.
|
||||||
- Per-agent web UI port = `WEB_PORT_BASE + FNV1a(name) % WEB_PORT_RANGE`
|
- Per-agent web UI port = `WEB_PORT_BASE + FNV1a(name) % WEB_PORT_RANGE`
|
||||||
(8100..8999) for every agent; dashboard
|
(8100..8999) for every agent; dashboard
|
||||||
`services.hyperhive.deploy.hive-controller.dashboardPort` (default 7000).
|
`services.hyperhive.c0re.dashboardPort` (default 7000).
|
||||||
|
|
||||||
## Hive identity (label + domain + display names)
|
## Hive identity (label + domain + display names)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ _different_ nixpkgs by itself: a container only ever sees the one
|
||||||
nixpkgs the meta flake injects, so an `agent.nix` naming the host's
|
nixpkgs the meta flake injects, so an `agent.nix` naming the host's
|
||||||
`nixpkgs-unstable` has nothing to name. A release channel can trail
|
`nixpkgs-unstable` has nothing to name. A release channel can trail
|
||||||
unstable by weeks on this package, which is what
|
unstable by weeks on this package, which is what
|
||||||
`services.hyperhive.deploy.hive-controller.claudeCodePackage` is for — set it host-side
|
`services.hyperhive.c0re.claudeCodePackage` is for — set it host-side
|
||||||
and every agent runs that build.
|
and every agent runs that build.
|
||||||
|
|
||||||
What crosses is the **store path**, not the derivation. Containers
|
What crosses is the **store path**, not the derivation. Containers
|
||||||
|
|
@ -228,7 +228,7 @@ agent (different hash → different port) and rebuilding. No state
|
||||||
file, no probing, no port-allocation drift — the value is
|
file, no probing, no port-allocation drift — the value is
|
||||||
reproducible from just the name. Every agent hashes into
|
reproducible from just the name. Every agent hashes into
|
||||||
8100..8999 via the same FNV-1a; dashboard
|
8100..8999 via the same FNV-1a; dashboard
|
||||||
at `services.hyperhive.deploy.hive-controller.dashboardPort` (default 7000).
|
at `services.hyperhive.c0re.dashboardPort` (default 7000).
|
||||||
|
|
||||||
### Restart races on TCP bind
|
### Restart races on TCP bind
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,12 +179,9 @@ To let agents reach some other host-local service of your own →
|
||||||
The nix module (`nix/host-modules/otel.nix`) generates every
|
The nix module (`nix/host-modules/otel.nix`) generates every
|
||||||
`services.hyperhive.otel.*` option's full type, default, description and
|
`services.hyperhive.otel.*` option's full type, default, description and
|
||||||
example into the [options reference](https://hyperhive.darkest.space/options/)
|
example into the [options reference](https://hyperhive.darkest.space/options/)
|
||||||
(host options — `nix build .#docs-host` for a local render). The same module
|
(host options — `nix build .#docs-host` for a local render). That's the
|
||||||
declares the collector port every hive and its agents share,
|
reference; this page covers what a per-option listing can't: the two-tier
|
||||||
`services.hyperhive.swarm.hiveOtel.collectorPort`, and each hive's own
|
architecture, the security model, and how the options interact.
|
||||||
`services.hyperhive.deploy.hive-controller.otel.extraResourceAttributes`.
|
|
||||||
That's the reference; this page covers what a per-option listing can't: the
|
|
||||||
two-tier architecture, the security model, and how the options interact.
|
|
||||||
|
|
||||||
## Built-in resource labels
|
## Built-in resource labels
|
||||||
|
|
||||||
|
|
@ -208,8 +205,8 @@ The swarm's collector adds `hive`, the name of the hive whose receiver accepted
|
||||||
the push (see [Authenticated ingest](#authenticated-ingest)). The container
|
the push (see [Authenticated ingest](#authenticated-ingest)). The container
|
||||||
doesn't set it.
|
doesn't set it.
|
||||||
|
|
||||||
Append additional labels for one hive via `extraResourceAttributes` (see
|
Append additional labels via `extraResourceAttributes` (see option
|
||||||
option reference above); pass custom per-data-point labels with
|
reference above); pass custom per-data-point labels with
|
||||||
`hive-metric --labels` (see below).
|
`hive-metric --labels` (see below).
|
||||||
|
|
||||||
## Log severity
|
## Log severity
|
||||||
|
|
@ -322,9 +319,8 @@ exists, so off-the-shelf OTEL/Grafana container dashboards work. Resource
|
||||||
|
|
||||||
The `hyperhive.`-prefixed metrics have no semconv equivalent (memory
|
The `hyperhive.`-prefixed metrics have no semconv equivalent (memory
|
||||||
limit + peak, on-disk footprint, and an instantaneous cpu percent kept
|
limit + peak, on-disk footprint, and an instantaneous cpu percent kept
|
||||||
alongside the spec `container.cpu.time` counter for convenience). The `swarm`
|
alongside the spec `container.cpu.time` counter for convenience). Hive
|
||||||
label rides on the resource, and the swarm collector adds `hive` from the
|
labels (`hive`, `swarm`, …) ride on the resource via
|
||||||
receiver that accepted the sample. Any other label goes in the hive's
|
|
||||||
`extraResourceAttributes`.
|
`extraResourceAttributes`.
|
||||||
|
|
||||||
<!-- vale write-good.Passive = NO -->
|
<!-- vale write-good.Passive = NO -->
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,8 @@ agent's harness installs them from there.
|
||||||
|
|
||||||
Where it runs and how it's enabled: [`services.md`](services.md#claude-login-minter).
|
Where it runs and how it's enabled: [`services.md`](services.md#claude-login-minter).
|
||||||
|
|
||||||
The service runs the `claude-code` that its host's
|
The service runs the `claude-code` that `services.hyperhive.c0re.claudeCodePackage`
|
||||||
`services.hyperhive.deploy.hive-controller.claudeCodePackage`
|
pins for agents, and its container's own nixpkgs' where the hive pins none.
|
||||||
pins for agents, and its container's own nixpkgs' where the host pins none.
|
|
||||||
|
|
||||||
## What happens on a login
|
## What happens on a login
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,9 +145,8 @@ config) and an empty directory of its own. The prompt reaches it on stdin as
|
||||||
one user message in `--input-format stream-json`, so that it can carry content
|
one user message in `--input-format stream-json`, so that it can carry content
|
||||||
blocks (see [Shared context](#shared-context)).
|
blocks (see [Shared context](#shared-context)).
|
||||||
|
|
||||||
The `claude` is the one its host's
|
The `claude` is the one `services.hyperhive.c0re.claudeCodePackage` pins for
|
||||||
`services.hyperhive.deploy.hive-controller.claudeCodePackage` pins for
|
agents, or its container's own nixpkgs' where the hive pins none.
|
||||||
agents, or its container's own nixpkgs' where the host pins none.
|
|
||||||
|
|
||||||
On the ACP runtime, each classification is one prompt on a new `opencode acp`
|
On the ACP runtime, each classification is one prompt on a new `opencode acp`
|
||||||
session. Its config and opencode's state live in a directory of its own,
|
session. Its config and opencode's state live in a directory of its own,
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ to the bus.
|
||||||
harness unit's PATH. By default that's the `claude-code` in the agent's
|
harness unit's PATH. By default that's the `claude-code` in the agent's
|
||||||
own nixpkgs (the meta flake's `nixpkgs` input) via
|
own nixpkgs (the meta flake's `nixpkgs` input) via
|
||||||
`environment.systemPackages`. Since that's typically a release channel and
|
`environment.systemPackages`. Since that's typically a release channel and
|
||||||
this package moves fast, the operator can pin one per hive with
|
this package moves fast, the operator can pin one hive-wide with
|
||||||
`services.hyperhive.deploy.hive-controller.claudeCodePackage`: hive-c0re writes its
|
`services.hyperhive.c0re.claudeCodePackage`: hive-c0re writes its
|
||||||
store path into each agent's flake, and `claude` on PATH becomes a symlink to it
|
store path into each agent's flake, and `claude` on PATH becomes a symlink to it
|
||||||
instead of the container's own `claude-code` — so there's only ever one
|
instead of the container's own `claude-code` — so there's only ever one
|
||||||
`claude` in the container. Agents pick up a new build on their
|
`claude` in the container. Agents pick up a new build on their
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,7 @@ pub struct Coordinator {
|
||||||
pub nixpkgs_flake: String,
|
pub nixpkgs_flake: String,
|
||||||
/// Store path of the `claude-code` build every agent runs, written
|
/// Store path of the `claude-code` build every agent runs, written
|
||||||
/// into each per-agent flake as `services.hyperhive.agent.claudeCodePath`. Set by
|
/// into each per-agent flake as `services.hyperhive.agent.claudeCodePath`. Set by
|
||||||
/// the NixOS module option
|
/// the NixOS module option `services.hyperhive.c0re.claudeCodePackage`
|
||||||
/// `services.hyperhive.deploy.hive-controller.claudeCodePackage`
|
|
||||||
/// (which resolves the package and hands us its path). `None` = every
|
/// (which resolves the package and hands us its path). `None` = every
|
||||||
/// agent keeps the `claude-code` from its own nixpkgs.
|
/// agent keeps the `claude-code` from its own nixpkgs.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -551,9 +551,8 @@ fn hive_ca_source() -> Option<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Hive-wide OTEL config injected into every agent's build, read off
|
/// Hive-wide OTEL config injected into every agent's build, read off
|
||||||
/// hive-c0re's own unit env (set from `services.hyperhive.otel.*`,
|
/// hive-c0re's own unit env (set from `services.hyperhive.otel.*`). A
|
||||||
/// `services.hyperhive.swarm.hiveOtel.*` and
|
/// present, non-empty
|
||||||
/// `services.hyperhive.deploy.hive-controller.otel.*`). A present, non-empty
|
|
||||||
/// `HYPERHIVE_OTEL_ENDPOINT` is the enable signal — the host module
|
/// `HYPERHIVE_OTEL_ENDPOINT` is the enable signal — the host module
|
||||||
/// asserts the endpoint is set whenever `otel.enable` is true, so
|
/// asserts the endpoint is set whenever `otel.enable` is true, so
|
||||||
/// "endpoint present" == "OTEL on". The optional fields map to the
|
/// "endpoint present" == "OTEL on". The optional fields map to the
|
||||||
|
|
@ -923,8 +922,8 @@ where
|
||||||
// operation the tests exercise directly.
|
// operation the tests exercise directly.
|
||||||
push_forwarded_var_options(&mut out, &forwarded_env_vars());
|
push_forwarded_var_options(&mut out, &forwarded_env_vars());
|
||||||
// GitHub integration is on by default in every agent
|
// GitHub integration is on by default in every agent
|
||||||
// (`services.hyperhive.agent.github.enable`); the host turns it off swarm-wide via
|
// (`services.hyperhive.agent.github.enable`); the host turns it off hive-wide via
|
||||||
// `services.hyperhive.swarm.github.enable = false`, surfaced here as the
|
// `services.hyperhive.github.enable = false`, surfaced here as the
|
||||||
// `HYPERHIVE_GITHUB_DISABLED` env on hive-c0re's unit. Only the OFF
|
// `HYPERHIVE_GITHUB_DISABLED` env on hive-c0re's unit. Only the OFF
|
||||||
// override is propagated — the enabled default needs no per-agent line.
|
// override is propagated — the enabled default needs no per-agent line.
|
||||||
if std::env::var_os("HYPERHIVE_GITHUB_DISABLED").is_some() {
|
if std::env::var_os("HYPERHIVE_GITHUB_DISABLED").is_some() {
|
||||||
|
|
@ -1987,7 +1986,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn render_flake_injects_github_disable_only_when_signalled() {
|
fn render_flake_injects_github_disable_only_when_signalled() {
|
||||||
// services.hyperhive.swarm.github.enable = false -> HYPERHIVE_GITHUB_DISABLED
|
// services.hyperhive.github.enable = false -> HYPERHIVE_GITHUB_DISABLED
|
||||||
// on hive-c0re's unit -> `services.hyperhive.agent.github.enable = false` injected into
|
// on hive-c0re's unit -> `services.hyperhive.agent.github.enable = false` injected into
|
||||||
// every agent. On by default, so nothing is emitted unless disabled.
|
// every agent. On by default, so nothing is emitted unless disabled.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -347,9 +347,8 @@ fn attrs(c: &ContainerResource) -> Vec<KeyValue> {
|
||||||
|
|
||||||
/// Resource: `service.name = hyperhive-c0re`, the host architecture, the
|
/// Resource: `service.name = hyperhive-c0re`, the host architecture, the
|
||||||
/// running hyperhive revision, plus whatever the operator set in
|
/// running hyperhive revision, plus whatever the operator set in
|
||||||
/// `deploy.hive-controller.otel.extraResourceAttributes` (same channel the
|
/// `extraResourceAttributes` (where the hive `hive` / `swarm` labels live, same
|
||||||
/// agent-side export uses; the `hive` label is stamped by the swarm
|
/// channel the agent-side export uses).
|
||||||
/// collector, not set here).
|
|
||||||
///
|
///
|
||||||
/// These belong on the resource rather than on each data point for the same
|
/// These belong on the resource rather than on each data point for the same
|
||||||
/// reason `hive` / `swarm` do: they are constant across one `hive-c0re`. Only
|
/// reason `hive` / `swarm` do: they are constant across one `hive-c0re`. Only
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ in
|
||||||
nixpkgs.
|
nixpkgs.
|
||||||
|
|
||||||
Set by the generated meta flake when the operator sets
|
Set by the generated meta flake when the operator sets
|
||||||
`services.hyperhive.deploy.hive-controller.claudeCodePackage` host-side, so a hive
|
`services.hyperhive.c0re.claudeCodePackage` host-side, so a hive
|
||||||
can run a claude built from a *different* nixpkgs than the one
|
can run a claude built from a *different* nixpkgs than the one
|
||||||
its agents evaluate against — a release channel can trail
|
its agents evaluate against — a release channel can trail
|
||||||
unstable by weeks on this one package. It arrives as a path and
|
unstable by weeks on this one package. It arrives as a path and
|
||||||
|
|
@ -109,7 +109,7 @@ in
|
||||||
there is only ever one claude in the container. Note that neither
|
there is only ever one claude in the container. Note that neither
|
||||||
the symlink nor anything else in the container's closure *refers*
|
the symlink nor anything else in the container's closure *refers*
|
||||||
to the target — keeping it alive is the host's job, see
|
to the target — keeping it alive is the host's job, see
|
||||||
`services.hyperhive.deploy.hive-controller.claudeCodePackage`.
|
`services.hyperhive.c0re.claudeCodePackage`.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -255,7 +255,7 @@ in
|
||||||
# The symlink registers no store reference — the target isn't
|
# The symlink registers no store reference — the target isn't
|
||||||
# among this derivation's inputs, so nothing here keeps the
|
# among this derivation's inputs, so nothing here keeps the
|
||||||
# binary alive. That is deliberate and it is the host's job:
|
# binary alive. That is deliberate and it is the host's job:
|
||||||
# see `services.hyperhive.deploy.hive-controller.claudeCodePackage`.
|
# see `services.hyperhive.c0re.claudeCodePackage`.
|
||||||
pkgs.runCommandLocal "claude-code-pinned" { } ''
|
pkgs.runCommandLocal "claude-code-pinned" { } ''
|
||||||
mkdir -p "$out/bin"
|
mkdir -p "$out/bin"
|
||||||
ln -s ${config.services.hyperhive.agent.claudeCodePath}/bin/claude "$out/bin/claude"
|
ln -s ${config.services.hyperhive.agent.claudeCodePath}/bin/claude "$out/bin/claude"
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,8 @@ in
|
||||||
a compromised agent can act within the token's scopes --- scope is the
|
a compromised agent can act within the token's scopes --- scope is the
|
||||||
real blast-radius limiter.
|
real blast-radius limiter.
|
||||||
|
|
||||||
On by default. Host-driven: set `services.hyperhive.swarm.github.enable = false`
|
On by default. Host-driven: set `services.hyperhive.github.enable = false`
|
||||||
to turn the integration off swarm-wide (meta.rs propagates the override
|
to turn the integration off hive-wide (meta.rs propagates the override
|
||||||
into every agent).
|
into every agent).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -125,8 +125,7 @@ in
|
||||||
Extra comma-separated entries appended to
|
Extra comma-separated entries appended to
|
||||||
`OTEL_RESOURCE_ATTRIBUTES` after the built-in
|
`OTEL_RESOURCE_ATTRIBUTES` after the built-in
|
||||||
`service.name` / `agent` / `swarm` labels.
|
`service.name` / `agent` / `swarm` labels.
|
||||||
Host-driven via
|
Host-driven via `services.hyperhive.otel.extraResourceAttributes`.
|
||||||
`services.hyperhive.deploy.hive-controller.otel.extraResourceAttributes`.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,21 +112,6 @@ in
|
||||||
[ "services" "hyperhive" "deploy" "bao" "servicesIssuerClientKeyFile" ]
|
[ "services" "hyperhive" "deploy" "bao" "servicesIssuerClientKeyFile" ]
|
||||||
)
|
)
|
||||||
|
|
||||||
# What hive-c0re hands this hive's agents: a per-host choice, so it
|
|
||||||
# sits with the controller's other deployment options.
|
|
||||||
(lib.mkRenamedOptionModule
|
|
||||||
[ "services" "hyperhive" "c0re" "claudeCodePackage" ]
|
|
||||||
[ "services" "hyperhive" "deploy" "hive-controller" "claudeCodePackage" ]
|
|
||||||
)
|
|
||||||
(lib.mkRenamedOptionModule
|
|
||||||
[ "services" "hyperhive" "c0re" "dashboardPort" ]
|
|
||||||
[ "services" "hyperhive" "deploy" "hive-controller" "dashboardPort" ]
|
|
||||||
)
|
|
||||||
(lib.mkRenamedOptionModule
|
|
||||||
[ "services" "hyperhive" "otel" "extraResourceAttributes" ]
|
|
||||||
[ "services" "hyperhive" "deploy" "hive-controller" "otel" "extraResourceAttributes" ]
|
|
||||||
)
|
|
||||||
|
|
||||||
# The homeserver's port and its firewall switch, removed rather than
|
# The homeserver's port and its firewall switch, removed rather than
|
||||||
# renamed: tuwunel listens on a unix socket only the gateway reaches, so
|
# renamed: tuwunel listens on a unix socket only the gateway reaches, so
|
||||||
# there is no host port to choose or open.
|
# there is no host port to choose or open.
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.services.hyperhive.c0re;
|
cfg = config.services.hyperhive.c0re;
|
||||||
controllerCfg = config.services.hyperhive.deploy.hive-controller;
|
|
||||||
|
|
||||||
# `/run/hyperhive`'s mode. Held in one place because whichever of the two
|
# `/run/hyperhive`'s mode. Held in one place because whichever of the two
|
||||||
# units below activates first creates the directory, so they cannot be
|
# units below activates first creates the directory, so they cannot be
|
||||||
|
|
@ -111,8 +110,8 @@ let
|
||||||
# anything that drops it. The failure mode is a garbage-collected
|
# anything that drops it. The failure mode is a garbage-collected
|
||||||
# `claude` and a hive that can't take a turn, weeks after the commit
|
# `claude` and a hive that can't take a turn, weeks after the commit
|
||||||
# that caused it.
|
# that caused it.
|
||||||
claude_code_path = controllerCfg.claudeCodePackage;
|
claude_code_path = cfg.claudeCodePackage;
|
||||||
dashboard_port = controllerCfg.dashboardPort;
|
dashboard_port = cfg.dashboardPort;
|
||||||
agent_cpu_quota = cfg.agentCpuQuota;
|
agent_cpu_quota = cfg.agentCpuQuota;
|
||||||
agent_memory_max = cfg.agentMemoryMax;
|
agent_memory_max = cfg.agentMemoryMax;
|
||||||
agent_cpu_weight = cfg.agentCpuWeight;
|
agent_cpu_weight = cfg.agentCpuWeight;
|
||||||
|
|
@ -164,10 +163,9 @@ in
|
||||||
# `claude`, at whatever unrelated moment the gc runs. Cheap
|
# `claude`, at whatever unrelated moment the gc runs. Cheap
|
||||||
# enough to just check.
|
# enough to just check.
|
||||||
assertion =
|
assertion =
|
||||||
controllerCfg.claudeCodePackage == null
|
cfg.claudeCodePackage == null || builtins.hasContext (builtins.toJSON cfg.claudeCodePackage);
|
||||||
|| builtins.hasContext (builtins.toJSON controllerCfg.claudeCodePackage);
|
|
||||||
message = ''
|
message = ''
|
||||||
services.hyperhive.deploy.hive-controller.claudeCodePackage lost its store
|
services.hyperhive.c0re.claudeCodePackage lost its store
|
||||||
context on the way into /etc/hyperhive/serve.json, so the
|
context on the way into /etc/hyperhive/serve.json, so the
|
||||||
package is no longer gc-rooted by the system closure and
|
package is no longer gc-rooted by the system closure and
|
||||||
`nix-collect-garbage` may delete the claude every agent runs.
|
`nix-collect-garbage` may delete the claude every agent runs.
|
||||||
|
|
|
||||||
|
|
@ -65,30 +65,27 @@ in
|
||||||
// lib.optionalAttrs (config.services.hyperhive.swarm.name != null) {
|
// lib.optionalAttrs (config.services.hyperhive.swarm.name != null) {
|
||||||
HYPERHIVE_SWARM_NAME = config.services.hyperhive.swarm.name;
|
HYPERHIVE_SWARM_NAME = config.services.hyperhive.swarm.name;
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs (!config.services.hyperhive.swarm.github.enable) {
|
// lib.optionalAttrs (!config.services.hyperhive.github.enable) {
|
||||||
# GitHub integration is on by default; only signal the OFF override to
|
# GitHub integration is on by default; only signal the OFF override to
|
||||||
# meta.rs, which then injects `services.hyperhive.agent.github.enable = false` into
|
# meta.rs, which then injects `services.hyperhive.agent.github.enable = false` into
|
||||||
# every agent. See services.hyperhive.swarm.github.enable.
|
# every agent. See services.hyperhive.github.enable.
|
||||||
HYPERHIVE_GITHUB_DISABLED = "1";
|
HYPERHIVE_GITHUB_DISABLED = "1";
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs config.services.hyperhive.otel.enable (
|
// lib.optionalAttrs config.services.hyperhive.otel.enable (
|
||||||
# OTEL config (`swarm.hiveOtel`, `deploy.hive-controller.otel`, gated on
|
# Hive-wide OTEL config -> read by meta.rs::otel_config and
|
||||||
# this hive's `otel.enable`) -> read by meta.rs::otel_config and injected
|
# injected as build-time `services.hyperhive.agent.otel.*` into every agent.
|
||||||
# as build-time `services.hyperhive.agent.otel.*` into every agent.
|
|
||||||
# Endpoint presence is the enable signal on the meta side; the
|
# Endpoint presence is the enable signal on the meta side; the
|
||||||
# optional fields are only emitted when set so absent values
|
# optional fields are only emitted when set so absent values
|
||||||
# don't render no-op env lines.
|
# don't render no-op env lines.
|
||||||
let
|
let
|
||||||
otel = config.services.hyperhive.otel;
|
otel = config.services.hyperhive.otel;
|
||||||
hiveOtel = config.services.hyperhive.swarm.hiveOtel;
|
|
||||||
controllerOtel = config.services.hyperhive.deploy.hive-controller.otel;
|
|
||||||
# The first hop, this hive's own collector, under the two spellings its
|
# The first hop, this hive's own collector, under the two spellings its
|
||||||
# two kinds of caller need. Agents get the swarm-wide name, so their
|
# two kinds of caller need. Agents get the swarm-wide name, so their
|
||||||
# builds carry nothing hive-specific; this daemon gets the bridge
|
# builds carry nothing hive-specific; this daemon gets the bridge
|
||||||
# address, because on the host the name may resolve to loopback
|
# address, because on the host the name may resolve to loopback
|
||||||
# (`gateway.localHostsEntry`), where the receiver does not listen.
|
# (`gateway.localHostsEntry`), where the receiver does not listen.
|
||||||
agentFirstHop = "http://${otel.collector.host}:${toString hiveOtel.collectorPort}";
|
agentFirstHop = "http://${otel.collector.host}:${toString otel.collector.port}";
|
||||||
hostFirstHop = "http://${config.services.hyperhive.network.bridgeIp}:${toString hiveOtel.collectorPort}";
|
hostFirstHop = "http://${config.services.hyperhive.network.bridgeIp}:${toString otel.collector.port}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# `otel.endpoint` means "where telemetry ultimately goes" and keeps
|
# `otel.endpoint` means "where telemetry ultimately goes" and keeps
|
||||||
|
|
@ -116,8 +113,8 @@ in
|
||||||
# what has to honour it (see nix/host-modules/otel.nix).
|
# what has to honour it (see nix/host-modules/otel.nix).
|
||||||
HYPERHIVE_OTEL_PROTOCOL = "http/protobuf";
|
HYPERHIVE_OTEL_PROTOCOL = "http/protobuf";
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs (controllerOtel.extraResourceAttributes != "") {
|
// lib.optionalAttrs (otel.extraResourceAttributes != "") {
|
||||||
HYPERHIVE_OTEL_EXTRA_RESOURCE_ATTRIBUTES = controllerOtel.extraResourceAttributes;
|
HYPERHIVE_OTEL_EXTRA_RESOURCE_ATTRIBUTES = otel.extraResourceAttributes;
|
||||||
}
|
}
|
||||||
# HYPERHIVE_OTEL_HEADERS_CREDENTIAL is deliberately NOT emitted, and
|
# HYPERHIVE_OTEL_HEADERS_CREDENTIAL is deliberately NOT emitted, and
|
||||||
# its absence is the security half of this design: that variable would
|
# its absence is the security half of this design: that variable would
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,7 @@
|
||||||
# `nixosModules.default` wires to its own outputs (they carry no
|
# `nixosModules.default` wires to its own outputs (they carry no
|
||||||
# in-module defaults; see ../../../flake.nix). The read-only
|
# in-module defaults; see ../../../flake.nix). The read-only
|
||||||
# `servedFrontend` option lives in ./theme.nix with the stylix wiring
|
# `servedFrontend` option lives in ./theme.nix with the stylix wiring
|
||||||
# that computes it. The hive's own values the meta-flake render hands
|
# that computes it.
|
||||||
# its agents are declared here too, under
|
|
||||||
# `services.hyperhive.deploy.hive-controller`.
|
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
|
|
@ -121,6 +119,56 @@
|
||||||
of the host's channel.
|
of the host's channel.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
claudeCodePackage = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.package;
|
||||||
|
default = null;
|
||||||
|
example = lib.literalExpression "inputs.nixpkgs-unstable.legacyPackages.x86_64-linux.claude-code";
|
||||||
|
description = ''
|
||||||
|
The `claude-code` build every agent runs, or `null` (the
|
||||||
|
default) to leave each agent on the `claude-code` from its own
|
||||||
|
nixpkgs — i.e. whatever `nixpkgsFlake` resolves to.
|
||||||
|
|
||||||
|
This is the one binary the whole hive is built around, and it
|
||||||
|
moves fast enough that a release channel routinely trails
|
||||||
|
unstable by weeks on it. An agent cannot fix that for itself:
|
||||||
|
agents evaluate against the single nixpkgs hive-c0re injects,
|
||||||
|
so an `agent.nix` has no other tree to reach for. Set this from
|
||||||
|
a second nixpkgs in the host flake and every agent follows,
|
||||||
|
without moving the nixpkgs the rest of the container is built
|
||||||
|
from.
|
||||||
|
|
||||||
|
What travels into the container is the **store path**, not the
|
||||||
|
derivation: agents share the host's `/nix/store`, so the binary
|
||||||
|
and its full closure are already reachable there — nothing
|
||||||
|
needs rebuilding or copying. hive-c0re writes the path into
|
||||||
|
each agent's generated flake as a plain string literal (a bare
|
||||||
|
path fed to `lib.types.package` would run `builtins.storePath`,
|
||||||
|
which is illegal under pure evaluation) and the agent module
|
||||||
|
puts its `bin/` on the harness's PATH.
|
||||||
|
|
||||||
|
The flip side of a plain string is that nothing in the agent's
|
||||||
|
own closure refers to it, so the container cannot keep it
|
||||||
|
alive. The **host** does that instead: this package is
|
||||||
|
interpolated into `/etc/hyperhive/serve.json`, which puts it in
|
||||||
|
the host's system closure — so it is gc-rooted by the running
|
||||||
|
generation for exactly as long as that generation is the one
|
||||||
|
the agents were rendered from. The cost is that
|
||||||
|
`nix-collect-garbage` cannot reclaim an old `claude-code` until
|
||||||
|
every agent has been rebuilt past it and the old generations
|
||||||
|
are gone.
|
||||||
|
|
||||||
|
The swarm's `swarm-claude-login` and `swarm-review-classifier`
|
||||||
|
containers, where this host runs them, follow the same pin and
|
||||||
|
keep their own nixpkgs' `claude-code` when it is `null`. They are
|
||||||
|
not agents, so pinning an older build for an agent-side
|
||||||
|
regression pins them too.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
dashboardPort = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 7000;
|
||||||
|
description = "TCP port the hive-c0re dashboard listens on.";
|
||||||
|
};
|
||||||
preBuildAgentTemplates = lib.mkOption {
|
preBuildAgentTemplates = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|
@ -329,59 +377,4 @@
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# What this hive hands its own agents through the meta-flake render. Per
|
|
||||||
# host, so two hives may set them differently.
|
|
||||||
options.services.hyperhive.deploy.hive-controller = {
|
|
||||||
claudeCodePackage = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.package;
|
|
||||||
default = null;
|
|
||||||
example = lib.literalExpression "inputs.nixpkgs-unstable.legacyPackages.x86_64-linux.claude-code";
|
|
||||||
description = ''
|
|
||||||
The `claude-code` build every agent on this hive runs, or `null` (the
|
|
||||||
default) to leave each agent on the `claude-code` from its own
|
|
||||||
nixpkgs — i.e. whatever `c0re.nixpkgsFlake` resolves to.
|
|
||||||
|
|
||||||
This is the one binary the whole hive is built around, and it
|
|
||||||
moves fast enough that a release channel routinely trails
|
|
||||||
unstable by weeks on it. An agent cannot fix that for itself:
|
|
||||||
agents evaluate against the single nixpkgs hive-c0re injects,
|
|
||||||
so an `agent.nix` has no other tree to reach for. Set this from
|
|
||||||
a second nixpkgs in the host flake and every agent follows,
|
|
||||||
without moving the nixpkgs the rest of the container is built
|
|
||||||
from.
|
|
||||||
|
|
||||||
What travels into the container is the **store path**, not the
|
|
||||||
derivation: agents share the host's `/nix/store`, so the binary
|
|
||||||
and its full closure are already reachable there — nothing
|
|
||||||
needs rebuilding or copying. hive-c0re writes the path into
|
|
||||||
each agent's generated flake as a plain string literal (a bare
|
|
||||||
path fed to `lib.types.package` would run `builtins.storePath`,
|
|
||||||
which is illegal under pure evaluation) and the agent module
|
|
||||||
puts its `bin/` on the harness's PATH.
|
|
||||||
|
|
||||||
The flip side of a plain string is that nothing in the agent's
|
|
||||||
own closure refers to it, so the container cannot keep it
|
|
||||||
alive. The **host** does that instead: this package is
|
|
||||||
interpolated into `/etc/hyperhive/serve.json`, which puts it in
|
|
||||||
the host's system closure — so it is gc-rooted by the running
|
|
||||||
generation for exactly as long as that generation is the one
|
|
||||||
the agents were rendered from. The cost is that
|
|
||||||
`nix-collect-garbage` cannot reclaim an old `claude-code` until
|
|
||||||
every agent has been rebuilt past it and the old generations
|
|
||||||
are gone.
|
|
||||||
|
|
||||||
The swarm's `swarm-claude-login` and `swarm-review-classifier`
|
|
||||||
containers, where this host runs them, follow the same pin and
|
|
||||||
keep their own nixpkgs' `claude-code` when it is `null`. They are
|
|
||||||
not agents, so pinning an older build for an agent-side
|
|
||||||
regression pins them too.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
dashboardPort = lib.mkOption {
|
|
||||||
type = lib.types.port;
|
|
||||||
default = 7000;
|
|
||||||
description = "TCP port this hive's hive-c0re dashboard listens on.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ in
|
||||||
description = ''
|
description = ''
|
||||||
TCP port the gateway proxies non-static requests to. Defaults
|
TCP port the gateway proxies non-static requests to. Defaults
|
||||||
to `7000` (hive-c0re's out-of-the-box dashboard port). Operators
|
to `7000` (hive-c0re's out-of-the-box dashboard port). Operators
|
||||||
who change `services.hyperhive.deploy.hive-controller.dashboardPort` should set
|
who change `services.hyperhive.c0re.dashboardPort` should set
|
||||||
`upstreamPort` to match — kept as a hardcoded default rather
|
`upstreamPort` to match — kept as a hardcoded default rather
|
||||||
than a cross-reference to keep this module's options eval
|
than a cross-reference to keep this module's options eval
|
||||||
independent of c0re's option tree shape.
|
independent of c0re's option tree shape.
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ let
|
||||||
networkBase = builtins.bitAnd (ipToInt cfg.bridgeIp) (4294967295 - hostCount + 1);
|
networkBase = builtins.bitAnd (ipToInt cfg.bridgeIp) (4294967295 - hostCount + 1);
|
||||||
|
|
||||||
# Every switch that runs a hyperhive service on this host. Left out:
|
# Every switch that runs a hyperhive service on this host. Left out:
|
||||||
# `swarm.github.enable` (on by default, runs nothing by itself), the gateway's
|
# `github.enable` (on by default, runs nothing by itself), the gateway's
|
||||||
# and matrix's sub-features, and `allSwarmServices`/`singleHostSwarm`,
|
# and matrix's sub-features, and `allSwarmServices`/`singleHostSwarm`,
|
||||||
# which only take effect through the switches listed here.
|
# which only take effect through the switches listed here.
|
||||||
anyServiceEnabled =
|
anyServiceEnabled =
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue