Commit graph

115 commits

Author SHA1 Message Date
iris
0e2319d206 frontend: populate real npmDepsHash from prefetch-npm-deps
Manager approval 1b1bcca added `pkgs.prefetch-npm-deps` to my
container. Ran `prefetch-npm-deps frontend/package-lock.json` →
`sha256-MHXxkZpe/5LAhpQ76ZK94znG2noTobthjUi6iNY8/K4=`. Replaced
the `lib.fakeHash` placeholder in `nix/frontend.nix` with the real
value; updated the comment to point at the recompute command instead
of the let-it-fail workflow.

This unblocks PR #350 for merge — `nix build .#frontend` will now
succeed without the operator having to compute and patch the hash.

Refs #273.
2026-05-23 14:51:01 +02:00
iris
65532e8387 frontend: tighten extraFiles target type to strMatching regex
damocles suggested using lib.types.strMatching for the target option
itself rather than relying solely on the post-hoc assertion. Pattern:
`^[A-Za-z0-9_][A-Za-z0-9_./-]*$` — first char alphanumeric/_, then
alphanumerics + _ + . + / + - allowed (so nested layouts like
"games/bitburner" still work).

This rejects at type-check time:
- leading `/` (absolute paths)
- leading `.` (so `..` as a full string blocked, also `./foo`)
- leading `-` (would parse as flag by some tools)
- spaces, control chars, weird unicode

The existing assertion stays — it catches mid-path `..` segments
(`foo/../bar`) that the regex can't reject without lookahead. POSIX
regex (which nix uses) doesn't support lookahead, so the
type-and-assertion split is the cleanest expression.

Refs #273.
2026-05-23 14:51:01 +02:00
iris
2951da32e7 frontend: tighten extraFiles target validation per damocles review
Follow-up to PR #350 review:

1. New assertion: hyperhive.frontend.extraFiles[*].target must be a
   relative path inside the static dir — leading '/' and '..'
   segments rejected at config eval time. Belt-and-braces against
   string-concat-into-paths escapes (the boundary doc flags this
   pattern even though agent.nix goes through operator review).

2. Documented overwrite semantics in the option doc: collision with
   a default-dist path or with a prior entry's target is a hard-fail
   (`refusing to overwrite existing path …`). To override a default
   file, fork `hyperhive.frontend.dist` instead — extraFiles is
   pure additions.

The collision-hard-fail behaviour was already implemented in
`mergedDist` (in commit a19e156); this commit just makes the
contract explicit in the docstring.

Refs #273, addresses damocles' notes on PR #350.
2026-05-23 14:51:01 +02:00
iris
892e034908 frontend: wire static-dir env var + per-agent extraFiles option
Phase 3 of #273. Container plumbing for the bundled frontend dist:

- flake.nix overlay: `pkgs.hyperhive-frontend` exposed for the
  agent / manager containers (mirrors the existing `pkgs.hyperhive`
  pattern); module argument `hyperhiveFrontend = system: self
  .packages.${system}.frontend` threads the package into the host
  hive-c0re module without forcing operators to apply the overlay
  on their host pkgs.

- `services.hive-c0re.frontend` option: pinned to the flake's
  frontend package by default, overridable for custom dashboard
  SPAs. The hive-c0re systemd service gets `HIVE_STATIC_DIR =
  ${cfg.frontend}/dashboard` — the Rust binary will pick it up
  in Phase 4.

- `hyperhive.frontend.dist` option: per-container, defaults to
  `pkgs.hyperhive-frontend`. Override to ship a fully custom
  agent SPA (advanced; the default + extraFiles flow handles the
  common 'add files' case).

