Commit graph

647 commits

Author SHA1 Message Date
iris
fceab658f4 weston-vnc: add pam_permit.so for weston service to accept any Apple-DH credentials 2026-05-20 19:59:19 +02:00
damocles
de2179540a fix: enrich forge notifications with subject body and comment content 2026-05-20 19:30:28 +02:00
iris
1b7d058d3c weston-vnc: restore auth-method=none ini so weston accepts empty Apple-DH credentials 2026-05-20 19:27:41 +02:00
iris
3224178d2d screen: implement Apple-DH (type 30) auth for neatvnc 0.9 compatibility 2026-05-20 19:12:40 +02:00
iris
fd433d2406 weston-vnc: revert neatvnc overlay, use full TLS build with --disable-transport-layer-security 2026-05-20 19:12:40 +02:00
damocles
49caf6e539 fix: also add write:notification scope to mark notifications as read 2026-05-20 19:08:21 +02:00
damocles
72aef13eaf fix: add read:notification scope, always remint token on ensure_user_for 2026-05-20 19:06:32 +02:00
iris
3e5d430873 weston-vnc: fix neatvnc overlay to use -Dtls=disabled instead of removing gnutls 2026-05-20 18:02:36 +02:00
damocles
cddaacd12f feat: poll forge notifications in agent harness
Closes #27
2026-05-20 17:59:56 +02:00
iris
a4706d793e weston-vnc: build neatvnc without gnutls to disable RSA/DH auth types 2026-05-20 17:49:26 +02:00
iris
76061eb3ae screen: reject unsupported security types with clear error instead of mishandling 2026-05-20 17:49:26 +02:00
iris
86e4f41203 screen: add RFB debug log panel for handshake diagnosis 2026-05-20 17:13:35 +02:00
damocles
1e325c84f2 fix: rebuild containers when meta flake changes, not only on hyperhive rev
Closes #78
2026-05-20 17:07:42 +02:00
iris
47279f110d weston-vnc: disable VNC auth to fix 'auth failed' in browser screen viewer 2026-05-20 16:58:56 +02:00
iris
939df10a61 docs: document model/context-window config, dynamic watermarks, rate-limit scoping 2026-05-20 16:55:13 +02:00
iris
bac7dd6cde docs: update prompts for two-step spawn + in_reply_to; trim CLAUDE.md to pointer index 2026-05-20 16:52:18 +02:00
iris
69604407a9 docs: update for recent commits (rate limiting, reply threading, screen, auto-reset, two-step spawn, ctx chip) 2026-05-20 16:52:18 +02:00
damocles
a024ca65c0 fix: align forge user email to git user.email so commits link to profiles
agent users were created with {name}@hive.local but git commits use
{name}@hyperhive (set by meta::render_flake). forgejo matches by email,
so no profile link appeared on any commit.

- extract agent_email() helper returning {name}@hyperhive
- use it in ensure_user_exists (new users)
- add ensure_user_email() that runs gitea admin user edit to patch
  existing users; called from ensure_all on every startup sweep

Closes #64
2026-05-20 16:36:32 +02:00
damocles
5c27ab9d13 fix: scope rate-limit detection on stdout to JSON error events only
raw line.contains() on stdout false-positives when the agent's own
text mentions rate_limit_error or similar strings. stderr keeps the
raw match (it is always claude CLI output, not conversation content);
stdout now only fires on parsed {"type":"error"} events.

Closes #69
2026-05-20 16:22:57 +02:00
iris
e6469403ee fix forge theme: add forgejo-* to THEMES, use C+ copy for CSS 2026-05-20 16:22:02 +02:00
damocles
4bcc8bf0b1 fix: import anyhow::Context for .context() on serde_json result 2026-05-20 16:01:47 +02:00
damocles
7b3bc3a744 docs: fix stale contextWindowTokens reference in hyperhive.model option 2026-05-20 15:52:13 +02:00
damocles
d3d52349c3 model/context: move context window config to host-level hive-c0re.nix 2026-05-20 15:49:03 +02:00
damocles
7e2f13cad8 model/context: defaults in nix module, no heuristic in rust 2026-05-20 15:49:03 +02:00
damocles
770cbaccf9 model/context: per-model ctx window overrides + expose window size in /api/state 2026-05-20 15:49:03 +02:00
damocles
9064cd3c57 model/context: configurable default model + model-derived context window 2026-05-20 15:49:03 +02:00
iris
67f948028c add catppuccin mocha × vibec0re theme to forge
- new nix/forge-theme/theme-catppuccin-vibec0re.css: full Catppuccin Mocha
  palette mapped to all Forgejo CSS custom properties + chroma syntax
  highlighting; vibec0re glow effects on primary buttons, nav, and links
