cmux NEXT: one-click Add Machine (install, harness, peers both ways, doctor)
Draft. One-click Add Machine for cmux NEXT. It is item 1 on the machine-mesh product map (cmuxterm-hq#2692).
The user types a host or picks a Tailscale peer, and cmux sets it up end to end:
- checks that key-only ssh works;
- installs cmux-tui, which carries acpmux;
- copies the harness profiles across;
- starts the agent daemon;
- registers the acpmux peer both ways;
- names the machine;
- shows a health checklist (doctor, with --fix).
The contract is in plans/cmux-next/add-machine-DESIGN.md. The logic is in Rust (cmux-tui acp host enroll|doctor|candidates), and the app adds machine.add / machine.doctor on top of it. Nothing depends on leo-workspace.
Still to come: installer and doctor (Rust), peer registration and Tailscale candidates (Rust), and the UI (Swift).
Agent session: cosmic-gray
š¤ Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Implements the one-click Add Machine flow for cmux NEXT: the enroll/doctor checklist, peer registration, and the tailnet candidate list now run on the design doc and step contract, with the app's Add Machine card and Machines section wired on top.
cmux-tui acp host enroll|doctor|candidatesrun the seven-step sequence (reach, install, daemon, harness, peer, peer-back, identity) as one JSON line per step;doctorchecks only unless--fix. Step lines carry an optionalreason: only install's wrong-platform/not-this-program makes the app install its own build and enroll again.- Peer steps register the machine over ssh and, only with
--reverse, register this machine back on the host; the app never passes--reverse. The peer url uses the daemon's port (ssh://host, elsessh://host:port), sodoctorpasses and--fixrepairs a peer on another port. All ssh calls go through aRemotetrait so tests use a fake host. - The daemon step shares
host setup's installer: a puredaemon_configwrites the websocket config over stdin to a fixed script, so the token is never in a command line, and the Linux restart via the user systemd unit runs in the shared installer. - On a Mac with cmux, install and daemon detect the app-bundle acpmux from the remote daemon's status (
exeandrunsAsCmuxTuiAcp, never argv; old daemons count as cmux's own) and won't push a second binary or start a second daemon beside the app's; the build-skew fix text follows the daemon's executable alone, a stopped app daemon fails with "open cmux on HOST", and a daemon started through~/.local/bin/acpmux's link stays repairable bydoctor --fix. - The tailscale CLI wrapper moved from
cmux-tuiintoacpmux::tailnetso the app's remote hosting andhost candidatesshare it;acpmuxis now an all-platform dependency ofcmux-tui. host candidates --probeprobes only the user's own machines, at most 32, and the probe deadline and cancel both signal the run's process group; the card shows the plain list first and keeps it if the probe fails.- An unhealthy report fails like other commands (JSON error envelope, exit 1, no
process::exit), and the remote acpmux home is oneREMOTE_HOMEconstant that install, doctor and enroll all build paths from. - The UI (
machine.add,machine.doctor) opens a floating card that fills the checklist live, the Name field names the machine in the sidebar, and cancel signals the run's process group.machine.addwith a destination only fills the card; Add starts the run. A cancel before the CLI launches means no launch at all, andfinished()waits through a run that Fix or Try Again replaced. - Merged with the latest
feat-cmux-next, including base's push_binary executable change (#23172) ported into enroll's install check; the generated action exports were re-merged three-way and their counts recomputed, and the settings exports keep base's defaults snapshot and stamp (this PR's only stamped change isSettingsSchema.swift). - Still out of scope: ssh key/config changes, sudo, and cloud machines.