Commit Graph
11 Commits
Author SHA1 Message Date
Hermenix e8b3855a05 move every live default to /run/hypr-stream, and resolve the slices' contract gaps
Slice A renamed the runtime directory in the module, but the old path was still
live in the code and checks it does not own, so the VM gates pointed at a
directory the module no longer creates. This moves the 21 remaining live
occurrences (client/server defaults, the unit tests that pin them, all three VM
checks, the diagnostics script, both READMEs) and deliberately leaves the three
mentions that are history rather than configuration: the plan's problem
statement, module.nix's note about the previous name, and cli.py's explanation
for spelling its default out.

Also here: docs/CONTRACT-sessions.md is now v2 with every gap the four slices
reported resolved as a decision (Monitor.id, stable_id, pid -1, Event.data,
mark(), the quarantine argv type, the corrected wlr XML path, and the state
dir/frame socket rows), and docs/CONTRACT.md is v2 because its documented socket
default moved -- wire format unchanged.

Two comments that stated the old, wrong diagnosis (a 'misnamed' IPC socket) now
state the measured one: the event socket did not fit in sun_path.
2026-10-02 18:11:46 +00:00
HermenixandClaude Opus 5 06041030b0 rename the compositor runtime directory to /run/hypr-stream
`/run/hyprland-headless-stream` is 29 characters, and the compositor's IPC
sockets live under it at `hypr/<instance signature>/.socket2.sock`. With a
~30-character signature the *event* socket does not fit in `sun_path` and the
compositor refuses to bind it:

  ERR ]: Socket2 path is too long. (2) IPC will not work.

The *request* socket kept answering `hyprctl` (both ends agree on a residual
truncated path), which is why this looked healthy while every observation
feature that needs events had nothing to read.

`/run/hypr-stream` is 16 characters. The rename reaches both units'
`RuntimeDirectory`, `WorkingDirectory`, `XDG_RUNTIME_DIR` and `HOME`, the
broker's `--compositor-runtime-dir`, the `socketPath` option default, the
`hhstream` CLI's frame-socket default and the `agent-eyes` helper.

An assertion now holds the name at <= 25 characters, the ceiling frozen in
docs/CONTRACT-sessions.md §5, so this cannot regress silently -- the failure
mode is a working request socket and a dead event stream, which looks like
nothing is wrong. Its message says what breaks and why the limit exists.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018YqpJb5aZvZQKb49QDnV7P
2026-10-02 00:05:48 +00:00
Hermenix 30f456c07e integrate the session broker: one CLI, a module unit, and a VM check
M0 of the sessions design, wired into the flake and gated by a real check.

What is here now:

- `src/hhstreamd/` — the broker: session registry, lifecycle verbs, process-group
  teardown, app allowlist, audit log, idle reaper on CLOCK_BOOTTIME.
- `src/hhstream_session/` — the CLI handlers, registered into the one front door.
- `src/hhstream/cli.py` — `hhstream status|shot|run|record|session …`, so the
  frame verbs and the session namespace are one binary.
- `nix/module.nix` — `sessions.*` options and the `hhstream-sessions.service`
  unit: the operator's own account (never a service account, because launched
  applications should see that account's home), the compositor's group as a
  supplementary group (without it a launched GUI client cannot open the Wayland
  socket), the generated app allowlist, and `--compositor-runtime-dir` so
  applications are handed the compositor's session rather than the broker's.
- `checks/vm-sessions.nix` — 18 subtests on a real compositor in a VM.

Two bugs found by driving it, both fixed:

- BUG-01: launched applications could not reach the compositor at all — the
  broker spawned them with its own inherited environment, which names the login
  session. `hhstreamd/compositor.py` discovers the socket and builds the child
  environment; a directory with no usable socket is a startup refusal, not a
  warning.
- BUG-02: `kill` refused to signal a live application and said nothing was
  wrong. The identity gate hashed `/proc/<pid>/cmdline`, which every `execve`
  replaces — and on NixOS applications are reached through wrapper scripts that
  do exactly that. The gate now rests on `starttime` (+ boot id, + session id
  where it is immutable) and records command-line drift as evidence of nothing.

KillMode=process is set on the unit on purpose: the default control-group kill
would take the applications down with the broker, which would make adoption and
a broker restart pointless.
2026-10-01 12:23:16 +00:00
Hermenix 9dc9e0da9a examples/agent-eyes: use the setuid sg wrapper, not whatever PATH offers
There are two `sg` on this box: the setuid wrapper in /run/wrappers/bin and a
plain symlink to shadow's sg in the system profile. A login shell has the
wrapper first and works; a cron job's PATH reaches the plain one, which cannot
switch groups and dies with "setgroups: Operation not permitted" — which reads
as "chromium exited immediately" once a consumer discards its stderr. The
helper now looks for a setuid `sg` explicitly and says so if there is none.
2026-10-01 04:00:01 +00:00
Hermenix 09903c5676 examples: agent-eyes subcommand helper (status/shot/run/record)
One front door to the headless session, for reuse by any consumer: it
discovers whichever wayland-N socket exists, re-execs itself under
sg hhstream when the login predates the group membership, and encodes
recordings at the measured frame rate so clips play at true speed.
2026-10-01 03:18:31 +00:00
Hermenix 2b32153c8b examples: README — measured capture costs, v3 window rules, hyprctl IPC caveat 2026-09-30 19:43:32 +00:00
Hermenix 1664ccf710 examples: follow the stream's format; wall guard checks URL, page text, and end of recording 2026-09-30 19:40:39 +00:00
Hermenix f667654f01 examples: sandboxed chromium by default, with a --no-sandbox fallback 2026-09-30 19:35:03 +00:00
Hermenix 36541d22f4 examples: windowed browser by default, so the session's desktop is visible 2026-09-30 19:21:30 +00:00
Hermenix bfb333e9ff examples: document the demo; strip ffmpeg metadata so Blossom accepts the mp4 2026-09-30 19:15:33 +00:00
Hermenix 1ce39ba210 examples: agent-eyes-demo.py -- drive a browser on the headless screen and film it 2026-09-30 18:47:24 +00:00