- `hyperhive.frontend.extraFiles` option: attrsOf submodule
  (mirroring the `hyperhive.extraMcpServers` shape per damocles'
  request so existing #322-style assertions keep their grip).
  Each entry has `source` (path relative to agent.nix) and
  `target` (URL/disk prefix within the merged static tree,
  defaulting to the attribute name). Operator-named example:
  the bitburner agent drops `bitburner-dist` into
  `/bitburner/` alongside the default agent UI at `/`.

- `hyperhive.frontend.mergedDist` (readOnly): the runCommand
  derivation that composes `agent/` from the default dist plus
  every `extraFiles` entry. Aborts on overwrite so a filename
  collision becomes a build error rather than a silent dist swap.
  agent-base.nix + manager.nix set their respective systemd
  service `HIVE_STATIC_DIR` to this merged path.

Until Phase 4 lands, the env var is set but unused — the Rust
binaries still serve assets via `include_str!`. The cutover
happens in the next commit on this branch.

Refs #273.
2026-05-23 14:51:01 +02:00
iris
c8af7bc70c frontend: add hermetic nix derivation in nix/frontend.nix
Phase 2 of #273. Adds `packages.${system}.frontend` to the flake —
a `buildNpmPackage` derivation that consumes the lockfile committed
in the previous step and produces two static dist trees under $out:

  $out/dashboard/   the hive-c0re dashboard SPA assets
                     (index.html, app.js, dashboard.css, favicon.svg)
  $out/agent/       the per-agent default UI assets
                     (index.html, app.js, stats.html, stats.js,
                      agent.css, screen.html)

The dashboard favicon lives outside the frontend src tree
(branding/hyperhive.svg at the repo root). It's passed in as a
callPackage argument so the hermetic build can grab it.

`npmDepsHash` is set to `lib.fakeHash` — the build will fail on
first attempt with the actual sha256 printed; copy that in. Use
`nix run nixpkgs#prefetch-npm-deps -- frontend/package-lock.json`
to recompute locally without a build round-trip (works from
operator's host; iris's container can't recompute it without
prefetch-npm-deps in PATH).

The Rust crates and NixOS modules continue to use the legacy
include_str! routes; cutover happens in Phase 4.

Refs #273.
2026-05-23 14:51:01 +02:00
damocles
e70ae7776c harness-base: add assertions for common agent config mistakes (closes #318) 2026-05-23 02:05:12 +02:00
damocles
77b249076f events: HIVE_DEFAULT_MODEL takes priority over persisted model (closes #319) 2026-05-23 00:38:17 +02:00
damocles
cd9831b39e forge-avatar-sync: fix data URI prefix and add jq to service path (closes #197) 2026-05-23 00:17:38 +02:00
damocles
dd3a820e57 hive-forge: reject empty/whitespace-only comment bodies (closes #297, closes #299) 2026-05-22 23:41:20 +02:00
damocles
2ac77a416b hive-forge pr-create: set allow_maintainer_edit=true by default (closes #308) 2026-05-22 22:52:36 +02:00
damocles
cbd4b71322 fix #296: auto-generate GPG signing key for Forgejo on first boot 2026-05-22 22:29:57 +02:00
damocles
a94b504883 forge_notify: skip-reasons drop-list filter, configurable via agent.nix 2026-05-22 22:29:32 +02:00
damocles
20d2b48fe5 hive-forge: fix comment --body flag swallowing, add comment-edit verb 2026-05-22 21:35:08 +02:00
damocles
93bf91535f hive-forge: add --milestone to issue-edit 2026-05-22 20:31:13 +02:00
damocles
66ec8390e1 hive-forge: add comment-show <id> [--json] [repo] 2026-05-22 20:21:05 +02:00
damocles
56d0b02c2f nix: drop unused weston-rdp.nix (closes #263) 2026-05-22 17:30:32 +02:00
damocles
4bc5237bea harness: fix sandbox-fallback conflict with lib.mkForce (closes #247) 2026-05-22 15:24:48 +02:00
damocles
6ca72074c4 docs: move sandbox threat model to docs/security.md, add code reference 2026-05-22 12:28:04 +02:00
damocles
a6bd4cf502 harness: document sandbox threat model and credential permission requirements 2026-05-22 10:57:13 +02:00
damocles
6974634326 harness: set sandbox-fallback = true to fix nix builds in containers (fixes #196) 2026-05-22 10:51:10 +02:00
damocles
de6ff3da29 hive-forge: add milestone verb (list/create/close), closes #226 2026-05-22 00:18:45 +02:00
damocles
02ace544bc hive-forge: restore issue-edit verb lost in rebase 2026-05-21 23:47:18 +02:00
damocles
0615b0521f hive-forge: add pr-create and issue-create verbs, closes #209 2026-05-21 23:44:27 +02:00
damocles
5de795c55f hive-forge: drop notifications/notif-read verbs — conflict with forge_notify daemon 2026-05-21 23:39:11 +02:00
damocles
c8b544d340 hive-forge: add diff, notifications, notif-read, subscription verbs (closes #214) 2026-05-21 23:35:41 +02:00
damocles
8d3be74fd2 harness: fix hive-dashboard-links state dir — drop legacy /state, use /agents/*/state 2026-05-21 23:20:13 +02:00
damocles
66c481a07a harness+dashboard: declarative dashboardLinks option (closes #191) 2026-05-21 23:20:13 +02:00
damocles
317d580405 harness: fix tea-login using getent (not in PATH) — hardcode /root 2026-05-21 23:05:13 +02:00
damocles
f762348fca harness: fix tea-login writing to /.config instead of /root/.config 2026-05-21 22:52:37 +02:00
damocles
2d3a87f545 forge-avatar-sync: rasterize SVG at 512px 2026-05-21 22:37:45 +02:00
damocles
94f5f53ca9 harness: rasterize SVG icon to PNG for Forgejo avatar upload (fixes #197) 2026-05-21 22:37:45 +02:00
damocles
03fec39405 forge_notify: flip keepSubscriptions default — agents keep, manager auto-unsubs 2026-05-21 22:33:35 +02:00
damocles
d58a3a3303 manager: keepSubscriptions = true by default 2026-05-21 22:33:35 +02:00
damocles
1adfd604b6 forge_notify: hyperhive.forge.keepSubscriptions NixOS option 2026-05-21 22:33:35 +02:00
damocles
6ffee8e6f6 hive-forge: add attach-issue and attach-comment verbs (closes #206) 2026-05-21 22:33:00 +02:00
damocles
310fd0b481 hive-forge: add APP_NAME, replace logo.png/favicon.png with hyperhive branding 2026-05-21 20:21:44 +02:00
iris
dd32774e86 weston-vnc: disable idle blank + lock screen (idle-time=0)
The VNC desktop faded to black after weston's default 300s idle
timeout, and on wake desktop-shell showed its click-to-unlock lock
screen (a green circle) — pointless for an agent desktop viewed
over /screen, and confusing for the operator (issue #180).

Add [core] idle-time=0 to the generated weston.ini. Verified against
weston 14.0.1: idle-time parses to compositor->idle_time, and
weston_compositor_wake arms the idle timer with idle_time*1000 ms;
0 ms makes wl_event_source_timer_update disarm the timer, so the
compositor never transitions to IDLE and desktop-shell never locks.

closes #180
2026-05-21 19:34:10 +02:00
damocles
00281730bb harness: sync agent icon to Forgejo user avatar on rebuild (closes #141) 2026-05-21 18:29:33 +02:00
damocles
468d682085 forge: use branding/hyperhive.svg for logo and favicon 2026-05-21 17:50:46 +02:00
damocles
615928453d forge: replace forgejo logo with hyperhive mark (closes #143) 2026-05-21 17:50:46 +02:00
damocles
72522be8c0 harness: add hyperhive.autoCompact option (default true, false=disable proactive compaction) 2026-05-21 17:41:53 +02:00
iris
39bd46b244 agent icon: add hyperhive.icon option + GET /icon endpoint
Foundation for the per-agent icon feature (#137).

- harness-base.nix: new hyperhive.icon option (nullable path to an
  SVG). An agent commits an SVG into its config repo and references
  it as ./icon.svg; when set it lands at /etc/hyperhive/icon.svg.
- web_ui.rs: GET /icon serves the configured SVG, falling back to the
  bundled hyperhive logo when none is set — so it always returns an
  image and consumers can hit it unconditionally.

Closes #139
2026-05-21 01:06:34 +02:00
damocles
a95ca22b49 hive-forge: single command with subverbs instead of per-verb scripts 2026-05-20 21:45:01 +02:00
damocles
0a4cde88b0 add hive-forge-tools: shell wrappers for common forge API operations 2026-05-20 21:45:01 +02:00
iris
ddd0248619 harness-base: fix python3 -c quoting inside nix string
Two consecutive single quotes ('') inside a Nix indented string (''...'')
are treated as the string-end delimiter, breaking nix evaluation.
Switch the shell -c argument from double-quotes to single-quotes so
the Python string literals use double-quotes instead, avoiding any ''
sequences in the Nix source.
2026-05-20 21:01:26 +02:00
damocles
3c6c257506 fix tea-login: write config.yml directly, always refresh token 2026-05-20 20:51:02 +02:00
iris
e50173f3e1 weston-vnc: fix PAM service name (weston-remote-access, not weston)
weston calls pam_start("weston-remote-access", ...) in libweston/auth.c.
The previous security.pam.services.weston entry created /etc/pam.d/weston
which was never consulted, so PAM fell back to the system default and
rejected all credentials. Renaming to weston-remote-access makes
pam_permit.so actually take effect.

Fixes #92
2026-05-20 20:28:32 +02:00
damocles
4bb3877460 add jq and curl to agent base packages 2026-05-20 20:14:26 +02:00
damocles
cc7d349139 fix: use --no-preserve=mode when copying forgejo static root 2026-05-20 20:09:00 +02:00
damocles
30c7274cc7 fix forge theme: bake css into static root via STATIC_ROOT_PATH 2026-05-20 20:02:06 +02:00