Skip to main content

Module remote

Module remote 

Source
Expand description

Remote apply path: PC shells out to OpenSSH and runs the CLI agent on a box.

Default path never writes the box authorized_keys. Key install is explicit opt-in via RemoteOptions::install_ssh_key.

Modulesยง

arch ๐Ÿ”’
Map box uname -m to GitHub Release target triples.
askpass ๐Ÿ”’
Resolve an OpenSSH askpass binary for Desktop / non-TTY SSH login.
bins ๐Ÿ”’
Local Release cache and --bin-dir resolution for box binaries.
ecosystem ๐Ÿ”’
Shared status-api + MCP install (remote payload and embedded full apply).
host ๐Ÿ”’
OpenSSH host target: config Host alias or user@host.
process ๐Ÿ”’
Injectable process runner for OpenSSH / curl / tar (unit-testable).
runner ๐Ÿ”’
High-level remote apply: probe arch, drop CLI agent, run setup, install payload.
ssh ๐Ÿ”’
OpenSSH session helpers (ssh, scp, ssh-copy-id).
surfaces ๐Ÿ”’
Cross-surface probes: SSH, box CLI, status-api, MCP (PC + box).
transfer ๐Ÿ”’
File transfer: scp first; prefer rsync -e ssh when both ends have it.

Structsยง

ApiSurfaceProbe
Status-api HTTP (+ optional unit via SSH).
CliSurfaceProbe
Box CLI probe row.
CommandOutput
Captured stdout/stderr and exit status from an external program.
EcosystemInstallChoice
Which ecosystem services to install (user opt-in, default neither).
HostSpec
Destination passed to ssh / scp as the remote operand.
LocalBins
Paths to box binaries after cache extract or --bin-dir.
McpHostProbe
MCP readiness on one host (PC or box): stdio runtime + HTTP.
RemoteBoxSnapshot
Setup status + doctor from the box without uploading (TUI r).
RemoteCliProbe
Result of probing CLI binaries already on the box (no SCP).
RemoteOptions
Options for a remote OpenSSH session and binary source.
RemoteOptionsInput
Common inputs shared by CLI, TUI, desktop, and MCP when building RemoteOptions.
RemoteRunFlags
Boolean switches for a remote CLI run.
RemoteRunOutcome
Result of a remote CLI run (log text plus optional captured status-api bearer).
RemoteRunRequest
CLI arguments to run on the box via the uploaded agent (without the binary name).
SshEnv
Environment overrides for Desktop askpass (and related OpenSSH knobs).
SshSession
SSH destination plus askpass policy.
SshSurfaceProbe
SSH reachability / key auth.
SurfaceProbeReport
Full surface probe for tip + box.
SystemProcessRunner
Default runner that spawns real OS processes.

Enumsยง

BoxArch
Box architecture labels used for Release assets and local cache paths.
RemoteBoxCliStatus
How to show the box CLI after SSH was attempted.
StdioMode
How child stdio is connected.

Constantsยง

API_TOKEN_DROP_BASENAME
User-owned drop file basename for token capture (remote).
BOX_BIN_NAMES
Filenames expected in a full box Release tar (MCP may be absent).
DEFAULT_GITHUB_REPO
Default GitHub repo that publishes box Release tar.gz assets.
DEFAULT_INSTALL_DIR
Permanent install directory for CLI + TUI + status-api + MCP on the box.
DEFAULT_REMOTE_AGENT_DIR
Remote directory for the temporary CLI apply agent.
ENSURE_API_TOKEN_SCRIPT
Ensure /etc/horto-os-ui/api.env exists with a random bearer token (0600).
MCP_UNIT
MCP systemd unit from packaging (kept in sync via include_str!).
MIN_API_TOKEN_HEX_LEN
Minimum tip bearer length. Box install writes 64 hex chars; shorter leftovers (including unit-test junk) must never be treated as a real Status API token.
STATUS_API_UNIT
Status-api systemd unit body (ExecStart defaults to /usr/local/bin).

Traitsยง

ProcessRunner
Runs external programs (real OS or a test double).

Functionsยง

