Repository navigation
Conversation
…here
Each daemon under `daemons` in settings.yaml is reached by running
`hmz web --attached` over ssh, with a loopback port forwarded to it, and
proxied at /d/<name>/api/... (SSE and uploads streamed) with its own key;
/d/local/api/... is this machine. A missing or other hmz there is installed
at this version with uv tool install, never while its daemon may hold
running epics. Adds /api/daemons/{name}/state and /connect.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| handler.send_response(answer.status, answer.reason) | ||
| for name, value in answer.getheaders(): | ||
| if name.lower() not in _KEPT: | ||
| handler.send_header(name, value) |
| handler.send_response(answer.status, answer.reason) | ||
| for name, value in answer.getheaders(): | ||
| if name.lower() not in _KEPT: | ||
| handler.send_header(name, value) |
Member
Author
|
Landed together in #385. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unit 4 of the multi-daemon + notifications plan (contract C5).
What
src/hmz/web/remote.py:Remotes(held assite.remotes) withstate,reached-> (local port, key),connect,close, plusasks-> (port, headers to be let in). It reads the C1 entries straight fromcoganchor.settings.read()['daemons']and builds ssh from them throughSSHRuntimeandtransport.Road, so the same options and ControlMaster reuse apply, withBatchMode=yesadded.hmz --versionand the remote daemon'sdaemon.jsonpid in every temp dir.uv tool install --force --python '>=3.12' 'hmz==<ver>', first getting uv0.12.24through astral's pinned installer if the remote has none. While installing, the state isinstallinganddetailis uv's last line.detail. A0.0.0build installs nothing.hmz web --no-open --attached --port 0and forwards a local port to it with its ownssh -L(no mux). The local port is the same number as the remote one where that is free./d/<name>/request, or onconnect.closestops and reaps every child.src/hmz/web/proxy.py: streams the request body (refusing chunked bodies) and the response, SSE included.hmz-<remoteport>=<key>withOriginandSec-Fetch-Site: same-origin.Set-Cookie.site.py: dispatches/d/<name>/api/....localmaps to the local handlers. Other names are proxied only after the existing key, origin and same-page-write checks.GET /api/daemons/{name}/stateandPOST /api/daemons/{name}/connect.GET /api/daemonsis left to unit 3.Tests
tests/integration/doubles_ssh.pyprovides a fakesshthat runs the command locally under a second HOME, HUMANIZE_HOME and TMPDIR and forwards-Lover TCP. It also provides a fake remotehmzwith a settable version, and a fakeuv.tests/integration/test_web_remote.pycovers: connect, proxy GET, POST and an upload, SSE passthrough, the auth refusals, the failed state, close reaping its children, install of a missing or other version, the busy remote left alone, a 0.0.0 build, and a removed entry.tests/unit/web/test_remote.pycovers the pure helpers.pre-commitis green apart from pyright errors on macOS that were already there, in Linux-only modules.pytest tests/unitandtests/integration/test_web_*.pypass./d/box/api/held,/d/box/api/runs,/api/daemons/box/stateand the SSE stream all answered. The remotehmz webwas gone after a SIGTERM and after a SIGKILL of the local one.ssh localhostrun.Specs and user docs are units 1 and 12.
🤖 Generated with Claude Code