ca5e309e511a1221ad25ba623de97accf59fb4c6
`hhstream_mcp` serves the whole `hhstream` surface -- the four frame verbs, the ten session verbs, the eight pointer verbs and the four keyboard verbs -- as 26 MCP tools over stdio, so an agent drives this desktop through typed tools instead of writing command lines. It is a shim and nothing more. Each tool builds the argv list the CLI's own parser takes, hands it to the CLI's own handler **in this process**, and maps what came back. The idle clock, the pointer lease, the allowlist, the exit-code table and every refusal message stay where they already were. Four decisions worth stating, each argued at length where it lives: * **One tool per verb**, not one per family with an `action` enum. The arguments do not rhyme, the two rules an agent gets wrong have to be on the tool it gets wrong, and `readOnlyHint` is a real per-verb distinction here -- `session_container` with an id runs `container.reconcile`, so it is not marked read-only. * **In process, not as a subprocess.** `hhstream.cli`'s parser already takes an argv list and its handlers already return a code from the frozen table. Two of its paths cannot be called here and both end in an `exec` that would replace this server: `main`'s `sg` re-exec, and `cmd_run`'s `execvpe`. The first is therefore unavailable and said out loud (`access_hint`); the second is why `run` goes through `posix_spawn` into its own session. * **The transport leaves file descriptor 1.** The CLI prints, and `record` spawns an `ffmpeg` whose output it does not capture. `claim_transport` takes a private duplicate of stdin and stdout at start-up and points fd 1 at the log, so a stray write is a log line and never a corrupted JSON-RPC stream. * **No state, and the lease is an argument.** The CLI caches a lease id between invocations because its surface is flagless; this passes `--lease` on every call and never reads that cache. A cached lease is a lease an agent cannot see. Refusals come back as tool errors -- never as a success -- carrying the remedy sentence, the CLI's own `error`/`reason`/`hint`, everything it said, and the frozen exit code in `structuredContent`. Exits 8 and 9 are held apart by a test, because an agent that sees 8 must wait and one that sees 9 must acquire. The root pyproject excludes `hhstream_mcp*` from package discovery: without that, `packages.hhstream` would ship a module whose first import line fails. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011ZeH65zd6pFTgBSu52W9PE
hyprland-headless-stream-plugin
A Nix flake that runs a headless Hyprland session and publishes its frames on a persistent Unix socket, so any process that can open a socket can see the screen without owning a display.
Two parts:
- NixOS module —
services.hyprland-headless-stream: starts Hyprland with no physical monitor, and a small frame server beside it. - Package —
hhstream— the frame server (publishes frames) and its client (reads them). Pure Python standard library.
{
inputs.hhstream.url = "git+https://<host>/git/<owner>/hyprland-headless-stream-plugin.git";
# in your host config
imports = [ inputs.hhstream.nixosModules.default ];
services.hyprland-headless-stream = {
enable = true;
# Optional: the default is one 1280x720@30 rule with an empty name, which
# is Hyprland's wildcard and applies to whatever outputs the GPU has.
outputs = [ { width = 1920; height = 1080; refresh = 60; } ];
};
}
Then any consumer:
hhstream-client --socket /run/hypr-stream/stream.sock --count 1 --out frame.png
The socket is a plain file descriptor: the server serves every client that connects, and keeps running when one disconnects.
| Document | What it is |
|---|---|
docs/CONTRACT.md |
the wire protocol and the module surface — the interface other people build against |
docs/ARCHITECTURE.md |
how the pieces fit: compositor, capture, server, client |
README.dev.md |
how to build, test and hack on it |
examples/README.md |
the demo that films the screen: agent-eyes-demo.py |
Status: work in progress — the module and the test suite are being built.
Languages
Python
81.7%
Nix
18.1%
Shell
0.2%