daemon/remote/README.md
Go remote daemon for cmux ssh bootstrap, capability negotiation, and remote proxy RPC. It is not in the terminal keystroke hot path.
cmuxd-remote versioncmuxd-remote serve --stdiocmuxd-remote cli <command> [args...] — relay cmux commands to the local app over the reverse SSH forwardWhen invoked as cmux (via wrapper/symlink installed during bootstrap), the binary auto-dispatches to the cli subcommand. This is busybox-style argv[0] detection.
hellopingproxy.openproxy.closeproxy.writeproxy.stream.subscribeproxy.stream.data / proxy.stream.eof / proxy.stream.error eventssession.opensession.closesession.attachsession.resizesession.detachsession.statusCurrent integration in cmux:
workspace.remote.configure now bootstraps this binary over SSH when missing.hello before enabling remote proxy transport.proxy.* RPC over serve --stdio, using daemon-pushed stream events instead of polling reads.workspace.remote.status -> remote.daemon (including session.resize.min).workspace.remote.configure contract notes:
port / local_proxy_port accept integer values and numeric strings; explicit null clears each field.invalid_params.local_proxy_port is an internal deterministic test hook used by bind-conflict regressions.StrictHostKeyChecking and control-socket keys prevent default injection.Release and nightly builds publish prebuilt cmuxd-remote binaries on GitHub Releases for:
darwin/arm64darwin/amd64linux/arm64linux/amd64The app embeds a compact manifest in Info.plist with:
Release and nightly apps download and cache the matching binary locally, verify its SHA-256, then upload it to the remote host if needed. Dev builds can opt into a local go build fallback with CMUX_REMOTE_DAEMON_ALLOW_LOCAL_BUILD=1.
To inspect what a given app build trusts, run:
cmux remote-daemon-statuscmux remote-daemon-status --os linux --arch amd64The command prints the exact release asset URL, expected SHA-256, local cache status, and a copy-pasteable gh attestation verify command for the selected platform.
The cli subcommand (or cmux wrapper/symlink) connects to the local cmux app through an SSH reverse forward and relays commands. It supports both v1 text protocol and v2 JSON-RPC commands.
Socket discovery order:
--socket <path> flagCMUX_SOCKET_PATH environment variable~/.cmux/socket_addr file (written by the app after the reverse relay establishes)For TCP addresses, the CLI dials once and only refreshes ~/.cmux/socket_addr a single time if the first address was stale. Relay metadata is published only after the reverse forward is ready, so steady-state use does not rely on polling.
Authenticated relay details:
~/.cmux/relay/<port>.auth, which is written with 0600 permissions and removed when the relay stops.Integration additions for the relay path:
~/.cmux/bin/cmux wrapper and keeps a default daemon target (~/.cmux/bin/cmuxd-remote-current).ssh -N -R process reverse-forwards a TCP port to the authenticated local relay server. The relay address is written to ~/.cmux/socket_addr on the remote.~/.cmux/relay/<port>.daemon_path so the wrapper can route each shell to the correct daemon binary when multiple local cmux instances or versions coexist.~/.cmux/relay/<port>.auth with the relay ID and token needed for HMAC authentication.