Commit graph

515 commits

Author SHA1 Message Date
damocles
6a643f2fd2 docs: update turn-loop get_loose_ends, add hive-forge and cp gotchas 2026-05-20 22:00:05 +02:00
iris
c10b4e26ef screen: fix MD5 rotation schedule and send root username
Two bugs found via the weston journal (issue #92):

1. MD5 rotation index used (j>>2 & 3) for the round number, which
   cycles every 4 steps instead of every 16. Verified against RFC 1321
   test vectors: md5("") was 7a1dce5b... instead of d41d8cd9... — the
   derived AES key was wrong, so the server decrypted the credentials
   to garbage. Fixed to j>>4.

2. weston's vnc_handle_auth calls getpwnam(username) and requires
   pw_uid == weston's own uid before PAM is consulted. We sent an empty
   username, which fails outright ("VNC: wrong user"). weston runs as
   root, so send username "root"; the empty password still passes via
   pam_permit.so on the weston-remote-access service.

Fixes #92
2026-05-20 21:47:27 +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
d348ce885f manager: add optional agent param to GetLooseEnds
GetLooseEnds now takes agent: Option<String>:
- None   = manager's own loose ends (default; the bug fix)
- Some("*")    = hive-wide view (every approval/question/reminder)
- Some("name") = that agent's loose ends

The get_loose_ends MCP tool exposes this as an optional agent arg, so
the manager can still scan the whole swarm on demand. The web UI and
post-turn counts pass None (manager's own).
2026-05-20 21:44:17 +02:00
iris
873d5a083d manager: scope GetLooseEnds to manager's own items
hive_wide returns ALL agents' reminders and questions, causing other
agents' reminders (e.g. triage) to appear on the manager's web page
and in the get_loose_ends MCP tool. The MCP tool spec says it shows
your own pending items — switch to for_agent(MANAGER_AGENT) which
includes all approvals (manager is sole submitter), questions where
the manager is asker/target, and only the manager's own reminders.

Fixes #118
2026-05-20 21:44:17 +02:00
damocles
a13f63f30c forge_notify: check mark-read HTTP status, warn on non-2xx 2026-05-20 21:22:53 +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
iris
e7d7aef1aa screen: fix Apple-DH response byte order
rfb_apple_dh_client_msg has encrypted_credentials at offset 0 and
public_key as a flexible array at offset 128. We were sending them
in the wrong order (pub_key first), so neatvnc decrypted the wrong
bytes as credentials and sent the wrong bytes as the DH public key,
causing a mismatched shared secret and SecurityResult=1.

Fixes #92
2026-05-20 20:53:30 +02:00
damocles
3c6c257506 fix tea-login: write config.yml directly, always refresh token 2026-05-20 20:51:02 +02:00
damocles
d8e64742f4 fix question answer sender and self-cancel feedback loop 2026-05-20 20:31:25 +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
iris
f9d1e69a50 stats: add 1h, 4h, 3d time range windows
Adds Hour (5-min buckets), FourHour (15-min buckets), and ThreeDay
(hourly buckets) to the Window enum, plus the matching tab buttons
in stats.html. Simplifies web_ui.rs to use Window::span_secs()
instead of a duplicate match.

Closes #25
2026-05-20 20:23:09 +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
damocles
0873159b9e fix: use combined_rev for needs_update dashboard badge 2026-05-20 20:00:38 +02:00
damocles
5951758b35 track compacted turns separately in stats 2026-05-20 19:59:59 +02:00
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