- hive-forge.nix: ui.DEFAULT_THEME + ui.THEMES settings
- systemd.tmpfiles.rules symlinks the nix-managed CSS into
  /var/lib/forgejo/custom/public/assets/css/ before forgejo starts;
  container rebuild picks up CSS changes automatically

Closes #55
2026-05-20 15:42:32 +02:00
iris
b1f10b1d1b render message reply threads in dashboard and per-agent inbox
- MessageEvent and DashboardEvent Sent/Delivered now carry id and in_reply_to
- broker.send() includes last_insert_rowid in the emitted event
- recent_all() and recv_batch() include id and in_reply_to from the DB
- deliver_reminders_batch() tracks per-row rowids within the transaction
- dashboard message flow: reply rows are indented with a border-left and a
  clickable '↳ reply' tag that scroll-jumps + briefly highlights the parent
- per-agent inbox: reply messages get a '↳ reply ·' prefix and indent

Closes #26
2026-05-20 15:29:47 +02:00
iris
804875d670 surface rate_limited status as red badge on per-agent page and dashboard
- add rate_limited: Arc<AtomicBool> to Bus; set/cleared by emit_status
- write/remove sentinel file hyperhive-rate-limited in state dir so host-side
  dashboard can detect it without a live socket call
- api_state returns status=rate_limited when flag is set (cold-load accurate)
- ALIVE_LABELS gains rate_limited entry (⊘ red chip) on per-agent page
- ContainerView gains rate_limited: bool read from sentinel file
- dashboard container row shows ⊘ rate limited badge (red) ahead of needs_login

Closes #24
2026-05-20 15:16:00 +02:00
iris
808b9cbe1a extract ctx token thresholds into named constants 2026-05-20 15:05:42 +02:00
iris
de13e80082 screen: fix VeNCrypt security negotiation for weston VNC backend
weston's VNC backend (neatvnc) uses VeNCrypt (security type 19) as
the outer type even with --disable-transport-layer-security, offering
sub-type 1 (None, no TLS, no password) within it.

The old screen.html only handled type 1 (plain None) and type 2 (VNC
auth), causing 'auth failed' against weston.

Add VeNCrypt states to the RFB state machine:
- vencrypt-version: echo back server's major.minor
- vencrypt-subtypes: pick sub-type 1 (None) if available
- vencrypt-accept: check server's acceptance byte
Then falls through to the normal security-result / server-init path.
2026-05-20 15:01:35 +02:00
iris
270ef19920 dashboard: add per-agent ctx-window usage chip to container rows
Reads the most recent turn's context-window token count directly from
each agent's hyperhive-turn-stats.sqlite (same path the host-side
stats_vacuum uses). Adds ctx_tokens: Option<u64> to ContainerView;
populated in build_all via a single best-effort SQL query.

Dashboard app.js renders a 'ctx·Nk' badge colour-coded by harness
watermarks: green <100k (safe), yellow 100-150k (near auto-reset),
red ≥150k (compact territory). Badge only shown when ctx_tokens
is present (agent has run at least one turn).

Closes #17
2026-05-20 15:01:28 +02:00
damocles
25659ee9f3 auto session-reset: drop checkpoint turn, reset cold without warming cache 2026-05-20 14:49:26 +02:00
damocles
fb951c1004 auto session-reset: fix default cache TTL to 1h, clarify state-preservation purpose 2026-05-20 14:49:26 +02:00
damocles
44c903f265 auto session-reset when context large and cache is cold 2026-05-20 14:49:26 +02:00
damocles
80dd5bb69e two-step agent spawn: request_init_config + request_spawn 2026-05-20 14:40:15 +02:00
iris
42437f9c6a agent UI: show 🖥 screen link when gui_enabled
index.html: add hidden #screen-link anchor (/screen, new tab).
app.js: reveal it in refreshState() when api/state returns gui_enabled=true.

