Commit graph

1,438 commits

Author SHA1 Message Date
damocles
a176d675cf address review: drop 'service endpoints', fix container_mount doc, remove redundant write warning 2026-06-03 20:56:17 +02:00
damocles
41befe3839 feat(#1167): hive-wide knowledge repo — forge, local clone, bind-mount, webhook 2026-06-03 20:56:17 +02:00
damocles
4bb0d7f310 remove history comments from code 2026-06-03 20:39:45 +02:00
damocles
eb3c6cd0c4 cleanup(#1177): unify manager socket path, remove dead manager-name branches, rename ensure_manager 2026-06-03 20:39:45 +02:00
müde
3bb45acd87 fix: give hive-bash-daemon PATH so it can spawn sh + agent tooling 2026-06-03 20:17:09 +02:00
müde
872d605b4e fix: RuntimeDirectoryPreserve=yes on bash+matrix daemons so they survive rebuild restarts 2026-06-03 19:53:08 +02:00
iris
82d9487913 docs(#1182): remove component-diagram.svg; trim README; link to website + options 2026-06-03 19:06:06 +02:00
atlas
453ee9c44c fix(nix): merge duplicate hyperhive.extraMcpServers assignments in harness-base
bash and matrix MCP entries were both assigned to the same attribute in the
same attrset literal, causing nix evaluation to fail with "attribute already
defined". Merged both into a single lib.mkMerge list under one assignment.
2026-06-03 19:00:12 +02:00
damocles
049ae47191 fix(#1164,#1171): harness writes status file, c0re just rescans 2026-06-03 18:33:07 +02:00
damocles
a9ce8a945f fix(#1160): restart agent on failed rebuild if it was running 2026-06-03 18:32:38 +02:00
damocles
452766b35f fix(#1165): validate send recipient before queuing message 2026-06-03 18:32:38 +02:00
iris
6e670c8a72 fix(#1157): add viewport meta to all pages; use clientWidth for side panel
Without a viewport meta tag, some browsers (notably Firefox with
Fingerprinting Protection active) internally read screen.availWidth /
screen.availHeight to compute the default viewport size, producing the
console warning 'Fingerprinting Protection is altering screen.availWidth
and screen.availHeight'.

Fix:
- Add <meta name="viewport" content="width=device-width, initial-scale=1">
  to all five pages that were missing it (dashboard index/flow/logs, agent
  index/stats). screen.html already had it.
- Replace window.innerWidth with document.documentElement.clientWidth in
  the side-panel drag-resize code in common.js. clientWidth returns the
  actual CSS layout viewport width and is not rounded by Firefox's
  Fingerprinting Protection, making the drag calculation correct even
  with privacy.resistFingerprinting enabled.
2026-06-03 18:23:37 +02:00
damocles
5a9ede10df feat(#792): agent restart tool — topology-checked restart of direct children 2026-06-03 18:23:28 +02:00
iris
7767493428 feat(#1161): show full bash commands in terminal as expandable details 2026-06-03 18:14:52 +02:00
damocles
f87a52f28f fix: address argus review yellows on #1158
- restore count in get_loose_ends: 'N local task(s):' instead of bare 'local task(s):'
- add cross-crate coupling comment to both mcp_loose_ends_dir() copies
- add comment in hive-bash-daemon service env explaining HYPERHIVE_HARNESS_DIR
  is already injected via systemd.globalEnvironment by the meta flake
2026-06-03 18:06:59 +02:00
damocles
8731474104 fix: replace bash_tasks.rs with generic mcp_loose_ends scanner
- hive-ag3nt: remove bash_tasks.rs entirely; add mcp_loose_ends.rs that
  scans harness/mcp-loose-ends/*.json generically (no bash knowledge)
- hive-bash-mcp: daemon writes mcp-loose-ends/bash.json on every task
  state transition (pending/running/done/interrupted/timed_out)
- get_loose_ends: reads mcp_loose_ends::collect() instead of bash-specific code
- implements the generic mechanism from #1162
2026-06-03 18:06:59 +02:00
damocles
8b559eceec fix: remove hive-bash-mcp cargo dep from hive-ag3nt — add minimal bash_tasks.rs for get_loose_ends 2026-06-03 18:06:59 +02:00
damocles
e86160820a feat(#1106): split bash mcp into hive-bash-daemon + hive-bash-mcp bridge
- new hive-bash-mcp crate: daemon (subprocess runner, wake signals) +
  stdio bridge (mcp tools). mirrors hive-matrix-mcp architecture
- hive-ag3nt: remove bash_runner.rs and bash_run/bash_status mcp tools;
  get_loose_ends uses hive_bash_mcp:🏃:active_tasks() via crate dep
- harness-base.nix: add hive-bash-daemon systemd service + auto-inject
  bash extraMcpServer into every agent (socket: /run/hive-bash/socket)
2026-06-03 18:06:59 +02:00
damocles
9aa624d310 fix(#1159): set WorkingDirectory=/var/lib/hive-priv for hive-priv service
With ProtectSystem=strict (added in the previous commit), / is read-only
inside hive-priv. nix creates a temp result symlink in its cwd; without
WorkingDirectory that cwd is / (systemd default), causing:

  error: creating symlink /.tmp.tmp-...: Read-only file system

Point WorkingDirectory at the StateDirectory (/var/lib/hive-priv) which is
always writable under strict. Nix drops its temp symlink there instead.
2026-06-03 17:44:37 +02:00
atlas
0e3df82504 feat(#972): tighten hive-priv systemd sandbox — ProtectSystem=strict + ReadWritePaths
Replace ProtectSystem=false with ProtectSystem=strict now that privsep
is complete (issue #702 closed) and hive-c0re runs as the non-root
hive-core user.

ReadWritePaths carves out the six paths hive-priv must write to at
runtime; everything else is read-only:

  /etc/nixos-containers   — writes <container>.conf (bind-mounts,
                            network isolation, nspawn flags)
  /run/hive               — fallback socket bind when LISTEN_FDS absent
  /run/hive-agent         — chown/chmod per-agent socket directories
  /run/systemd            — container@ drop-ins (resource limits) and
                            machinectl/systemd-machined machine state
  /var/lib/nixos-containers — container rootfs (nixos-container script)
  /nix                    — nix store + profile updates during
                            container create/update

PrivateTmp=true (already set) keeps /tmp private.
StateDirectory=hive-priv (already set) keeps /var/lib/hive-priv writable
for nix's fetch/eval cache (HOME points there).

nix flake check --no-build passes.
2026-06-03 16:57:01 +02:00
atlas
d2298e183b fix(#1155): enable recommendedTlsSettings + recommendedGzipSettings in gateway nginx 2026-06-03 16:48:33 +02:00
atlas
fb93cbf5c2 feat: add tls.acme mode — nginx inside container manages Let's Encrypt
per mara's suggestion: instead of bind-mounting operator certs, let
nginx handle ACME directly inside the gateway container.

- tls.acme.enable: lets nginx obtain + renew via HTTP-01 challenge
- tls.acme.email: ACME account contact (required when enable=true)
- security.acme in container config when acme.enable
- hasTls includes acme.enable → https, httpsPort listen, firewall
- mutual exclusion assertions: acme vs selfSignedTls vs certDir
- docs/gateway.md: four-mode TLS table + ACME section

typical setup:
  selfSignedTls = false; openFirewall = true;
  tls.acme = { enable = true; email = "admin@example.com"; };
2026-06-03 16:46:52 +02:00
atlas
6c4b47a7ec docs: note ACME key file permissions for tls.certDir
security.acme defaults key to 0640 root:acme — nginx in the container
can't read it. operator must set group = "nginx" on the ACME cert.

addresses argus yellow note on PR #1153.
2026-06-03 16:46:52 +02:00
atlas
44122c66de feat(#594): gateway operator-cert TLS mode (tls.certDir)
add services.hyperhive.gateway.tls.certDir option: operators with a
CA-signed cert (Let's Encrypt, corporate CA) point at the ACME output
dir instead of using the auto-generated self-signed cert.

- tls.certDir: host path bind-mounted r/o at /run/hive-tls/ in gateway
- tls.certName / tls.keyName: filenames within certDir (default: cert.pem / key.pem, matches nixpkgs security.acme layout)
- hasTls = selfSignedTls || certDir != null: publicScheme=https in both cases
- assertion: selfSignedTls=true + certDir set together is an error
- openFirewall: httpsPort opened in both TLS modes
- docs/gateway.md: TLS modes table + operator-cert section
- docs updated in swarm.md peer config reference in the cert TLS section

when using operator cert, swarm peers can omit certFingerprint —
standard CA bundle handles trust automatically.
2026-06-03 16:46:52 +02:00
damocles
79265e04f8 cleanup(#1014): remove manager pinning from frontend — no special treatment for ruth 2026-06-03 16:44:29 +02:00
damocles
7a035911ef fix: use empty string as initial managerNameState default 2026-06-03 16:44:29 +02:00
damocles
6feab54882 cleanup(#1014): remove is_manager from ContainerView, add manager_name to StateSnapshot 2026-06-03 16:44:29 +02:00
damocles
3dda286d2b fix(#1147): break wait loop immediately on unknown task id 2026-06-03 16:35:41 +02:00
damocles
faff09ef23 feat(#1147): add optional wait_seconds to bash_status 2026-06-03 16:35:41 +02:00
atlas
a2a96490d3 fix: assert gateway.enable when isolateContainers + forge.enable
isolated agents reach forge via http://forge.<domain> → nginx.
without the gateway there is nothing on port 80 to serve that
hostname. assert early rather than fail silently at runtime.

addresses argus yellow note on PR #1150.
2026-06-03 16:33:10 +02:00
atlas
806d0e4a61 fix: use forge domain URL + open 80/443 for isolated agents
when isolateContainers=true, isolated agents have dnsmasq as their
resolver — forge.<domain> resolves to bridgeIp. route HIVE_FORGE_URL
through nginx on port 80 instead of exposing the raw forge port.

- HIVE_FORGE_URL: http://<forge.domain> when isolated (nginx proxies)
- bridge firewall: open 80+443 for agents to reach nginx (gateway)
- remove forge-specific httpPort rule (no longer needed)
- update docs/gateway.md + docs/network.md

per mara's review comment on PR #1150.
2026-06-03 16:33:10 +02:00
atlas
c97120f016 fix: forge URL + firewall for isolateContainers=true
When containers run in private netns (isolateContainers=true), host
loopback is unreachable so HIVE_FORGE_URL=http://127.0.0.1:3000 breaks.

- nix/modules/hive-network.nix: when isolateContainers is on + forge
  is enabled, open forge.httpPort on the bridge interface so agents
  can reach forgejo at bridgeIp:httpPort (forgejo binds 0.0.0.0)
- nix/modules/hive-c0re.nix: HIVE_FORGE_URL switches to bridge IP
  when network.enable && isolateContainers; loopback path retained
  when isolateContainers=false
- docs/network.md: add Forge access + Forge URL rows to effects table
- docs/gateway.md: rewrite HIVE_FORGE_URL section for both modes
2026-06-03 16:33:10 +02:00
damocles
6be114eb05 feat(#1151): default bash_run wait_seconds to 3s 2026-06-03 16:30:38 +02:00
damocles
a789c096e7 feat(#1135): transient wake for matrix mcp events - bypass broker sqlite 2026-06-03 16:09:07 +02:00
damocles
aa91d0d30d refactor(#1141): split list_reviews into list_reviews_json + list_reviews_text 2026-06-03 16:04:07 +02:00
damocles
374e53d13e nit(#1141): suppress :line in text output when comment has no line number 2026-06-03 16:01:32 +02:00
damocles
b39967eb7a refactor(#1141): extract submit_review, list_reviews, fetch_inline_comments helpers 2026-06-03 16:00:35 +02:00
damocles
eae124a460 feat(#1141): pr-reviews list mode shows inline review comments 2026-06-03 15:24:34 +02:00
damocles
c44fa14f7c fix(#1145): clone logs/cmdline in priv_run match arms to avoid use-after-move 2026-06-03 15:22:23 +02:00
atlas
9e63c9c1d0 fix: wireguard address option default + clarify peer mesh inclusion doc 2026-06-03 15:19:16 +02:00
atlas
89609aaa6a feat(#569): wireguard inter-hive mesh option
Add opt-in WireGuard mesh support to services.hyperhive.swarm:

- swarm.peers.<domain>.wireguardPublicKey — peer's wg public key
- swarm.peers.<domain>.wireguardEndpoint  — peer's UDP endpoint (optional)
- swarm.peers.<domain>.wireguardAddress   — peer's mesh IP with prefix

- swarm.wireguard.enable           — bring up wg-hive interface
- swarm.wireguard.privateKeyFile   — path to host's wg private key
- swarm.wireguard.address          — this host's mesh IP/prefix
- swarm.wireguard.listenPort       — UDP listen port (default 51820)
- swarm.wireguard.persistentKeepalive — keepalive seconds (default 25)

When enabled, generates networking.wireguard.interfaces.wg-hive with
one peer entry per mesh-enabled swarm.peers entry. Opens listenPort
UDP on the host firewall. Adds wireguard_address to HYPERHIVE_PEERS
JSON so hive-c0re can use mesh IPs for intra-swarm routing.

Assertions guard against enable=true without privateKeyFile or address.

Also refactors networking.firewall.allowedTCPPortRanges from the
nested attrset form (which conflicted with the new allowedUDPPorts
line) to the per-attribute form.

docs/swarm.md: adds WireGuard setup section with key generation
commands, two-hive config example, NAT/keepalive notes.
2026-06-03 15:19:16 +02:00
atlas
0bff5cd5c3 docs: address argus nits — latency note in collect_unread, unread_count retention rationale 2026-06-03 13:56:00 +02:00
atlas
0e5bffc9f4 fix: add #[must_use] to unread_count, collect_unread, unread_summary per codebase convention 2026-06-03 13:56:00 +02:00
atlas
68e30b857c feat(#1137): rich unread summary in loose ends and wake signal
- hive-sh4re: UnreadMatrix gains summary: String field (per-room breakdown)
- hive-matrix-mcp/protocol: add RoomUnread struct + UnreadSummary request
- hive-matrix-mcp/handlers: collect_unread() fetches per-room data;
  single-unread rooms include truncated last-message body + sender;
  multi-unread rooms carry count only
- hive-matrix-mcp/wake: format_unread_summary() builds wake body from
  RoomUnread slice; terse one-liner for single-room/single-message,
  bulleted list for multi-room; always appends read-hint
- hive-matrix-mcp/timeline: wake body now covers all rooms with unread
  at fire time, not just the triggering event; falls back to per-event
  teaser if notification counts haven't updated yet
- hive-ag3nt/mcp: matrix_unread_summary() replaces matrix_unread_rooms();
  UnreadMatrix loose end carries per-room summary lines; render shows
  room breakdown with sender: body for single-unread rooms
2026-06-03 13:56:00 +02:00
atlas
46edc635f2 feat(#1134): add unread matrix messages as a loose end
When the local matrix daemon has rooms with unread notifications,
get_loose_ends now prepends an UnreadMatrix entry to the output so
agents see pending matrix activity alongside questions/reminders
without message content being exposed.

Changes:
- hive-sh4re: add LooseEnd::UnreadMatrix { rooms: u32 } variant
- hive-matrix-mcp: add DaemonRequest::UnreadCount and handler that
  counts joined rooms with notification_count > 0 (server-side push
  notification counts, cached by matrix-sdk)
- hive-ag3nt/mcp: inject UnreadMatrix entry on self-queries by
  connecting to /run/hive-matrix/socket (HIVE_MATRIX_SOCKET override);
  best-effort — agents without matrix configured are unaffected
2026-06-03 13:55:09 +02:00
damocles
1386439591 fix(#1116): address review nits - dedup log callback, comment stderr truncation 2026-06-03 12:40:23 +02:00
damocles
68451eb205 feat(#1116): stream nixos-container create/update output live into build_logs 2026-06-03 12:34:16 +02:00
iris
cd3ba24c3d fix(#1112): build agent nav-links from disk; drop broken TCP proxy
get_agent_links was proxying to http://127.0.0.1:{port}/api/state.
Since all agents now bind exclusively to a unix socket (HIVE_WEB_SOCKET
set unconditionally in harness-base.nix), the TCP fetch always fails
silently, returning [] — so the nav-strip icons on every card disappear.

Replace with container_view::build_nav_links(), which reconstructs the
same link list from disk:
  - stats.html always (container kind)
  - /{name} and /agent-configs/{name} when forge-token is present (forge kind)
  - extras from hyperhive-dashboard-links.json (external kind)

The GUI screen link is intentionally omitted — /etc/hyperhive/gui.json
lives inside the agent container and is not host-visible. GUI agents
are rare; the omission is acceptable until a host-visible marker lands.

No new dependencies. reqwest is no longer used in dashboard.rs for
this handler (still used by forge.rs and hivectl.rs).
2026-06-03 12:32:09 +02:00
iris
84b42f5751 docs(#1110): update README diagram; add animated SVG component diagram
README: fix stale ASCII diagram
- hm1nd → h-ruth (manager container name, post-#1014 rename)
- per-agent web UIs now route through hive-gateway unix sockets, not
  direct :8100-8999 TCP (HIVE_WEB_SOCKET is now unconditional)
- split into 'optional containers' and 'agent containers' sections
- add hive-gateway, hive-forge, hive-matrix rows

New: branding/component-diagram.svg — extended animated diagram
for website use (as suggested in the issue). Matches the existing
hyperhive branding aesthetic (dark #0a0600 bg, amber #ffb300 accents,
monospace, scanlines). Shows:
- host machine frame with hive-c0re as central hub
- optional containers: gateway, forge, matrix
- agent containers: h-ruth, h-iris, h-damocles, h-<name>
- animated dots flowing along connection paths (broker messages,
  HTTP proxying, config pushes)
- pulsing glow ring on hive-c0re
- legend panel
2026-06-03 12:31:59 +02:00
damocles
0ac6028844 docs(#14): update network isolation docs - remove stale manager special-case claim 2026-06-03 12:31:54 +02:00