--- name: rockd-remote-control description: >- Control a remote computer with the RockDesk command line `rds`, by its 9-digit ID: shell, files (copy / sync / mount), screenshots, mouse and keyboard, clipboard, port / serial / USB forwarding, 内网穿透 (VPN). Needs the RockDesk app on both machines: if `rds` is missing, send the user to https://rockdesk.io/#download first. Triggers: "RockDesk", "rds" with a 9-digit ID, "剪贴板历史", "内网穿透", "挂目录", "screenshot the remote", a 9-digit ID plus an action, or any request to operate another machine. --- # RockDesk CLI (`rds`) & Agent Skill > **Needs the RockDesk app on both machines.** Download it at > https://rockdesk.io/#download (in China: https://rockdesk.cn/#download). RockDesk is a cross-platform remote-access tool. Its engine, rockd, comes as a background daemon (`rockd`, also running inside the app), the app, and a scriptable command line, `rds`, which lets an AI agent drive another machine headlessly. Every machine has a 9-digit **ID** (shown in the app and by `rds status`). `rds` itself never touches the network. It hands each command to the local rockd daemon. The daemon keeps one encrypted QUIC connection per peer and reuses it for every later command. That connection goes direct when it can punch through, and through the server's relay otherwise. The first command to a peer takes a moment (connect, maybe authorize); the rest are near-instant. No GUI window opens. Output and error messages are in Chinese. ## First: is RockDesk installed? **Before your first `rds` command, check that RockDesk is installed and running on this machine** (`rds status`, see the next section). This skill only teaches the commands. The work is done by the RockDesk app, which must be installed and running on **both** machines: this one (where `rds` runs) and every machine you want to control. - **Not installed here** (`rds` isn't found and there is no RockDesk app, or `rds status` can't reach the background service after starting the app): stop and tell the user, in their language, that this needs the RockDesk app on this computer and on the one they want to control, and give them the download page: **https://rockdesk.io/#download** (in China: **https://rockdesk.cn/#download**). There are a Windows installer, Linux .deb packages (x86_64: Ubuntu 20.04+, Debian 12+; arm64: Ubuntu 22.04+, Debian 12+), macOS .dmg (Apple silicon or Intel) and an Android .apk. Direct links that always point to the newest release (in China, use rockdesk.cn instead of rockdesk.io in them): - Windows: https://rockdesk.io/download/latest/windows (an .exe installer). It is not code-signed yet. To install it for the user, download it with PowerShell (`Invoke-WebRequest -OutFile $env:TEMP\rockdesk-setup.exe`) or curl.exe and run it silently (`Start-Process $env:TEMP\rockdesk-setup.exe -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' -Wait`): a file downloaded that way has no download mark, so SmartScreen does not stop it. It needs administrator rights, so the user may have to approve a UAC prompt. If the user downloaded it in a browser and Windows says "Windows protected your PC", they click "More info", then "Run anyway". - macOS, Apple silicon: https://rockdesk.io/download/latest/macos; Intel: https://rockdesk.io/download/latest/macos-x86_64 (open the .dmg, drag the app into Applications and open it once) - Linux x86_64: https://rockdesk.io/download/latest/linux-amd64; arm64: https://rockdesk.io/download/latest/linux-arm64 (a .deb: `curl -fL -o rockdesk.deb https://rockdesk.io/download/latest/linux-amd64 && sudo apt install ./rockdesk.deb`) - Android: https://rockdesk.io/download/latest/android (an .apk) You may offer to download and install it for them, but ask first. The version and release notes are in https://rockdesk.io/rockd-latest.json. New devices start with a free trial. The web version at https://rockdesk.io/web/ is for people and has no `rds`. - **On the machine to control:** RockDesk has to be installed there too. The user reads its 9-digit ID in the app and decides how you may get in (see Authorization below). A Linux machine without a screen: `sudo systemctl enable --now rockd`, then `sudo rds otp` prints a one-time password. ## Find `rds` and check that it works `rds` is installed with RockDesk: - Linux .deb: `/usr/bin/rds` - Windows: `C:\Program Files\rockd\rds.exe` - macOS app (1.0.3 and later): `/Applications/rockd.app/Contents/MacOS/rds` - Source build: `target/release/rds` - **Check:** `rds status` prints `本机 (…) ID 服务器 已连` followed by the live connections. If it says `连不上本机的 rockd(…):后台没起来?`, the daemon is not running: start the RockDesk app, or with the .deb run `systemctl --user start rockd`. On Windows it is the `rockd` system service. - Put its path in a variable and always use it: `RDS=/path/to/rds`. Everything below is written as `$RDS`. - **Config dir** (identity, permissions, clipboard history): `~/.config/rockd/`. On Windows it is `%APPDATA%\rockd`, or `C:\ProgramData\rockd` for the system service; for the Linux system service it is `/var/lib/rockd` (root's `rds` finds it, so run `sudo rds …` there). `--dir ` or `$ROCKD_DIR` overrides it. ## For agents (read first) - **Shell first, GUI second.** Anything doable in a shell, do with `$RDS shell -c "…"`: it is faster, deterministic and needs no coordinates. Use mouse and keyboard only for GUI-only things. - **Interactive `$RDS shell` is for humans.** Agents always pass `-c`. - **One command, one round trip.** Chain logic inside one `shell -c` (`cd … && grep … | head`) rather than many calls. - **GUI work: observe → act → verify.** Take a screenshot to a file, read the image, find the pixel, act, then take another screenshot. Never click blind. - **Permissions come from the peer.** If a command is refused, don't retry in a loop. Tell the user what the peer has to allow (see Authorization). - **Safety.** - Only operate machines the user owns or is authorized to control. - Before anything destructive or irreversible, say what you will run and get confirmation. That includes deleting, overwriting, restarting services, sending messages, `sync --delete`, and `clip history rm/clear`. - Read-only inspection needs no confirmation. - Never type the user's passwords or secrets into remote fields. - Clipboard history can hold secrets (passwords, codes, tokens). Don't send it to third-party services unless the user asked. --- ## Machine & connection (本机、连接) ``` $RDS status [--json] This machine's name, ID and server state; LAN peers; every live connection with its paths (direct / LAN / relay, RTT, loss). $RDS ping Connect if needed and measure: "(name):建连 N ms,往返 N ms,走 ". $RDS log [n] [--json] Connection log: who connected to me, whom I connected to, which services, how long, direct or relayed. $RDS wake [--port 9] Wake-on-LAN magic packet (needs a MAC this machine saw on the LAN). $RDS login | logout | devices [--json] | account Account (email-code login); devices on the same account; license. ``` `` may also be `IP:port`, `[IPv6]:port` or `host:port` to connect directly without the server. The peer asks for confirmation or a password the first time. ## Authorization (谁能连我) The **peer** decides. There is no per-ID allow list (an ID alone is not proof). A host offers up to three ways, any combination: 1. **Allow when someone connects.** Someone at the peer clicks "allow"; it covers that one connection. `rds` keeps retrying every 2 s while it waits. 2. **One-time password.** Shown on the peer's home page (or `$RDS otp` run on the peer); it changes after each use. 3. **Fixed password and / or key pair (either or both):** - *Fixed password:* anyone who knows it can connect. Give it with `$RDS auth` (prompts once) or `RDS_PASSWORD=… $RDS …`; it is remembered (`keys.json`, not plaintext) until the peer changes it. - *Key pair (like ssh):* every device holding the same key connects to the others without a password. On one device `$RDS key gen`; then `$RDS key export` there and `$RDS key import ""` on each of your other devices. A device holding the key signs a challenge bound to the connection automatically when refused. (Extra keys or single devices can also be listed in the peer's `authorized_keys`, see `$RDS authorize`.) What you can use: everything with the key pair, or when your device is on the same RockDesk account and proved a password. Otherwise only the features the peer enabled (`$RDS config` there shows them). **Machines without a screen** (servers, robots, dev boards; Linux .deb 1.0.10+): ``` sudo systemctl enable --now rockd # system service: starts at boot, config in /var/lib/rockd sudo rds status # this machine's ID sudo rds otp # its current one-time password (sudo rds otp new: a fresh one) ``` - There, people who come in with the one-time password may also use the terminal and port forwarding (file transfer was already on), and "allow when someone connects" is off (nobody is there to click). - Fixed password: `sudo rds passwd` (prompts twice; `--clear` removes it). - Key pair, like ssh: on your own computer `$RDS key gen` once (later `$RDS key` prints the same public line); on the headless machine `sudo rds authorize ""`. Your computer then gets in with no password and can use everything. - What others may use: `sudo rds config` lists it; `sudo rds config feature on|off` changes it; `sudo rds config otp off` / `ask on` switch the one-time password / the allow dialog. - With a one-time password, prove it once (`RDS_PASSWORD=… $RDS shell -c …` or `$RDS auth`); later commands on the same connection don't need it again. Setting up a host from the command line (no GUI needed): on a machine without a screen use the system service above. On a desktop you can also run the per-user daemon without the app: `systemctl --user enable --now rockd` (plus `sudo loginctl enable-linger $USER`, so it keeps running after you log out). The first start writes a default config: the official server, one-time password on. `$RDS status` shows the ID; `$RDS otp` prints the current one-time password (`$RDS otp new` makes another). For lasting access: `$RDS passwd` (fixed password) and / or `$RDS key gen | import | export | clear` (key pair); both work immediately. `$RDS config` shows / changes the rest (`ask on|off`, `otp on|off`, `feature on|off`, `name`, `port`, `term-keep`); `$RDS login `. A refusal says what is missing (password, a click, a feature that is off). Don't guess passwords. If you're refused, report which of these is missing. ## Terminal (终端) ``` $RDS shell -c "" Run one command in the peer's login shell. Prints stdout+stderr and exits with the remote command's exit code, so `&&`, `||` and `if` work like ssh. Piped local stdin is forwarded: cat data.csv | $RDS shell -c "wc -l" No timeout: a long build runs to the end (wrap with a local `timeout` if you need one). Unix peers run it with `$SHELL -lc` (profile sourced: PATH, conda …). Windows peers run it with `powershell -NoProfile -NonInteractive -Command`, so use PowerShell syntax there; the exit code of a failing external program still comes back. $RDS spawn "" Start a detached process on the peer that outlives the call (servers, long jobs): → spawned pid 12345 · log: $RDS shell Interactive TTY for a human (ConPTY on Windows). $RDS shell --list [--json] Sessions the peer keeps after a disconnect (30 min by default). $RDS shell --attach Reattach to a session (replays what you missed). $RDS shell --close Close a session. ``` - **Windows peers running the rockd service** (the installer's default): `shell` and `spawn` run inside the service, as SYSTEM in session 0, not in the signed-in user's desktop session. A GUI program started there never appears on screen, and `~`, Desktop and `%APPDATA%` are SYSTEM's, so use full paths such as `C:\Users\\Desktop`. To open a program or a URL on the user's desktop, use the keyboard: `$RDS key win+r`, then `$RDS type "msedge https://example.com"`, `$RDS key Return`, and take a screenshot. ## Files (文件) ``` $RDS cp Exactly one side is the peer's, prefixed with ':'. upload: $RDS cp ./a.tgz :/home/u/a.tgz download: $RDS cp :/etc/hosts ./hosts Folders are copied recursively (scp rules). Re-running an interrupted copy of a file of 8 MB or more resumes where it stopped. $RDS sync [--delete] [--dry-run] One-way folder sync (one side ':'-prefixed). Only missing or changed files go over (size + mtime); a second run transfers nothing. --delete removes destination files the source lacks. $RDS ls [path] [--json] List a peer directory (default ~). $RDS send ... Drop files into the peer's Downloads AND put them on its clipboard, so the person there just pastes. Prints the remote paths; same names are renamed, not overwritten. ``` `cp` is for one-shot transfers (faster for big files). `mount` is for working inside the remote tree. ## Mount a remote folder (挂目录) ``` $RDS mount :/remote/dir Mount the peer's directory at , read-write. Tools, editors and builds see an ordinary folder. On Windows may be a drive letter: `Z:`, or `*:` for any free one. $RDS [] umount Unmount (only what you mounted — the user may be using theirs). $RDS mount [--json] What this machine has mounted. ``` - Clients: Linux kernel FUSE (the mount point can't be on NTFS); macOS needs nothing (rockd serves the folder to the system's NFS client on 127.0.0.1); Windows uses Dokany, which the RockDesk installer includes. - The peer must allow `mount`. - All mounts to one peer share its single connection. ## Clipboard (剪贴板) ``` $RDS clip Print the peer's clipboard text. If it holds an image, the image is saved as rockd-clip-