asset_name
Release tarball file name for a version + target triple.
box_arch_from_uname
Parse uname -m output into a supported box architecture.
cache_bin_dir
Cache directory for one release tag + version + arch.
classify_ssh_failure
Classify OpenSSH failure text into auth vs unreachable (best-effort).
default_cache_root
Default XDG cache root: $XDG_CACHE_HOME/horto-os-ui/remote-bins or ~/.cache/....
default_release_tag
Default GitHub Release tag for a Cargo version (0.1.0 โ†’ v0.1.0).
ensure_local_bins
Resolve box binaries from --bin-dir or download+extract a Release tar.gz.
finish_save_api_token
Finish a save-token prompt given the raw answer (test seam).
format_surfaces_report
Human-readable multi-line report (CLI surfaces).
http_get_label
Minimal HTTP/1.0 GET label for probes (no extra HTTP crate).
install_ecosystem_after_embedded_apply
Resolve local bins and install selected ecosystem services after embedded full apply.
install_ecosystem_services
Install selected ecosystem bins into install_dir and enable chosen units.
local_api_token_path
Path to the local tip API token file (UI display only).
normalize_cli_version
First line of horto-os-ui --version / long-version output.
offer_save_api_token
Propose saving the status-api bearer to ~/.config/horto-os-ui/api_token.
parse_api_token_drop
Parse drop-file contents: HORTO_API_TOKEN=<hex> or bare hex.
parse_host_spec
Parse a non-empty Host alias or user@host string.
parse_remote_json
Parse the first JSON object/array from remote captured output.
prefer_rsync
True when local rsync exists and the remote host has rsync on PATH.
probe_api_surface
Probe status-api only.
probe_cli_surface
Probe box CLI only.
probe_mcp_surface
Probe MCP PC + box only.
probe_remote_cli
Probe install-dir then agent-dir CLI versions over SSH (never SCP).
probe_ssh_access
BatchMode SSH true against the box (no password prompt).
probe_ssh_surface
Probe SSH only (BatchMode).
probe_surfaces
Probe all surfaces for a remote host, or loopback when embedded.
pull_remote_api_token
Pull the box Status API bearer over SSH (sudo) and save the tip file.
read_local_api_token
Read local tip bearer when present (hex only).
release_download_url
GitHub Release download URL for a box tar.gz asset.
release_tag_is_immutable
Whether a Release tag is treated as immutable for the local remote-bins cache.
remote_box_snapshot
Probe CLI version, then fetch setup status and doctor when current. Never SCP.
remote_cli_version_is_current
Whether a remote --version line matches this PCโ€™s baked LONG_VERSION.
remote_doctor
Fetch doctor JSON from the box.
remote_doctor_report_banner
Log the remote doctor JSON header (stderr via tracing).
remote_enable_ecosystem_script
Shell fragment: install selected bins/units from staging.
remote_ensure_ssh_key
Opt-in: install the tip pubkey on the box (ssh-copy-id).
remote_install_key_banner
Operator banner before ssh-copy-id (pubkey path included).
remote_install_payload
Copy CLI + TUI + status-api (+ MCP when present) into install_dir and enable units.
remote_probe_arch
Probe uname -m on the remote host.
remote_progress_message
Format an operator progress banner for remote SSH/SCP/key steps.
remote_reboot
Issue sudo reboot on the box (CLI: password on the terminal via Inherit).
remote_reboot_with_sudo_password
Issue sudo reboot using a sudo password already collected by the UI.
remote_run_banner_detail
Detail line for a remote CLI run banner.
remote_run_cli
Upload the CLI agent (if needed), optionally install a public key, run a remote CLI command.
remote_setup_run
Convenience: remote setup run with optional payload install.
remote_setup_status
Fetch setup step status from the box (setup status, JSON when supported).
remote_upload_cli
Upload the PC CLI to the box agent dir (s0 / explicit sync).
resolve_local_ecosystem_bins
Resolve ecosystem binaries for embedded install.
scp_files
Copy one or more local files to a remote directory using scp.
transfer_files
Copy files with rsync when available, otherwise scp.
unit_with_install_dir
Rewrite default /usr/local/bin/ ExecStart paths for a custom install prefix.
usable_api_token_hex
Return trimmed hex when it is usable as a tip Status API bearer.
wants_reboot_now
Whether a reboot prompt answer means reboot now.
write_api_token_file
Write hex bearer to the local config path with mode 0o600.