hyperhive/nix/agent-modules
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas a39399f037 swarm-logs: an agent's CLI for the swarm log store
An agent can reach VictoriaLogs only through the gateway, and since the
machine query route landed the way to read it has been to hand-roll a
client_credentials token request and a curl, per query. This is the CLI
that closes that: `swarm-logs query '<LogsQL>'`, matched log lines on
stdout, so the answer pipes into grep like any other command's.

Built to the plan posted on the tracker thread: own crate, own
docs/tools reference generated off the clap tree, `query` as the one
verb, and the JSON error body surfaced on a non-200 rather than
swallowed. No `tail`: streaming is a different endpoint with a different
response shape, and folding it in here would be a fatter scope than the
ask.

Minting the token is NOT implemented here — swarm-queue-client already
owns the client_credentials request, its error type and its CA handling,
and a token-endpoint fix has to be findable in one place. What this crate
adds is the agent-shaped half: the client id arrives as a *file* beside
the secret, so nothing outside nix/agent-modules/queue.nix spells
`hive-<name>-agent` twice. That is the same problem hive-agent's
swarm_queue module solves, and swarm-logs/src/auth.rs is its `decide`
restated over this binary's inputs.

⚠️ The plan named one thing to verify empirically before calling the auth
settled: whether authelia's bearer policy for the logs vhost accepts the
agent client's audience. Measured from inside a container: it does not.
The client minted a token fine but with `aud: []` and `scp: []`, asking
for the logs URL as an audience answered `invalid_target`, and presenting
the audience-less token to the gateway answered a bare 401. So
swarm-authelia.nix's agentClients gains `authelia.bearer.authz` and the
query URL as a second audience — authelia authorises a bearer token by
the URL being requested, and that URL is now one binding read by three
places rather than three spellings of one address.

The URL reaches an agent the same way its queue coordinates do: computed
on the host (a container cannot derive a gateway address), forwarded by
hive_c0re::meta into the container's option set, and consumed by a new
agent module that installs the binary *wrapped* with its coordinates —
the shape swarm-controller.nix installs swarmctl in. Gated on the queue
credential as well as on the URL: a binary that can only answer 401 is
worse than no binary, because an agent reads a 401 as "no logs", which is
the exact confusion the store's machine route was added to end.
2026-09-17 01:02:14 +02:00
..
agent-service.nix agent: make the OOM killer prefer a subagent over the agent's own turn 2026-09-13 13:04:45 +02:00
bash-env.nix refactor: nix/host-modules + nix/agent-modules layout, update doc paths 2026-07-13 22:05:49 +02:00
claude-settings.nix subagent daemon: throttle at two thirds of the container's memory 2026-09-13 13:04:00 +02:00
dashboard-links.nix docs: restructure into topic subdirectories, collapse duplicated index 2026-09-02 01:55:37 +02:00
default.nix swarm-logs: an agent's CLI for the swarm log store 2026-09-17 01:02:14 +02:00
docs.nix refactor(#2464): rename hive-ag3nt crate to hive-agent, collapse lib into main 2026-07-15 16:09:39 +02:00
forge.nix forge: stop the avatar sync retriggering itself into the start limit 2026-09-03 20:29:48 +02:00
frontend.nix refactor: nix/host-modules + nix/agent-modules layout, update doc paths 2026-07-13 22:05:49 +02:00
github.nix feat(#2642): a github.com notification poller alongside the forge one 2026-07-31 17:23:18 +02:00
logs.nix swarm-logs: an agent's CLI for the swarm log store 2026-09-17 01:02:14 +02:00
matrix.nix docs: matrix gateway vhost defaults to chat.<swarm-domain>, not matrix.<domain> 2026-09-07 16:53:22 +02:00
mcp.nix subagent: gate the daemon's model against availableModels 2026-09-15 23:27:02 +02:00
network.nix agent-modules/network: accept unicast DHCP renewal replies unconditionally 2026-09-16 19:54:41 +02:00
otel.nix fix(otel): let file_storage extension create its own directory 2026-09-13 21:43:14 +02:00
packages.nix nix: wire the independent hive-subagent-daemon systemd unit and MCP server 2026-09-09 23:45:12 +02:00
queue.nix swarm-logs: an agent's CLI for the swarm log store 2026-09-17 01:02:14 +02:00
screen.nix feat(#2618): add mouse_move + mouse_click via RFB PointerEvent 2026-07-20 21:00:09 +02:00
user.nix docs: restructure into topic subdirectories, collapse duplicated index 2026-09-02 01:55:37 +02:00
weston-vnc.nix docs: restructure into topic subdirectories, collapse duplicated index 2026-09-02 01:55:37 +02:00