gui_enabled is set by the harness when /etc/hyperhive/gui.json exists
(written by the weston VNC service from issue #50). The link opens the
RFB viewer from issue #51 in a new tab.

Closes #52
2026-05-20 14:39:11 +02:00
iris
e448db2c34 harness: add /screen page and /screen/ws WebSocket VNC relay
Reads /etc/hyperhive/gui.json at startup to get the VNC port written
by the weston-vnc ExecStart script (issue #50). Adds:
- gui_vnc_port: Option<u16> on AppState
- gui_enabled: bool on StateSnapshot (for issue #52 screen link)
- GET /screen: serves a minimal RFB-over-WebSocket viewer (screen.html)
- GET /screen/ws: upgrades to WebSocket and byte-pumps to 127.0.0.1:<vnc_port>

The relay is a pure two-task byte pump (WS→TCP and TCP→WS), transparent
to any RFB variant including VeNCrypt. Returns 404 when gui is not
enabled.

screen.html is a self-contained RFB client: handshake, FramebufferUpdate
(Raw encoding), pointer and keyboard forwarding — enough to display the
desktop and interact with it. noVNC assets (issue #52) replace this.

Closes #51
2026-05-20 14:39:11 +02:00
iris
2027e94432 harness: add /screen page and /screen/ws WebSocket VNC relay
Reads /etc/hyperhive/gui.json at startup to get the VNC port written
by the weston-vnc ExecStart script (issue #50). Adds:
- gui_vnc_port: Option<u16> on AppState
- gui_enabled: bool on StateSnapshot (for issue #52 screen link)
- GET /screen: serves a minimal RFB-over-WebSocket viewer (screen.html)
- GET /screen/ws: upgrades to WebSocket and byte-pumps to 127.0.0.1:<vnc_port>

The relay is a pure two-task byte pump (WS→TCP and TCP→WS), transparent
to any RFB variant including VeNCrypt. Returns 404 when gui is not
enabled.

screen.html is a self-contained RFB client: handshake, FramebufferUpdate
(Raw encoding), pointer and keyboard forwarding — enough to display the
desktop and interact with it. noVNC assets (issue #52) replace this.

Closes #51
2026-05-20 14:38:42 +02:00
iris
29df223650 fix weston-vnc: use /etc/hostname instead of hostname binary, disable TLS
- Replace ${pkgs.coreutils}/bin/hostname with cat /etc/hostname:
  hostname binary is in pkgs.inetutils, not pkgs.coreutils; /etc/hostname
  is always present in NixOS containers and is simpler.
- Add --disable-transport-layer-security: weston VNC requires TLS certs
  by default; since VNC is loopback-only (relayed by the harness WS proxy)
  TLS adds no security benefit and cert generation adds complexity.
2026-05-20 14:27:55 +02:00
iris
37522fd629 nix: replace weston RDP backend with VNC, add hyperhive.gui.enable option
Removes weston-rdp.nix (hyperhive.westonRdp.enable) and adds
weston-vnc.nix (hyperhive.gui.enable).

The ExecStart wrapper script computes a deterministic VNC port via
FNV-1a hash of the agent name (derived from hostname, same algorithm
as lifecycle::agent_web_port) in the range [15900, 16799], then writes
/etc/hyperhive/gui.json {"vnc_port": N, "auth": "none"} for the
harness WebSocket relay (issue #51), and execs weston with the VNC
backend + pixman renderer.

Type=simple so it can never abort nixos-container update; a
misconfigured weston degrades to a restart loop, not a blocked rebuild.

Closes #50
2026-05-20 14:01:53 +02:00
damocles
0b237d7d8c broker: skip broadcast self-delivery 2026-05-20 13:55:46 +02:00
iris
bded8d789f integrate reminder stats into stats page via socket RPC
Add fetch_reminder_stats() helper to query ReminderRollup from broker,
and update api_stats endpoint to include reminder stats in snapshot.
Reminder activity metrics (scheduled, delivered, pending) are now
available to the stats page UI for display.
2026-05-20 13:41:55 +02:00
iris
86a499eeb5 add reminder_stats field to stats Snapshot
Add Optional<ReminderStats> field to the per-agent stats page response,
placeholder for future ReminderRollup RPC integration to fetch reminder
activity metrics from the broker.
2026-05-20 13:41:55 +02:00
iris
96d35786a5 fix: handle ReminderRollup in agent/manager response patterns
Add the ReminderRollup variant to exhaustive pattern matches
in both hive-ag3nt and hive-m1nd binaries.
2026-05-20 13:41:55 +02:00
iris
f17ee5659e add reminder rollup RPC and broker query
Surface reminder activity statistics (scheduled, delivered, pending counts)
for each agent over configurable time windows. Needed by the per-agent
stats page to display reminder metrics.

Adds:
- ReminderStats struct and ReminderRollup request/response variants
- Broker::reminder_rollup_for(agent, since_secs) method
- Agent and manager socket handlers for the new RPC
- SocketReply mapping for response conversion
2026-05-20 13:41:55 +02:00
damocles
931d4b26e7 broker: batch reminder delivery in single db transaction 2026-05-20 13:35:28 +02:00
damocles
3c672ed6b2 add allowedBashPatterns NixOS option for finer-grained Bash tool approval 2026-05-20 13:35:28 +02:00
damocles
c05a750409 enforce per-agent pending reminder cap (default 50, HIVE_REMIND_MAX_PENDING_PER_AGENT) 2026-05-20 13:35:28 +02:00
damocles
e27984b74c add graceful shutdown signal to coordinator and all background tasks 2026-05-20 13:35:28 +02:00