Commit graph

1,239 commits

Author SHA1 Message Date
iris
e99330ef0f docs(gateway): document per-agent static frontend split mode 2026-06-01 17:35:28 +02:00
iris
e162c1a1fa feat(#955): split agent page serving — statics from nix store, API proxied
gateway_nginx.rs reads HIVE_AGENT_FRONTEND_DIR (injected by hive-c0re.nix
as ${cfg.frontend}/agent). When set, agents.conf emits per-agent split
blocks instead of the old single proxy_pass:

  # Compiled assets — immutable nix store path, cache 1y
  location ^~ /agent/<name>/static/ {
      alias <frontend>/static/;
      expires 1y; add_header Cache-Control "public, immutable, ...";
  }
  # Static dist + proxy fallback
  location /agent/<name>/ {
      alias <frontend>/;
      try_files $uri $uri.html $uri/index.html @<name>_dynamic;
  }
  location @<name>_dynamic {
      proxy_pass <upstream>;   # api, events, icon, login, …
      …proxy headers unchanged…
  }

try_files path resolution (nginx applies alias mapping first):
  $uri           — exact file (/static/app.js → static/app.js)
  $uri.html      — bare-path fallback (/stats → stats.html)
  $uri/index.html — directory index (/ → index.html)
  @<name>_dynamic — proxy catchall for anything not in the dist

Adding pages to the frontend dist works automatically — no generator
change needed. Per-agent extraFiles (in mergedDist, not in the base
nix-store path) continue to proxy to the agent daemon.

frontend is a nix store path injected at build time — only [a-z0-9/._-],
no shell metacharacters — safe to interpolate without sanitization;
comment added documenting this assumption.

Without HIVE_AGENT_FRONTEND_DIR the existing single-proxy block is
emitted unchanged — backward-compatible for deployments without the env.

render() takes frontend_dir as a parameter so tests exercise both code
paths safely in parallel. 13 tests: 7 legacy, 6 split-mode. No clippy
warnings in changed files.

nix/modules/hive-c0re.nix: inject HIVE_AGENT_FRONTEND_DIR = "${cfg.frontend}/agent".
2026-06-01 17:35:28 +02:00
atlas
84f5c2722e nix(#702): add hive-priv systemd socket + service units
Nix side of the hive-priv phase 1 work. hive-priv is socket-activated
exclusively: systemd holds /run/hive/priv.sock (mode 0660) and starts
the service on first connection. LISTEN_FDS + LISTEN_PID are passed;
hive-priv reads them in socket_listener() to accept the pre-bound fd.

Phase 2 note (comment in file): when hive-c0re drops to a non-root
user, add SocketGroup = hive-core to the socket unit so the
unprivileged caller can still connect. No code change needed in
hive-priv itself.
2026-06-01 17:33:32 +02:00
damocles
e7e0675d22 rename: role badge stays 'manager'; unify harness unit name to hive-ag3nt 2026-06-01 17:33:09 +02:00
damocles
77622c0585 rename(162): update manager recipient to root in system.md 2026-06-01 17:33:09 +02:00
damocles
829cea1a26 rename(162): nixosConfigurations/modules manager -> root, update package name 2026-06-01 17:33:09 +02:00
damocles
1d0d52b85f rename(162): update manager.nix comments for root 2026-06-01 17:33:09 +02:00
damocles
7772e29ec2 rename(162): hive-m1nd -> hive-root, HIVE_LABEL/PORT for root 2026-06-01 17:33:09 +02:00
damocles
1b4e9d0e2b rename(162): nixosConfigurations.manager -> root, hive-m1nd -> hive-root 2026-06-01 17:33:09 +02:00
damocles
9654315a20 rename(162): update manager test to use root 2026-06-01 17:33:09 +02:00
damocles
935f2011a0 rename(162): update hm1nd comment in ensure_manager 2026-06-01 17:33:09 +02:00
damocles
4c2398a38e rename(162): role badge manager -> root, update hm1nd comment 2026-06-01 17:33:09 +02:00
damocles
6ff2103a22 rename(162): MANAGER_AGENT manager -> root 2026-06-01 17:33:09 +02:00
damocles
37b5335c27 rename(162): MANAGER_NAME hm1nd -> root 2026-06-01 17:33:09 +02:00
damocles
0b5376249d priv: reject colons in bind paths to avoid nspawn delimiter confusion 2026-06-01 17:27:14 +02:00
damocles
c9eb520e7c priv: WriteNspawnFlags takes Vec<BindMount> instead of raw flag strings 2026-06-01 17:27:14 +02:00
damocles
a922376778 priv: reject double-quotes in nspawn flag entries 2026-06-01 17:27:14 +02:00
damocles
aa7f8e5553 priv: move shared consts to hive-sh4re; WriteNspawnFlags uses Vec<String> + per-flag validation 2026-06-01 17:27:14 +02:00
damocles
89d0937473 priv: derive flake ref from agent name; WriteNspawnFlags takes flags only 2026-06-01 17:27:14 +02:00
damocles
8d5e97ce9f fix(702): update priv_client to match narrowed PrivRequest variants 2026-06-01 17:27:14 +02:00
damocles
ec12ba4b1a fix(702): narrow all PrivRequest handlers to specific ops 2026-06-01 17:27:14 +02:00
damocles
af23047970 fix(702): replace generic variants with specific ops in PrivRequest 2026-06-01 17:27:14 +02:00
damocles
29926031ae fix(702): replace systemd_run_machine with reload_gateway_nginx in priv_client 2026-06-01 17:27:14 +02:00
damocles
efedfc3ea6 fix(702): narrow SystemdRunMachine to ReloadGatewayNginx in hive-priv 2026-06-01 17:27:14 +02:00
damocles
10871381f3 fix(702): replace SystemdRunMachine with specific ReloadGatewayNginx 2026-06-01 17:27:14 +02:00
damocles
c5cab732a2 feat(#702): priv_client - async client for hive-priv 2026-06-01 17:27:14 +02:00
damocles
c8ea28b218 feat(#702): PrivRequest/PrivResponse wire types 2026-06-01 17:27:14 +02:00
damocles
ab861dd8dc feat(#702): hive-priv privileged helper binary 2026-06-01 17:27:14 +02:00
damocles
b18bdbca1c feat(#702): add hive-priv crate 2026-06-01 17:27:14 +02:00
damocles
138d9fdabe feat(#702): add priv_client module to hive-c0re 2026-06-01 17:27:14 +02:00
damocles
d7fa1c5a6e feat(#702): add priv_proto module to hive-sh4re 2026-06-01 17:27:14 +02:00
damocles
6a371908e4 feat(#702): add hive-priv to workspace members 2026-06-01 17:27:14 +02:00
damocles
e8b24e7021 fix(948): topo-sort cascade agents in meta_update_cascade_agents 2026-06-01 16:50:41 +02:00
damocles
5dc31c1e13 fix(948): make topology_sort pub 2026-06-01 16:50:40 +02:00
damocles
eb108f9dd8 fix(947): trim prose in lifecycle.rs socket-dir block 2026-06-01 16:49:41 +02:00
damocles
2f25131403 fix(947): strip prose/issue-tags from harness-base.nix 2026-06-01 16:49:41 +02:00
damocles
e7a5718e83 fix(947): strip prose/issue-tags from agent_sockets.rs 2026-06-01 16:49:41 +02:00
damocles
7af29b3249 fix(#947): extend socket-dir bind to manager container 2026-06-01 16:49:41 +02:00
damocles
0ac05f0638 fix(#947): set HIVE_WEB_SOCKET for manager unconditionally 2026-06-01 16:49:41 +02:00
damocles
4435666c00 fix(#947): include manager in agent-sockets.json 2026-06-01 16:49:41 +02:00
damocles
8b946a67c6 fix(#947): extend socket-dir bind to manager container 2026-06-01 16:49:41 +02:00
atlas
f8c0f64fd4 feat: socket-activate the hive-c0re admin socket
Add a systemd.sockets.hive-c0re unit that holds /run/hyperhive/host.sock
before hive-c0re starts. hive-c0re serve() detects LISTEN_FDS via the
listenfd crate and accepts the systemd-handed fd instead of calling bind().
Falls back to the existing bind path when LISTEN_FDS is absent so direct
invocation and CI are unaffected.

Benefits: hivectl can connect the moment the socket unit activates (no
racy window), and a hive-c0re restart never drops the socket inode.
2026-06-01 16:29:41 +02:00
damocles
19e7d8d5d3 docs: add stats_vacuum + bash_tasks_vacuum entries to CLAUDE.md file map 2026-06-01 16:11:08 +02:00
damocles
0f62eca356 fix(#942): wire bash_tasks_vacuum spawn into main.rs 2026-06-01 16:11:08 +02:00
damocles
5880328831 fix(#942): wire bash_tasks_vacuum into lib.rs + main.rs 2026-06-01 16:11:08 +02:00
damocles
38a5299183 fix(#942): host-side bash-tasks vacuum, 48h retention 2026-06-01 16:11:08 +02:00
damocles
8e2f311e09 fix(#924): set web socket mode to 0o666 so gateway nginx can connect 2026-06-01 15:54:23 +02:00
lexis
7f91d52569 docs: add ci.md to CLAUDE.md + clarify runner details
Follow-up to #905: adds CLAUDE.md index entries (file map + reading path)
for the new docs/ci.md. Also clarifies runner details in ci.md:
- curl/jq use absolute nix store paths (no systemPackages needed)
- .runner credential reuse: script writes dummy token on subsequent boots,
  runner ignores it when .runner file exists
2026-06-01 15:52:01 +02:00
damocles
5e13fcbe94 docs: turn-stats vacuum is already implemented — update stale note 2026-06-01 15:39:43 +02:00
damocles
8d2ae047b1 fix(#937): drop dead has_pending_from — superseded by has_pending_with_body 2026-06-01 15:39:26 +02:00