Merge feat/mcp-server (9708154) into feat/mcp-auth
The base branch moved twelve commits while this work was in flight --
including the per-session live stream and its own contract bump -- so this
integrates rather than leaving a PR nobody can merge. Six files
conflicted; the interesting resolutions are the two that were not
textual.
**The contract is mcp-v3.1, not v2.1.** This branch bumped v2 -> v2.1 for
an additive change; `feat/mcp-server` bumped v2 -> v3 for the live stream,
also additive. Both point releases, both correct, and they cannot both be
the same document. So v3 stands as written and the HTTP transport is the
point release on top of it, by the same rule each of us applied
independently: v2 is still the only major bump, because it is still the
only one that removed anything.
**The counts are no longer literals.** This branch asserted `21 tools` and
`5 resources` in `checks/vm-mcp-http.nix` and `5` in `test_mcp_http.py`;
the stream added two tools and one fixed resource, so the surface is 23
and 6. Rather than re-hardcode numbers that will go stale again, the
check now counts against `--list-tools` and `--list-resources` -- the
server's own table -- and the unit test against `resources.FIXED`. That
is the lesson 9708154 ("count the unnarrowed resources against the
listing, not a literal") had already learned on the other side of this
merge, arrived at twice. A stale number here would have failed in a way
indistinguishable from the HTTP transport dropping tools, which is the
one thing those subtests exist to catch.
The rest were additive on both sides and both halves are kept: the TODO
table, the checks wiring, the README check rows, the architecture diagram
(their 23/10 counts with this branch's two-transport annotation).
`nix/module.nix` needed reconstructing -- git interleaved the bodies of
`hhstream-live` and `hhstream-mcp` because both units land between the
same surrounding lines -- so the live unit is taken verbatim and the MCP
unit placed after it, with this branch's options, tmpfiles entry,
firewall rule, two assertions and two warnings re-applied on top.
One thing deliberately NOT touched: the v3 change table cites `§6` for the
idle-clock exception, but the rule it means is `§8`. That is the other
branch's prose and its author's call, not something to quietly rewrite in
a merge.
Verified after resolution: 394 unit tests pass, and the module evaluates
with both units, the right ExecStart, one firewall port and both
warnings.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KchcvnbfhhZhUHy83YL3Ya
This commit is contained in:
commit
f83717ba71
37 files changed
+4241
-101
No files matched your search
+27
-8
@@ -26,9 +26,17 @@
|
||||
│ hhstream-sessions.service │─────▶│ hhstream-pointer.service │
|
||||
│ hhstreamd │ │ one Wayland connection │
|
||||
│ registry, containers, │ JSON │ one virtual pointer │
|
||||
│ the pointer lease │ over │ per output │
|
||||
└────────────┬──────────────┘ a └──────────────────────────┘
|
||||
│ private socket
|
||||
│ the pointer lease, │ over │ per output │
|
||||
│ the stream phrases │ a └──────────────────────────┘
|
||||
└────────────┬────────┬─────┘ private socket
|
||||
│ │ ┌──────────────────────────┐
|
||||
│ └─────────────▶│ hhstream-live.service │
|
||||
│ live.sock │ one port (9988) │
|
||||
│ │ grim ─▶ MJPEG per │
|
||||
│ │ phrase, while watched │
|
||||
│ └───────────┬──────────────┘
|
||||
│ │ HTTP
|
||||
│ a browser ┘ /<phrase>/
|
||||
│ AF_UNIX control.sock, mode 0660
|
||||
▼
|
||||
hhstream session ... (the CLI an agent drives)
|
||||
@@ -37,12 +45,12 @@
|
||||
│
|
||||
┌────────────┴──────────────┐
|
||||
│ hhstream-mcp │ stdio: spawned per client
|
||||
│ 21 tools (the acts) │◀─── an MCP client's JSON-RPC
|
||||
│ 8 resources (the state)│ http: one unit, one port,
|
||||
│ 23 tools (the acts) │◀─── an MCP client's JSON-RPC
|
||||
│ 10 resources (the state)│ http: one unit, one port,
|
||||
└───────────────────────────┘ a bearer token per request
|
||||
```
|
||||
|
||||
Five pieces, deliberately separate, and a sixth that is deliberately not a
|
||||
Six pieces, deliberately separate, and a seventh that is deliberately not a
|
||||
piece at all:
|
||||
|
||||
1. **The compositor** (`Hyprland`, unchanged upstream) renders into virtual
|
||||
@@ -62,9 +70,20 @@ piece at all:
|
||||
a separate process because a Wayland client needs its own connection and a
|
||||
driver blocked on the compositor must not stall session lifecycle.
|
||||
|
||||
And the sixth, which is a *shim* and not a layer:
|
||||
6. **The stream daemon** (`hhstream-live`) publishes one session's output as
|
||||
MJPEG on one port, behind a four-word phrase, while somebody is connected.
|
||||
A third executor on the pointer driver's pattern and for its reasons: `grim`
|
||||
blocks tens to hundreds of milliseconds so it must not run where `touch` and
|
||||
`kill` are answered, and a LAN-facing HTTP parser must not run in the frame
|
||||
server whose one-socket contract cannot grow one. The broker owns the
|
||||
*decision* (which session, under which phrase, in the record); the daemon
|
||||
owns the port, the capture and the URL. It knows nothing about sessions or
|
||||
idle clocks — it publishes what it is told to publish, and reports a viewer
|
||||
count the broker chooses to read as activity.
|
||||
|
||||
6. **The MCP server** (`hhstream-mcp`, `docs/CONTRACT-mcp.md`) is the CLI with a
|
||||
And the seventh, which is a *shim* and not a layer:
|
||||
|
||||
7. **The MCP server** (`hhstream-mcp`, `docs/CONTRACT-mcp.md`) is the CLI with a
|
||||
Model Context Protocol surface on it, so an agent reads state by URI and
|
||||
acts by calling tools instead of writing command lines. It is drawn above
|
||||
the CLI rather than beside the broker because that is where it sits: every
|
||||
|
||||
Reference in new issue
Block a user