pinggy 0.6.5 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +103 -39
- package/CLAUDE.md +21 -11
- package/README.md +12 -2
- package/dist/{TunnelManager-DXNXIH5W.js → TunnelManager-JRVEADS4.js} +4 -3
- package/dist/{TunnelTui-K7KESRTQ.js → TunnelTui-6H4NPUNF.js} +4 -3
- package/dist/{chunk-QZJGTQZC.js → chunk-2GIJXE4K.js} +3 -2
- package/dist/chunk-3KCXR33Y.js +954 -0
- package/dist/{chunk-EMCDDH3B.js → chunk-3WMTTJHI.js} +11 -299
- package/dist/{chunk-X6TZN5CT.js → chunk-CZOKR73F.js} +1 -1
- package/dist/{chunk-K5QHR5KU.js → chunk-FWTQF6AB.js} +519 -556
- package/dist/{chunk-3PTLHLFL.js → chunk-H527WMTF.js} +33 -240
- package/dist/chunk-HTIWY3O5.js +293 -0
- package/dist/{chunk-IRKMUV37.js → chunk-LWCVB42S.js} +2 -2
- package/dist/{chunk-N5WE4DYD.js → chunk-MAK5R4WQ.js} +12 -0
- package/dist/{chunk-7EQKHVQX.js → chunk-MHQ3CVEB.js} +4 -51
- package/dist/chunk-MKGD2QAI.js +51 -0
- package/dist/chunk-PMZJ6HFH.js +882 -0
- package/dist/{configStore-DXC6WMYO.js → configStore-JJUWT2YO.js} +3 -3
- package/dist/{daemonChild-HZ27YJKQ.js → daemonChild-24Y3AKII.js} +14 -10
- package/dist/{daemonConfig-MCAKZHY2.js → daemonConfig-VWK4TXVS.js} +2 -2
- package/dist/index.cjs +3621 -1814
- package/dist/index.d.cts +142 -129
- package/dist/index.d.ts +142 -129
- package/dist/index.js +18 -13
- package/dist/{ipcClient-XGF2KCQO.js → ipcClient-IZ5R6TPN.js} +2 -1
- package/dist/{main-TDQB5ZB4.js → main-HSIFQAGU.js} +19 -14
- package/dist/updateChild-JNGDWIAK.js +237 -0
- package/dist/workers/file_serve_worker.js +1 -1
- package/package.json +4 -3
- package/scripts/build_node_pty_linux.sh +27 -0
- package/scripts/check_linux_addons.js +168 -0
- package/scripts/install/install.ps1 +16 -16
- package/scripts/install/install.sh +57 -20
package/ARCHITECTURE.md
CHANGED
|
@@ -12,11 +12,12 @@ The `pinggy` binary has three execution modes, dispatched in `src/main.ts`:
|
|
|
12
12
|
| -------------------- | -------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
13
13
|
| Daemon child | `--_daemon-child` flag | `runDaemonChild()` in `src/daemon/daemonChild.ts` | Long-running background process. Owns the `TunnelManager` and the SDK. |
|
|
14
14
|
| Subcommand | First arg in `SUBCOMMANDS` set | `handleSubcommand()` in `src/cli/subcommands.ts` | Short-lived CLI invocation:`config`, `start`, `stop`, `ps`, `attach`, `daemon`, `logs`, `log`, `restart`, `device`, and `devices`, which prints the new spelling. |
|
|
15
|
+
| Update child | `--_update-child` flag | `runUpdateChild()` in `src/update/updateChild.ts` | Short-lived detached process. Checks for a release, downloads it, swaps it in. See section 20. |
|
|
15
16
|
| Legacy single-tunnel | No subcommand, has flags | `buildAndStartTunnel()` in `src/cli/buildAndStartTunnel.ts` | Backwards-compatible single-shot tunnel for flags like `-l 3000` or `-R0:...`. |
|
|
16
17
|
|
|
17
18
|
The CLI never opens an SDK tunnel itself. Every tunnel is created inside the daemon. CLI processes talk to the daemon over HTTP + WebSocket on `127.0.0.1`.
|
|
18
19
|
|
|
19
|
-
`pinggy device` is the exception. By default the daemon runs the device agent
|
|
20
|
+
`pinggy device` is the exception. By default the daemon runs the device agent, so it outlives the terminal. With `--foreground` it runs inside the CLI process and talks to the dashboard directly. It reads the daemon's tunnel list, and it stops, restarts and starts tunnels when the dashboard asks. See section 17.
|
|
20
21
|
|
|
21
22
|

|
|
22
23
|
|
|
@@ -43,11 +44,14 @@ Logs live under `getPinggyLogDir()`:
|
|
|
43
44
|
├── daemon-config.json Persisted settings: log level, and the background device agent to start
|
|
44
45
|
├── daemon-state.json Active tunnels, for crash recovery
|
|
45
46
|
├── device.json Device agent identity + token, mode 0600
|
|
47
|
+
├── update.json What the update checks found and which lines printed
|
|
48
|
+
├── update.lock Held by the 1 process replacing the binary: {pid, startedAt}
|
|
46
49
|
└── tunnels/
|
|
47
50
|
└── <name>_<configId>.json Saved tunnel configs (from `pinggy config save`)
|
|
48
51
|
|
|
49
52
|
<logDir>/
|
|
50
53
|
├── daemon.log Daemon process log (rolled)
|
|
54
|
+
├── update.log The last background update, overwritten each run
|
|
51
55
|
└── tunnels/
|
|
52
56
|
└── <origin>__<name>__<tunnelId>.log Per-tunnel logs (rolled 10MB×3)
|
|
53
57
|
```
|
|
@@ -149,7 +153,7 @@ Server: `src/daemon/ipcServer.ts`. Client: `src/daemon/ipcClient.ts`. Public fac
|
|
|
149
153
|
| GET | `/logs/paths` | All tunnel log file paths + running flags |
|
|
150
154
|
| GET | `/logs/resolve?q=` | Resolve a name/id/configId to a log path |
|
|
151
155
|
| POST | `/shutdown` | Graceful shutdown |
|
|
152
|
-
| GET | `/device` | The background device agent's status
|
|
156
|
+
| GET | `/device` | The background device agent's status |
|
|
153
157
|
| POST | `/device/start` | Start the device agent on `device.json` |
|
|
154
158
|
| POST | `/device/stop` | Stop the device agent |
|
|
155
159
|
|
|
@@ -381,8 +385,8 @@ src/
|
|
|
381
385
|
│ ├── envelope.ts Versioned frame wrapper + channel/op constants
|
|
382
386
|
│ ├── device_schema.ts Zod schemas for welcome, error, disconnect payloads
|
|
383
387
|
│ ├── tunnels/tunnelList.ts device/tunnels: daemon poll, whitelist, change detection
|
|
384
|
-
│ ├── tunnels/tunnelActions.ts tunnel/start, stop, restart
|
|
385
|
-
│ └── login/ `pinggy device login
|
|
388
|
+
│ ├── tunnels/tunnelActions.ts tunnel/start, stop, restart, update against the daemon
|
|
389
|
+
│ └── login/ `pinggy device login`: email sign-in over HTTPS, then the agent
|
|
386
390
|
│
|
|
387
391
|
├── remote_management/ Remote control via Pinggy management WS
|
|
388
392
|
│ ├── remoteManagement.ts Connect/disconnect + state machine
|
|
@@ -409,7 +413,7 @@ src/
|
|
|
409
413
|
|
|
410
414
|
## 11. Key types
|
|
411
415
|
|
|
412
|
-
- `TunnelOrigin = "app" | "cli" | "remote" | "device"` (`src/tunnel_manager/TunnelManager.ts`). `device` is the device agent acting for the dashboard's device page
|
|
416
|
+
- `TunnelOrigin = "app" | "cli" | "remote" | "device"` (`src/tunnel_manager/TunnelManager.ts`). `device` is the device agent acting for the dashboard's device page. Set on every tunnel at creation; flows into log filenames.
|
|
413
417
|
- `ClientOrigin = "app" | "cli" | "remote" | "device"` (`src/daemon/ipcClient.ts`). Same values, used in the `X-Pinggy-Origin` header.
|
|
414
418
|
- `TunnelStateType` (`src/types.ts`): `idle | starting | running | live | closed | exited`.
|
|
415
419
|
- `FinalConfig` (`src/types.ts`): the SDK's `TunnelConfigurationV1` plus `conf?` and `saveconf?`. Used by `buildConfig.ts` and threaded through to the daemon.
|
|
@@ -475,7 +479,7 @@ Same code path as user-typed subcommands: the daemon does not know or care that
|
|
|
475
479
|
|
|
476
480
|
`pinggy daemon service-install` writes a platform-specific service file and enables it. `pinggy daemon service-uninstall` stops the daemon and removes it. Code: `src/daemon/lifecycle/serviceInstaller.ts`.
|
|
477
481
|
|
|
478
|
-
- Linux: systemd user unit at `~/.config/systemd/user/pinggy.service`. `Type=simple`, runs `<binary> --_daemon-child` directly (no fork). `systemctl --user enable`, then `start`.
|
|
482
|
+
- Linux: systemd user unit at `~/.config/systemd/user/pinggy.service`. `Type=simple`, runs `<binary> --_daemon-child` directly (no fork). `systemctl --user enable`, then `start`. A user unit starts at sign-in, so `service-install` then runs `loginctl enable-linger <user>`, unless `loginctl show-user` reports `Linger=yes`. Lingering starts the user's units at boot, with nobody signed in. When the command fails, as on a system that wants an admin password for it, `service-install` prints the command and still exits 0. `service-uninstall` leaves lingering on, because it belongs to the user and other units may need it.
|
|
479
483
|
- macOS: launchd `LaunchAgent` at `~/Library/LaunchAgents/io.pinggy.agent.plist`. `launchctl load`.
|
|
480
484
|
- Windows: Task Scheduler task `PinggyDaemon`, created with `schtasks /Create` and no admin rights. A logon trigger for the current user runs `<binary> daemon start`. `daemon start` spawns `--_daemon-child` detached with `windowsHide`, then exits. The task does not run `--_daemon-child` directly: `pinggy.exe` is a console program, so Task Scheduler opens a console window for it, and closing that window kills the daemon. The `daemon start` window shows for about 1s. The task ends once the daemon is up, so uninstall stops the daemon over IPC. It deletes the task first, so a failed delete leaves the daemon running. With no task, it stops nothing. A task created from an Administrator terminal keeps admin-only permissions, so a normal terminal cannot replace or delete it. When `schtasks` fails, the task exists, and `whoami /groups` shows no High or System integrity SID, pinggy tells the user to run the command from an Administrator terminal. It checks the SID, not the "Access is denied" text, because `schtasks` prints that text in the Windows language.
|
|
481
485
|
|
|
@@ -483,23 +487,25 @@ The service stores the full path of the binary (`process.execPath`). If the user
|
|
|
483
487
|
|
|
484
488
|
A system service gives restart-on-failure and start-at-login. The plain daemon mode does not.
|
|
485
489
|
|
|
490
|
+
On macOS and Linux an installed binary sits behind the link `~/.pinggy/bin/pinggy` (section 20), so `serviceProgramPath()` stores the link. A versioned path would pin the service to 1 file that a later prune deletes.
|
|
491
|
+
|
|
486
492
|
## 17. Device agent (`pinggy device`)
|
|
487
493
|
|
|
488
|
-
The one long-lived surface that is not a tunnel. `pinggy device connect` enrols the machine with the Pinggy dashboard and holds 1 WebSocket open so the dashboard can show it as online. By default the daemon runs it (
|
|
494
|
+
The one long-lived surface that is not a tunnel. `pinggy device connect` enrols the machine with the Pinggy dashboard and holds 1 WebSocket open so the dashboard can show it as online. By default the daemon runs it (see Background mode below). With `--foreground` it runs in the CLI process. Code lives in `src/devices/`, entered from `src/cli/subcommand/handlers/deviceCommand.ts`.
|
|
489
495
|
|
|
490
|
-
**Email sign-in
|
|
496
|
+
**Email sign-in.** `pinggy device login` gets the device token without the dashboard: it asks for an email, `POST /backend/api/v1/device-agent/login/start` emails a 6-digit code, and the code prompt races a `poll` every few seconds under 1 `AbortController`. A right code (and the TOTP, with MFA on) answers the token once. The email also carries an Approve link: the CLI prints the `match_code` its page shows as `Device Code: <code>`, then `We have sent a 6-digit code to <email>.` and `Enter the code below or click the approve button in the email.` A poll collects a link's approval, and a typed code answered `pending` stops the prompt so the poll can. The CLI writes `device.json`, prints the device's browser link and its QR code (`createQrCodes`, shared with the TUI): a one-time sign-in link after a typed code, the plain device page after the emailed link. Then it runs the same agent. Code in `src/devices/login/`: `deviceLogin.ts` (the command; every dependency injected, so `src/_tests_/deviceLogin.test.ts` runs it with no dashboard or terminal), `loginApi.ts` (`fetch`, `buildDashboardHttpUrl`, the public client token), `login_schema.ts` (zod), `prompts.ts` (`readline/promises`, 1 interface per question, closed on answer or abort; every question starts with a cyan `→`, and the sign-in result with a green one, through `picocolors`; `askHidden` reads the authenticator code without showing it, since the code still works after it is typed and the open link asks for one). A stdin that is not a TTY stops at once and points at `connect --token`. The token is never printed.
|
|
491
497
|
|
|
492
|
-
**Install scripts
|
|
498
|
+
**Install scripts.** `scripts/install/install.sh` (macOS, Linux, POSIX `sh`) and `scripts/install/install.ps1` (Windows PowerShell 5.1 and 7) install or update the binary, put `pinggy` on PATH with no sudo, then ask "Connect this device to Pinggy? [Y/n]". Enter or `y` runs `pinggy device login -b` by full path. `-b` is the default, and the scripts pass it so an older binary the user kept also runs the agent in its daemon. An answer starting with `n` prints the login command and exits 0, so the CLI is installed with no device. With no terminal, the scripts ask nothing and print the command. `install.sh` writes `~/.pinggy/bin/pinggy` and links `~/.local/bin/pinggy` to it, adding 1 marked block to the shell's rc file when `~/.local/bin` is not on PATH. `install.ps1` writes `%LOCALAPPDATA%\Pinggy\bin\pinggy.exe` and adds that directory to the user PATH. Both read the version to install from `https://pinggy.io/cli/version.json`, never from GitHub's `/releases/latest`. The website builds that file from `data/cli_releases.yaml`, and the release PR changes that list and both scripts in 1 commit, so the script and the binary come from 1 release. When pinggy.io does not answer, or the file has no `x.y.z` in its `version` field, the scripts exit 1 with a message that names the URL and `PINGGY_VERSION`. `PINGGY_VERSION` skips the request. The binary still downloads from the GitHub release. `install.sh` reads the field with `sed`, so the key stays `version` with a quoted value. Both read 3 things this repo owns: the release asset names, the `Pinggy CLI version: <x.y.z>` line, and the `--manage` and `-b` flags of `device login` and `connect`. A change to any of them changes both scripts in the same commit. `.github/workflows/website-cli-download-links-pr.yml` copies both, read at the release tag, to the website's `static/`, so pinggy.io serves `/install.sh` and `/install.ps1`. After `device login` or `connect` exits 0, both scripts ask "Start pinggy automatically when this computer starts? [Y/n]" and run `pinggy daemon service-install`. The question says "starts" for users. On macOS and Windows the service starts pinggy after the user signs in, not at boot. On Linux it starts at boot, because `service-install` turns on lingering. They skip the question when the service exists and runs the installed binary: `install.sh` looks for that binary's path in the launchd plist or the systemd unit file, `install.ps1` compares the command of the `PinggyDaemon` task (`Get-ScheduledTask`) with it. A service that runs any other binary gets the question, and `service-install` replaces it. `install.sh` also skips it on Linux with no systemd user manager. With no terminal, they print the `service-install` command. They remove `DEVICE_AGENT_TOKEN` before the question. Renaming the task, the plist or the unit file changes both scripts in the same commit. Lint with `shellcheck -s sh` and `PSScriptAnalyzer`.
|
|
493
499
|
|
|
494
|
-
**The token command
|
|
500
|
+
**The token command.** The dashboard shows `curl -fsSL https://pinggy.io/install.sh | DEVICE_AGENT_TOKEN=<token> sh`, and `$env:DEVICE_AGENT_TOKEN='<token>'; irm https://pinggy.io/install.ps1 | iex` on Windows. With the variable set, both scripts update an older binary without asking, then run `pinggy device connect -b` by full path, with `--manage` when `PINGGY_MANAGE` is set. The token reaches the CLI in its environment, never on a command line, where `ps` would show it. `install.sh` gives `connect` `/dev/null` as stdin, since it reads no key. `install.ps1` removes the variable in a `finally`, because `iex` runs in the user's own window. `handleDevice()` reads `DEVICE_AGENT_TOKEN` and deletes it from `process.env` before any verb runs, so no shell, daemon or other child inherits it (`takeEnvironmentToken()` in `deviceCommand.ts`). `connect` then picks the token from `--token`, else the variable, else `device.json`, and the server from `--manage`, else `dashboard.pinggy.io` for a token from the variable, else the server in `device.json` (`resolveConnectTarget()`). An empty variable counts as unset.
|
|
495
501
|
|
|
496
|
-
The design lives in the `pinggy_backend` repo under `docs/pinggy-devices/`: `cli.md` is the CLI contract
|
|
502
|
+
The design lives in the `pinggy_backend` repo under `docs/pinggy-devices/`: `cli.md` is the CLI contract. The wire format is `src/devices/envelope.ts` and the zod schemas under `src/devices/`. This section records what the CLI implements today.
|
|
497
503
|
|
|
498
|
-
**With `--foreground` it runs in the CLI process.** The agent owns no tunnel.
|
|
504
|
+
**With `--foreground` it runs in the CLI process.** The agent owns no tunnel. It reads the daemon: `getDaemonInfo()` for `daemon.json`, then `IPCClient.listTunnels()` for `GET /tunnels`, every 5 s, and `listSavedConfigs()` for the saved configs. Listing never starts a daemon, and it refuses a daemon whose `ipcVersion` differs, as `ensureDaemonRunning()` does. It also acts on the daemon when the dashboard asks (see Device tunnel actions below); only a start of a config may call `ensureDaemonRunning()`. `TunnelManager` and `TunnelClient` stay off this path. Killing the agent leaves running tunnels alone.
|
|
499
505
|
|
|
500
|
-
**It does not reuse `src/remote_management/`.** Remote management is a dashboard-driven tunnel controller keyed by an API key. A device is the machine itself, keyed by its own token, and the 2 sockets speak different protocols. The duplication is deliberate: the backend `
|
|
506
|
+
**It does not reuse `src/remote_management/`.** Remote management is a dashboard-driven tunnel controller keyed by an API key. A device is the machine itself, keyed by its own token, and the 2 sockets speak different protocols. The duplication is deliberate: the backend's do-not-touch list (`docs/pinggy-devices/must-not-change.txt`) names the remote-management files, and that loop keeps its fixed 5000 ms retry with no cap and no watchdog.
|
|
501
507
|
|
|
502
|
-
### Background mode
|
|
508
|
+
### Background mode
|
|
503
509
|
|
|
504
510
|
`pinggy device connect` and `pinggy device login` hand the agent to the daemon, as `pinggy start -b` hands it a tunnel, and exit once the device connects. This is the default. `--foreground` (`cliOptions.foreground`, hidden) keeps the agent in the CLI process. `-b` (`cliOptions.b`) still parses and changes nothing. `-b` with `--foreground` exits 1 before anything runs. Whoever hosts the daemon hosts the agent: the CLI's detached child, `pinggy daemon service-install`, or the Pinggy app, whose in-process daemon runs the same `runDaemonChild()`. The app reaches it through `TunnelClient.getDeviceAgentStatus()`, `startDeviceAgent()` and `stopDeviceAgent()`.
|
|
505
511
|
|
|
@@ -514,7 +520,7 @@ The design lives in the `pinggy_backend` repo under `docs/pinggy-devices/`: `cli
|
|
|
514
520
|
5. Print the commands that manage the device once the CLI exits: `pinggy device status`, `stop`, `connect` and `remove` (`MANAGE_COMMANDS`). Then print that the agent starts. A refusal in steps 3 or 4 prints only the refusal.
|
|
515
521
|
6. `GET /device` every 500 ms for up to 15 s. `connected` prints the device, the email, the device link and the log path. `stopped` prints `lastError` and exits 1. Still connecting leaves it to the daemon and exits 0.
|
|
516
522
|
|
|
517
|
-
`login` signs in as the foreground does, then runs steps 3 to 6 in place of `runAgent`. After a new sign-in, `runAgent` gets `signInShown`, and step 6 leaves out the email and the device link, which the sign-in already printed. `device stop` calls `POST /device/stop`. `device status`
|
|
523
|
+
`login` signs in as the foreground does, then runs steps 3 to 6 in place of `runAgent`. After a new sign-in, `runAgent` gets `signInShown`, and step 6 leaves out the email and the device link, which the sign-in already printed. `device stop` calls `POST /device/stop`. `device status` prints a `State` line first (`describeDeviceState()`). It reads `GET /device` once, and `device-agent.json`: `running` plus the daemon agent's connection state, `running, with --foreground in another terminal`, `stopped` when no agent runs or no daemon runs, or `unknown` when `daemon.json` names a daemon that `GET /device` cannot read (another IPC version, an older daemon, no answer). It adds a `Background` line from the same reading. `device remove` stops a running background agent before it deletes `device.json`. A `--foreground` `connect` or `login` refuses while `GET /device` reports a run: 2 agents on 1 credential refuse each other with `already_connected`.
|
|
518
524
|
|
|
519
525
|
**The foreground record** (`src/devices/foregroundAgent.ts`). The daemon cannot see an agent started with `--foreground`, so `runDeviceAgent()` writes `device-agent.json` (`{pid, started_at}`) beside `device.json` while it runs, and deletes it on exit if it still names its own PID. The agent checks once a second that the file exists. `device remove` (`src/devices/removeDevice.ts`) first prints the device id, the background agent's state and the foreground record's PID, and asks "Remove this device from this machine? [y/N]". Only `y` or `yes` goes on. `-f`, the existing `cliOptions.force`, skips the question. With no TTY and no `-f`, it exits 1 and changes nothing. Then it deletes the file, waits up to 10 s for the PID to exit, and deletes `device.json`. An agent still running after that fails the remove with exit 1 and leaves `device.json` in place. No signal goes to the PID: a record left by a crash can name an unrelated process. `readForegroundAgent()` deletes a record whose PID is dead or whose `started_at` is before the last boot. `connect` and `login` refuse while a live record names another process, both in the default background start and with `--foreground`. The background start writes no record: the daemon's `GET /device` already reports it. `device status` adds a `Foreground` line.
|
|
520
526
|
|
|
@@ -538,7 +544,7 @@ The daemon's run differs from the foreground one in 3 dependencies, passed throu
|
|
|
538
544
|
| `pinggy device remove` | Stops, and the daemon never starts it again |
|
|
539
545
|
| A terminal outcome | Stops, with `lastError`, and stays stopped until the next `connect` or `login` |
|
|
540
546
|
|
|
541
|
-
**Inside the Pinggy app** `node-pty` resolves inside `app.asar`, where `spawn-helper` is not on real disk, and a spawn without its helper kills the process. `resolveNodePtyRoot()` copies the package out of an `.asar` archive the way it does out of a `pkg` snapshot, and `loadNodePty()` offers a terminal only when `hasExecutableSpawnHelper()` holds.
|
|
547
|
+
**Inside the Pinggy app** `node-pty` resolves inside `app.asar`, where `spawn-helper` is not on real disk, and on macOS a spawn without its helper kills the process. `resolveNodePtyRoot()` copies the package out of an `.asar` archive the way it does out of a `pkg` snapshot, and `loadNodePty()` offers a terminal only when `hasExecutableSpawnHelper()` holds.
|
|
542
548
|
|
|
543
549
|
`IPC_VERSION` stays 1: the routes are additive, and a bump would make every installed app refuse a newer CLI daemon.
|
|
544
550
|
|
|
@@ -564,8 +570,8 @@ The daemon's run differs from the foreground one in 3 dependencies, passed throu
|
|
|
564
570
|
| `src/devices/terminal/frameSplitter.ts` | `FrameSplitter`: bundles pty output into `data` frames at the raw cap derived from `max_frame_bytes`, or after `BUNDLE_MILLIS` |
|
|
565
571
|
| `src/devices/terminal/shellContext.ts` | Each shell's `cwd` and foreground program from the process table: `/proc` on Linux, `ps` and `lsof` on macOS, nothing on Windows. `programName()` keeps the first word, basename only, because a process can write its arguments into its own name. `ShellContextTracker` turns polls into `context` events, only on change |
|
|
566
572
|
| `src/devices/terminal/terminalRegistry.ts` | `TerminalRegistry`: terminal id to pty handle, with the per-device ceiling from `welcome` |
|
|
567
|
-
| `src/devices/terminal/ptySession.ts` | Lazy `node-pty` load, `isTerminalSupported()` (false unless `spawn-helper` can be exec'd), `spawnPty()`, the `spawn-helper` execute-bit repair, `signalForeground()` to the tty's foreground process group |
|
|
568
|
-
| `src/devices/terminal/nodePtyRuntime.ts` | `resolveNodePtyRoot()`: where `node-pty` loads from. Unpacks it onto real disk inside a `pkg` binary or an Electron `.asar` archive. `hasExecutableSpawnHelper()
|
|
573
|
+
| `src/devices/terminal/ptySession.ts` | Lazy `node-pty` load, `isTerminalSupported()` (false unless the addon loads and, on macOS, `spawn-helper` can be exec'd), `spawnPty()`, the `spawn-helper` execute-bit repair, `signalForeground()` to the tty's foreground process group |
|
|
574
|
+
| `src/devices/terminal/nodePtyRuntime.ts` | `resolveNodePtyRoot()`: where `node-pty` loads from. Unpacks it onto real disk inside a `pkg` binary or an Electron `.asar` archive, into a directory named by the addon's hash. `hasExecutableSpawnHelper()`, true off macOS |
|
|
569
575
|
| `src/devices/terminal/shellAllowlist.ts` | `resolveShell()`: exact match against `/etc/shells`, or `powershell.exe` and `cmd.exe` on Windows |
|
|
570
576
|
| `src/cli/subcommand/handlers/deviceCommand.ts` | The `login`, `connect`, `stop`, `status`, `remove` verbs, and `--foreground`. `refuseDevicesSpelling()` for the old spelling |
|
|
571
577
|
| `src/utils/helpMessages.ts` | `printDeviceHelp()` |
|
|
@@ -634,7 +640,7 @@ No daemon, or a dead pid in `daemon.json`, sends `daemon_running: false` with th
|
|
|
634
640
|
|
|
635
641
|
### Device tunnel actions
|
|
636
642
|
|
|
637
|
-
`ch: "tunnel"` frames go to `handleTunnelAction()
|
|
643
|
+
`ch: "tunnel"` frames go to `handleTunnelAction()`. The dashboard sends 4 requests, and the agent answers each on its `id` and op with `{tunnel_id, state}`, `{config_id}` for a rewritten saved config, or an error. The agent advertises `tunnel_control` in `hello` for start, stop and restart, `tunnel_update` for update, and `saved_config_update` for an update of a saved config; a dashboard refuses an op to an agent without its capability.
|
|
638
644
|
|
|
639
645
|
| Request | Daemon route | Starts a daemon |
|
|
640
646
|
| --- | --- | --- |
|
|
@@ -655,7 +661,7 @@ Every call goes through an `IPCClient` with origin `device`. With no daemon, a s
|
|
|
655
661
|
|
|
656
662
|
The dashboard answers an unreadable payload with `invalid_payload` on the `device` channel. The agent ignores every non-`system` frame, so that answer is logged at debug and changes nothing.
|
|
657
663
|
|
|
658
|
-
### Terminal (
|
|
664
|
+
### Terminal (open, close, shells that outlive the socket, output, input, screen)
|
|
659
665
|
|
|
660
666
|
`ch: "terminal"` frames go to the run's `TerminalHandler`, never to `handleFrame()`. Output flows up as `data`, and keystrokes flow down as `data`.
|
|
661
667
|
|
|
@@ -681,51 +687,65 @@ The dashboard answers an unreadable payload with `invalid_payload` on the `devic
|
|
|
681
687
|
│ terminal/close event {terminal_id, user_closed} │
|
|
682
688
|
│◀───────────────────────────────────────────────────────┤ only when the shell exits on its own
|
|
683
689
|
│ terminal/snapshot event {terminal_id, snapshot_id} │
|
|
684
|
-
├───────────────────────────────────────────────────────▶│ a tab attached and asks for its screen
|
|
690
|
+
├───────────────────────────────────────────────────────▶│ a tab attached and asks for its screen
|
|
685
691
|
│ terminal/snapshot event {part, last, after_seq, data} │
|
|
686
692
|
│◀───────────────────────────────────────────────────────┤ the screen, to that tab only
|
|
687
693
|
│ terminal/resync event {resync_id, part, after_seq, data}
|
|
688
|
-
│◀───────────────────────────────────────────────────────┤ the latest screen after a skip, to every tab
|
|
694
|
+
│◀───────────────────────────────────────────────────────┤ the latest screen after a skip, to every tab
|
|
689
695
|
│ terminal/activity event {terminal_id, skipped_bytes} │
|
|
690
|
-
│◀───────────────────────────────────────────────────────┤ still busy while skipping, not forwarded
|
|
696
|
+
│◀───────────────────────────────────────────────────────┤ still busy while skipping, not forwarded
|
|
691
697
|
```
|
|
692
698
|
|
|
693
699
|
- **`terminal` is advertised only when `node-pty` loads.** `buildCapabilities(isTerminalSupported())`. The capability is what un-greys the Terminal button, so an agent must never advertise a shell it cannot spawn.
|
|
694
700
|
- **The dashboard validates neither shell nor cwd.** `resolveShell()` is the only check. A requested shell must equal an `/etc/shells` line exactly and exist; no request picks `$SHELL` when it is allowed. A missing cwd falls back to home rather than refusing.
|
|
695
701
|
- **A refusal answers on `opened`** with `{terminal_id, error: {code, message}}`: `invalid_payload`, `terminal_disabled`, `terminal_limit_reached`, `shell_not_allowed`, or `spawn_failed`.
|
|
696
|
-
- **A shell outlives the socket that opened it
|
|
702
|
+
- **A shell outlives the socket that opened it.** `runDeviceAgent()` builds 1 `TerminalHandler` for the whole run. When `connectOnce()` settles, `suspend()` pauses every pty (stops reading its master, so the shell blocks once the kernel buffer fills) and kills none. In skip mode (below) it pauses none. The next `hello` lists them in `terminals`. The dashboard answers `close` with `device_gone` for any it forgot, possibly before `welcome`, and `welcome` calls `resumeAll()`.
|
|
697
703
|
- **Only the agent stopping kills shells.** When the loop ends (interrupted, revoked, refused), `closeAll()` kills them. Killing the agent process reaps them too, through `SIGHUP` when the pty master closes.
|
|
698
704
|
- **A shell that exits while the socket is down sends nothing.** Its `close` has no socket to go to, and the next `hello` simply omits it. The dashboard records that as `device_gone`.
|
|
699
705
|
- **Output is read as raw bytes and sent as base64.** `spawnPty()` passes `encoding: null`, so a read that ends mid-character is not decoded into a replacement character. `FrameSplitter` sends a bundle at the raw cap from `rawBundleBytes(max_frame_bytes)` or after `BUNDLE_MILLIS`, whichever comes first. A frame above `max_frame_bytes` would close the socket, and every other terminal on it.
|
|
700
|
-
- **
|
|
706
|
+
- **Without skip mode, a full window stops the reads, not the sends.** `FlowWindow` counts raw bytes sent minus the browser's cumulative `ack_bytes`, clamped to what was sent. When it reaches the window, the handler pauses the pty and the shell blocks in the kernel. The next `ack` that reopens it resumes reads. Nothing is buffered on the agent.
|
|
701
707
|
- **Ctrl-C is input, not a signal.** It arrives as `data` byte `0x03`, and the pty's line discipline turns it into SIGINT for the foreground process group.
|
|
702
708
|
- **`signal` goes to the foreground process group**, never the shell's pid. `signalForeground()` reads the tty's `tpgid` with `ps` and calls `process.kill(-tpgid)`, falling back to the shell's own group. `node-pty`'s `kill(signal)` signals the pid only, and bash ignores SIGINT while `sleep` holds the terminal. The allowlist is `TERMINAL_SIGNALS`, enforced by the zod schema, so `KILL` and anything else never reach `kill`. Ignored on Windows.
|
|
703
709
|
- **`resize` touches the pty only on an actual change.** Every call is a `TIOCSWINSZ` and a SIGWINCH, and a full-screen program redraws on each.
|
|
704
|
-
- **
|
|
710
|
+
- **Without skip mode, 2 things pause a pty, and neither lifts the other's.** A suspended handler (socket down) and a full window. `resumeAll()` skips a shell whose window is still full, and an `ack` does not resume a shell while the handler is suspended.
|
|
705
711
|
- **The window has no default.** `welcome.terminal_window_bytes` is the only place the number lives. Without it the handler answers every `open` with `terminal_disabled`.
|
|
706
712
|
- **`seq` counts per terminal from 1**, on every `data` frame, for the life of the shell rather than the socket. The dashboard closes a terminal with `sequence_gap` on a hole.
|
|
707
|
-
- **
|
|
708
|
-
- **The window still assumes 1 viewer.**
|
|
709
|
-
- **Every shell keeps its screen
|
|
713
|
+
- **Without skip mode, a bundle cut while the socket is down is held**, not sent into no socket. It takes no `seq` and does not count against the window until `resumeAll()` sends it first. It is at most what was already read when `suspend()` paused the pty.
|
|
714
|
+
- **The window still assumes 1 viewer.** The slowest-viewer rule (the window moves on the slowest viewer's ack) and the 10 s `too_slow` detach are not built. The replay for a late attach is the screen snapshot, below, not a buffer of bytes.
|
|
715
|
+
- **Every shell keeps its screen.** `ScreenMirror` is a headless xterm (`@xterm/headless`, 1000 lines of scrollback) fed each bundle in `sendData`, in the same tick as its `seq`, never when the pty is read: a bundle still being cut would otherwise be in the screen and drawn twice. `snapshot` notes `after_seq` and `after_bytes`, then serialises inside the callback of an empty write queued on the mirror, which xterm runs before it parses anything fed later. The text goes out in parts of the raw bundle size. Parts take no `seq` and never count against the window. Over 1 MB it is serialised again with 200 lines, then with the screen alone, and past that it is not sent. The serialize addon needs `allowProposedApi`.
|
|
710
716
|
- **`terminal_snapshot` is advertised only beside `terminal`**, and only when both xterm packages load. The mirror is memory only, disposed with its shell, never logged and never written to disk.
|
|
711
|
-
- **Output never waits
|
|
712
|
-
- **After `welcome`, a resync at once** for every stream that skipped or had bytes in flight, since frames in flight died with the old socket. A shell that exits while skipping sends 1 last resync, then `exit` and `close`. A
|
|
717
|
+
- **Output never waits.** With `welcome.terminal_resync` and a mirror, `sendOrSkip` replaces the window brake. A bundle cut while the window is closed, the socket is down, or the stream is already skipping is skipped: fed to the mirror, given no `seq`, not sent, not counted against the window. Once every sent byte is acked, and no sooner than `RESYNC_MIN_INTERVAL_MILLIS` (1 s) after the last, the latest screen goes to every tab as `resync` parts, then live `data`. `after_seq` and `after_bytes` are read before the mirror is asked, as for a snapshot. The screen is serialised under the window size, and a screen alone over it still goes, up to 1 MB. The dashboard treats each part as a `seq` barrier.
|
|
718
|
+
- **After `welcome`, a resync at once** for every stream that skipped or had bytes in flight, since frames in flight died with the old socket. A shell that exits while skipping sends 1 last resync, then `exit` and `close`. A snapshot never ends skip mode: it reaches 1 tab.
|
|
713
719
|
- **A bundle cut while a resync is serialised waits** in `resyncHeldBundles`, unfed, and goes out after the parts. Past the window size the held bundles and every later one are skipped, and another resync follows.
|
|
714
720
|
- **The only pause in skip mode is the mirror's.** `ScreenMirror.feed` counts bytes fed and not yet parsed through xterm's write callback. The pty pauses above `MIRROR_HIGH_WATER_BYTES` (1 MB) and resumes under `MIRROR_LOW_WATER_BYTES` (256 KB). That is local CPU, never the network: a loud shell runs at the parse rate, about 22.5 MB/s measured on 2026-11-03.
|
|
715
721
|
- **A skipping shell sends `activity`** with its `skipped_bytes`, at most every `ACTIVITY_REPORT_MILLIS` (60 s), so the dashboard's sweep does not close it as idle. The agent's own idle timer counts every pty read already.
|
|
716
|
-
- **`terminal_resync` is advertised beside `terminal_snapshot`**, on the same condition. A `welcome` without the flag ends skip mode on every shell with no resync, and the shells go back to
|
|
722
|
+
- **`terminal_resync` is advertised beside `terminal_snapshot`**, on the same condition. A `welcome` without the flag ends skip mode on every shell with no resync, and the shells go back to the window brake.
|
|
717
723
|
- **No log line carries a payload.** Ids, pids, and codes only, and an error's class name rather than its message. Input is what a person typed, so it is never logged at any level.
|
|
718
724
|
- `welcome.terminal_enabled` and `welcome.max_terminals_per_device` are optional, so an older dashboard leaves the defaults (enabled, 3).
|
|
719
725
|
|
|
720
726
|
`node-pty` 1.1.0 publishes its macOS `spawn-helper` without the execute bit, and every spawn then fails with `posix_spawnp failed`. `ensureSpawnHelperExecutable()` restores it once, at load.
|
|
721
727
|
|
|
722
|
-
**A packaged binary loads `node-pty` from real disk, not from the snapshot.** `node-pty` does not exec the shell directly. It execs `spawn-helper`, at a path it derives from wherever its own module sits. Inside a `pkg` binary that path is `/snapshot/...`, which only exists in the `fs` module pkg patches, so the kernel cannot exec it and `posix_spawn` fails with `ENOENT`. The throw is fatal inside the addon, so no caller gets to answer for it.
|
|
728
|
+
**A packaged binary loads `node-pty` from real disk, not from the snapshot.** On macOS `node-pty` does not exec the shell directly. It execs `spawn-helper`, at a path it derives from wherever its own module sits. Inside a `pkg` binary that path is `/snapshot/...`, which only exists in the `fs` module pkg patches, so the kernel cannot exec it and `posix_spawn` fails with `ENOENT`. The throw is fatal inside the addon, so no caller gets to answer for it. node-pty builds `spawn-helper` on macOS only: Linux forks the shell with `forkpty()`, and Windows uses ConPTY. `hasExecutableSpawnHelper()` asks for a helper on macOS only.
|
|
729
|
+
|
|
730
|
+
`resolveNodePtyRoot()` copies the package out of the snapshot on first use and returns that path, so every path `node-pty` derives afterwards is a real one. It copies `package.json`, `lib/`, and this platform's native directory only: 41 files and 404 KB. The snapshot carries the native directories of all 4 prebuilt platforms, about 5 MB. The `pkg.ignore` list in `package.json` keeps the package's `.pdb` debug symbols and C++ source, 56 MB, out of the binary. A glob added there must not remove anything else from the 3 copied paths. The copy lands in `~/.config/pinggy/runtime/node-pty-<version>-<platform>-<arch>-<hash>`. `<hash>` is 12 hex characters of a SHA-256 over each `pty.node` and the directory it sits in. The copy is staged under a sibling name and renamed into place, so 2 agents starting at once cannot load a half-written copy. An agent whose rename fails because another agent's copy is already there uses that copy. An unpackaged run resolves through `require` as normal and copies nothing.
|
|
731
|
+
|
|
732
|
+
**Linux has no prebuild.** node-pty 1.1.0 ships prebuilds for `darwin-arm64`, `darwin-x64`, `win32-arm64` and `win32-x64`. On Linux `npm ci` compiles `build/Release/pty.node`. node-pty's `files` list leaves `build/` out, and pkg packs only what that list names, so `pkg.assets` names `pty.node`. The hash in the copy's name keeps a binary off a copy of another addon. Binaries up to 0.6.6 named the copy without a hash. Linux binaries up to 0.6.5 carried no addon, and their copy holds `package.json` and `lib/` only. 0.6.6's linux-x64 copy holds a `pty.node` that needs glibc 2.42. The Pinggy app and the CLI can ship different addons, and each loads its own copy. Nothing deletes a copy, because another process may run from it: on macOS a process whose `spawn-helper` is gone dies at its next spawn. Old copies stay on disk. Each is under 0.5 MB on Linux and macOS, and about 3 MB on Windows.
|
|
723
733
|
|
|
724
|
-
|
|
734
|
+
**The compiling machine sets the addon's glibc floor.** A linker binds each libc symbol to the newest version that machine's glibc has. On Ubuntu 26.04, which `ubuntu-latest` became, glibc 2.42 gave `cfsetospeed` and `cfsetispeed` new versions, so the 0.6.6 linux-x64 `pty.node` needs `GLIBC_2.42`. On Ubuntu 24.04 the load then fails, and the agent leaves `terminal` out of `hello`. node-pty's own error lists the 3 directories it checked, but gives only the last one's error (`Cannot find module './prebuilds/linux-x64//pty.node'`). `process.dlopen()` on `build/Release/pty.node` gives the real reason (`version 'GLIBC_2.42' not found`).
|
|
735
|
+
|
|
736
|
+
So both workflows' Linux jobs run `scripts/build_node_pty_linux.sh` after `npm ci`. It runs `npm rebuild node-pty` in `node:24-bookworm` (Debian 12, glibc 2.36), whose `pty.node` needs `GLIBC_2.34` (`forkpty` and `openpty`) and `GLIBCXX_3.4.22`. Then `scripts/check_linux_addons.js` checks it, and the SDK's `addon.node` and `libpinggy.so` too. `pack:linux-x64` and `pack:linux-arm64` run that check again first. The SDK's files come prebuilt, but a failed download makes `node-pre-gyp` compile them on the runner, with the runner's glibc. The check reads each file's `.gnu.version_r` section. It refuses a missing file, one for another architecture, and one that needs a newer `GLIBC`, `GLIBCXX`, `CXXABI` or `GCC` version than RHEL 9 has. It also refuses a name of those families that carries no number, such as `GLIBC_ABI_DT_RELR` (glibc 2.36). RHEL 9 has glibc 2.34, and GCC 11's libgcc_s and libstdc++. Its x64 libgcc_s defines up to `GCC_7.0.0`, and its arm64 one up to `GCC_11.0`. Amazon Linux 2023 has the same glibc, with GCC 14's libraries. Those are the oldest distros the CLI runs on: the SDK's `libpinggy.so` needs the system's OpenSSL 3 (`libssl.so.3`), and every distro that ships it has glibc 2.34 or newer. Measured on Debian 10 and 11: the CLI does not start there, because `libssl.so.3` is missing. The e2e suite runs on the machine that built the binary, so it cannot catch an addon that needs a newer glibc. Only the check does.
|
|
737
|
+
|
|
738
|
+
| Part of the Linux binary | Newest `GLIBC` | Newest `GLIBCXX` |
|
|
739
|
+
|---|---|---|
|
|
740
|
+
| pkg's Node 20 | 2.28 | 3.4.21 |
|
|
741
|
+
| SDK `libpinggy.so` | 2.17 | 3.4.26 |
|
|
742
|
+
| SDK `addon.node` | 2.17 | none |
|
|
743
|
+
| `pty.node` from `node:24-bookworm` | 2.34 | 3.4.22 |
|
|
744
|
+
| `pty.node` from `ubuntu-latest` (Ubuntu 26.04) | 2.42 | 3.4.22 |
|
|
725
745
|
|
|
726
746
|
Not `pkg`'s own cache. `pkg` already unpacks the addon to `~/.cache/pkg/<hash>/` at mode 644, but the hash is undocumented and `node-pty` never looks there.
|
|
727
747
|
|
|
728
|
-
Measured on `macos-arm64` and `macos-x64
|
|
748
|
+
Measured on `macos-arm64` and `macos-x64`, and on `linux-arm64` in Docker: Debian 12 and 13, AlmaLinux 9, Ubuntu 22.04 and Ubuntu 26.04. A `linux-x64` `pty.node` from `build_node_pty_linux.sh` loads and runs a shell on Ubuntu 24.04. The `device-agent-terminal` e2e case opens a shell and runs 1 command on all 6 CI platforms.
|
|
729
749
|
|
|
730
750
|
### Outcomes
|
|
731
751
|
|
|
@@ -802,9 +822,9 @@ Without `--foreground` the daemon owns the agent: `ensureDaemonRunning()` may st
|
|
|
802
822
|
|
|
803
823
|
### Not built yet
|
|
804
824
|
|
|
805
|
-
In this repo: terminal input, output, flow control, resize, and signals
|
|
806
|
-
carries `node-pty
|
|
807
|
-
`device/metrics` collectors, and
|
|
825
|
+
In this repo: terminal input, output, flow control, resize, and signals. A `pkg` build that
|
|
826
|
+
carries `node-pty`. The reconnect backoff and pong watchdog, the `device/info` and
|
|
827
|
+
`device/metrics` collectors, and the terminal open and close have all landed. Everything else
|
|
808
828
|
outstanding is dashboard or frontend work.
|
|
809
829
|
|
|
810
830
|
## 18. Reference for AI agents
|
|
@@ -853,7 +873,7 @@ No em-dashes. Short phrases. Present tense. See `CLAUDE.md` § "English Style" b
|
|
|
853
873
|
- The IPC server only listens on `127.0.0.1`. Do not change to `0.0.0.0` without adding authentication. The current design assumes loopback isolation.
|
|
854
874
|
- Every tunnel reconnects without limit. `_createTunnelWithProcessedConfig()` in `TunnelManager.ts` sets `maxReconnectAttempts` to 0 and ignores the value the caller sends. Create, restart and update all pass through it, so the rule covers the CLI, the app, autostart, crash recovery and remote management. libpinggy counts reconnects over the whole tunnel lifetime and does not reset the count after a successful reconnect. Any limit, including the libpinggy default of 20 for an omitted value, stops a long-running tunnel permanently.
|
|
855
875
|
- Do not route `pinggy device --foreground` through the daemon. Without it the daemon runs the agent, and no IPC route takes or returns a token or a server: the daemon reads both from `device.json`. Any local user can reach the IPC port.
|
|
856
|
-
- Do not generalise `src/remote_management/` to serve the device agent. Those files are on the backend
|
|
876
|
+
- Do not generalise `src/remote_management/` to serve the device agent. Those files are on the backend's do-not-touch list (`docs/pinggy-devices/must-not-change.txt`).
|
|
857
877
|
- `device.json` holds a live credential. Any code that writes it goes through `writeDeviceIdentity()`, which keeps the 0600 mode on rewrites.
|
|
858
878
|
|
|
859
879
|
## 19. Quick diagrams
|
|
@@ -948,3 +968,47 @@ No em-dashes. Short phrases. Present tense. See `CLAUDE.md` § "English Style" b
|
|
|
948
968
|
│ Daemon keeps running with t1 still live.
|
|
949
969
|
▼
|
|
950
970
|
```
|
|
971
|
+
|
|
972
|
+
## 20. Auto-update
|
|
973
|
+
|
|
974
|
+
The CLI updates itself from GitHub releases. `pinggy update` does it on request. Every other command can start a detached process, `pinggy --_update-child`, at most once a day. The command never waits for it. Code: `src/update/`.
|
|
975
|
+
|
|
976
|
+
| File | Purpose |
|
|
977
|
+
| --- | --- |
|
|
978
|
+
| `installKind.ts` | How this copy was installed, which decides whether it can replace itself. An unknown location gets a hint and never a write |
|
|
979
|
+
| `updateState.ts` | `update.json`. Every field is optional, and a corrupt file reads as empty |
|
|
980
|
+
| `latestRelease.ts` | The latest tag from the `/releases/latest` redirect, `isReleaseComplete()`, the npm registry, version compare |
|
|
981
|
+
| `binaryUpdater.ts` | `downloadAndVerify()`, `runPinggyBinary()`, `UpdateError` |
|
|
982
|
+
| `updateLock.ts` | `update.lock`. 1 process replaces the binary at a time |
|
|
983
|
+
| `windowsSwap.ts` | Rename swap with retries, the post-swap run, the restore, rollback, cleanup on start |
|
|
984
|
+
| `unixLinkSwap.ts` | Versioned layout, atomic link move, prune, rollback, plain-file conversion |
|
|
985
|
+
| `applyUpdate.ts` | The swap for this install kind, behind 1 interface |
|
|
986
|
+
| `backgroundUpdate.ts` | The gates on every command, the pending notice, starting the detached process |
|
|
987
|
+
| `updateChild.ts` | The detached process |
|
|
988
|
+
|
|
989
|
+
**Layout on macOS and Linux.** `~/.local/bin/pinggy` links to `~/.pinggy/bin/pinggy`, which links to `~/.pinggy/versions/<x.y.z>/pinggy`. The updater moves the 2nd link with a temp link and a rename, because `ln -sf` removes the old link first. No step touches a running binary. A process whose file was pruned keeps its code, and `getDaemonSpawnArgs()` starts any new daemon from the link.
|
|
990
|
+
|
|
991
|
+
**Windows.** A running `.exe` can be renamed but not overwritten. The live file becomes `<live name>.<epochMillis>.old`, the download takes the live name, and `<stem>.prev.exe` holds a copy for rollback. Every file stays in the folder of `execPath`. Each rename retries for 10 seconds, because a scanner can hold a new `.exe` open, and the live path runs once after the swap, because a scanner can remove it.
|
|
992
|
+
|
|
993
|
+
**Verify.** `SHA256SUMS` first, then free space, the download, size, SHA-256, and `--version`. Nothing runs the new file before its hash matches. `runPinggyBinary()` sets `windowsHide` and an empty `PKG_EXECPATH`: pkg adds `PKG_EXECPATH=<execPath>` to every child, and a file at the running binary's own path then reads its first argument as a script.
|
|
994
|
+
|
|
995
|
+
**Background gates, in order.** Not an explicit or print-only command, stdout is a terminal, `PINGGY_AUTO_UPDATE` is not off, not under `sudo` or in a container, the running version parses, not under `_npx`. Any pending notice prints here. Then the last check is over 24 hours old, the last attempt is over 1 hour old, not a dev checkout, no live lock, and `lastAttemptEpochSeconds` is written.
|
|
996
|
+
|
|
997
|
+
**A live daemon.** A daemon keeps the code it started with. The updater reads `--_ipc-version` from the verified file. When a live daemon speaks another IPC version, the background update holds the swap, because the swap would break every daemon command until the user stops all tunnels. This costs 1 download per release.
|
|
998
|
+
|
|
999
|
+
**A release.** `publish-binaries.yml` uploads the 6 binaries, then `SHA256SUMS`. A release with no `SHA256SUMS` is unfinished, and the updater refuses it.
|
|
1000
|
+
|
|
1001
|
+
**What installed updaters read.** Each installed copy keeps the updater it shipped with, so these never change: the `/releases/latest` redirect, the tag format `vX.Y.Z`, the 6 asset names, `SHA256SUMS` and its format, the `Pinggy CLI version: <x.y.z>` line, the `--_ipc-version` output, and the `update.json` field names.
|
|
1002
|
+
|
|
1003
|
+
**After a rollback.** Older code reads `daemon-state.json`, `device.json` and saved configs. They carry no version, so they change by adding fields only. A breaking change uses a new file name.
|
|
1004
|
+
|
|
1005
|
+
**Stopping a bad release.**
|
|
1006
|
+
|
|
1007
|
+
1. Stop further updates: `gh release delete-asset <bad-tag> SHA256SUMS --repo Pinggy-io/cli-js --yes`.
|
|
1008
|
+
2. Send new installs to the last good release: `gh release edit <good-tag> --latest --repo Pinggy-io/cli-js`.
|
|
1009
|
+
3. Publish the fix as a higher patch version. Copies on the bad version take it on their next check.
|
|
1010
|
+
4. Tell users on the bad version to run `pinggy update --rollback`.
|
|
1011
|
+
|
|
1012
|
+
Step 3 needs a working updater in the bad build. If the updater is the bug, those users run the install script.
|
|
1013
|
+
|
|
1014
|
+
**Overrides, for dev and tests.** `PINGGY_UPDATE_RELEASES_URL` accepts a loopback `http` URL only.
|
package/CLAUDE.md
CHANGED
|
@@ -14,7 +14,7 @@ npm run build:tsc
|
|
|
14
14
|
# Dev workflow (link SDK, build, link locally)
|
|
15
15
|
npm run dev
|
|
16
16
|
|
|
17
|
-
# Build platform binaries (via pkg)
|
|
17
|
+
# Build platform binaries (via pkg). Linux binaries need Linux and Docker: see Build System
|
|
18
18
|
npm run pack:all
|
|
19
19
|
|
|
20
20
|
# E2E suite against a packaged binary (see test/e2e/README.md)
|
|
@@ -25,11 +25,12 @@ node test/e2e/run.cjs out/pinggy-<platform>
|
|
|
25
25
|
|
|
26
26
|
### Two-process model
|
|
27
27
|
|
|
28
|
-
The CLI binary has
|
|
28
|
+
The CLI binary has 4 entry modes, dispatched in `src/main.ts`:
|
|
29
29
|
|
|
30
30
|
1. **Daemon child** (`--_daemon-child` flag). Calls `runDaemonChild()` in `src/daemon/daemonChild.ts`. The CLI re-execs itself with this flag when it needs to spawn a daemon; users never invoke it directly.
|
|
31
|
-
2. **Subcommand** (`config`, `start`, `stop`, `ps`, `attach`, `daemon`, `d`, `device`, `devices`). Routes to `handleSubcommand()` in `src/cli/subcommands.ts`.
|
|
31
|
+
2. **Subcommand** (`config`, `start`, `stop`, `ps`, `attach`, `daemon`, `d`, `device`, `devices`, `update`). Routes to `handleSubcommand()` in `src/cli/subcommands.ts`.
|
|
32
32
|
3. **Legacy single-tunnel** (no subcommand). Routes to `buildAndStartTunnel()` for flags like `-l 3000` or `-R0:localhost:3000`.
|
|
33
|
+
4. **Update child** (`--_update-child` flag). Calls `runUpdateChild()` in `src/update/updateChild.ts`. A command starts it at most once a day, detached, to check for a release and install it.
|
|
33
34
|
|
|
34
35
|
The daemon owns the `TunnelManager` singleton, the `@pinggy/pinggy` SDK, the web debugger server, and any `--serve` file servers. The CLI owns argument parsing, the TUI, the remote-management WebSocket client, and the IPC client to the daemon.
|
|
35
36
|
|
|
@@ -48,7 +49,7 @@ CLI code calls `TunnelClient` (`src/daemon/tunnelClient.ts`), the public facade
|
|
|
48
49
|
|
|
49
50
|
Single daemon per user. State lives under `~/.config/pinggy/` on Linux/macOS or `%APPDATA%/pinggy/` on Windows (helper: `src/utils/configDir.ts`):
|
|
50
51
|
|
|
51
|
-
- `daemon.json`: `{pid, port, startedAt, host, ipcVersion}`. `ipcVersion` is `IPC_VERSION` from `src/daemon/ipc/ipcRoutes.ts`. `ensureDaemonRunning()` refuses a live daemon whose version differs and tells the user to run `pinggy daemon stop`. Bump `IPC_VERSION` on any incompatible IPC or WebSocket change.
|
|
52
|
+
- `daemon.json`: `{pid, port, startedAt, host, ipcVersion, cliVersion}`. `cliVersion` is the version the daemon started with, and never follows the installed binary. `ipcVersion` is `IPC_VERSION` from `src/daemon/ipc/ipcRoutes.ts`. `ensureDaemonRunning()` refuses a live daemon whose version differs and tells the user to run `pinggy daemon stop`. Bump `IPC_VERSION` on any incompatible IPC or WebSocket change. After an update the CLI is newer than the daemon, often for weeks, so a new IPC route or WebSocket frame needs a capability check or an `IPC_VERSION` bump.
|
|
52
53
|
- `daemon.lock`: `{pid, started_at}` of the running daemon (`src/daemon/lifecycle/daemonLock.ts`). Each daemon takes it before it opens its IPC port, and a daemon that finds a live holder exits 0. systemd and launchd run `--_daemon-child` directly, and 2 CLIs can spawn at once, so the CLI's `daemon.json` check alone does not keep 1 daemon.
|
|
53
54
|
- `daemon-state.json`: detached tunnel configs, for crash recovery (`src/daemon/lifecycle/stateStore.ts`). Deleted on clean shutdown; replayed on next start.
|
|
54
55
|
- `daemon-config.json`: settings that survive a clean shutdown (`src/daemon/lifecycle/daemonConfig.ts`): the log level, and `deviceAgent`, set while the background device agent should run. Every daemon start runs that agent. `pinggy device remove` deletes it. `pinggy device stop` keeps it, so the agent starts again with the next daemon.
|
|
@@ -72,15 +73,15 @@ Single daemon per user. State lives under `~/.config/pinggy/` on Linux/macOS or
|
|
|
72
73
|
|
|
73
74
|
`pinggy devices`, the old spelling, stays a subcommand that prints the new one and exits 1 (`refuseDevicesSpelling()`). Do not remove `Subcommand.Devices`: without it `devices` falls to legacy tunnel mode, where `--token` is the tunnel token, so `pinggy devices connect --token pga_...` would send the device token to the tunnel server.
|
|
74
75
|
|
|
75
|
-
It owns no tunnel.
|
|
76
|
+
It owns no tunnel. It reads the daemon's `GET /tunnels` through `IPCClient` and the saved configs, to send `device/tunnels` (`src/devices/tunnels/tunnelList.ts`), and listing never starts a daemon. It stops, restarts and starts tunnels when the dashboard asks (`src/devices/tunnels/tunnelActions.ts`), through `IPCClient` with the `device` origin; only a start of a config may call `ensureDaemonRunning()`. It also applies an updated dashboard config to the tunnel running it, through the daemon's `update-config-v2`, and it rewrites a saved config's file when the dashboard edits it (`upsertConfig()`, no daemon). `pinggy device login` signs the machine in by email over plain HTTPS (`src/devices/login/`), writes `device.json`, then runs the same agent; the sign-in can also be approved from the email's link, and the poll collects it. No `TunnelManager`. It also does not reuse `src/remote_management/`, which is a tunnel controller keyed by an API key rather than the machine keyed by a device token. Frames use a versioned envelope (`src/devices/envelope.ts`) validated with zod (`src/devices/device_schema.ts`); an unknown `ch` or `op` is ignored, never fatal.
|
|
76
77
|
|
|
77
|
-
`pinggy device connect` and `login` run the agent in the daemon, as `pinggy start -b` runs a tunnel there, so it outlives the terminal
|
|
78
|
+
`pinggy device connect` and `login` run the agent in the daemon, as `pinggy start -b` runs a tunnel there, so it outlives the terminal. `--foreground` runs it in the CLI process instead, until Ctrl+C. `-b` still parses and changes nothing; `-b` with `--foreground` exits 1. `--foreground` sits hidden in `cliOptions`, because `main.ts` parses the whole command line with it, strict, before it dispatches. Whoever hosts the daemon, the CLI's child or the Pinggy app, hosts the agent (`src/daemon/deviceAgentHost.ts`, `src/devices/backgroundAgent.ts`). `GET /device`, `POST /device/start` and `POST /device/stop` reach it, and `TunnelClient` exposes them for the app. No IPC route takes or returns a token or a server: the daemon reads both from `device.json`, and a new token is checked in the CLI with 1 handshake before the daemon sees it. Once the daemon starts the agent, the CLI prints the commands that manage it (`status`, `stop`, `connect`, `remove`). `pinggy device stop` stops it. A `--foreground` `connect` or `login` refuses while it runs. The loop prints nothing itself: it calls a `DeviceAgentReporter`, and the foreground's prints the same lines as before.
|
|
78
79
|
|
|
79
80
|
1 invocation runs 1 subcommand: `isSubcommand()` reads `rawArgs[0]` only, so `pinggy device connect start my-tunnel` runs the agent and drops the rest, and tunnel flags on a `device` line parse and are ignored, except `-b` and `--foreground`.
|
|
80
81
|
|
|
81
|
-
|
|
82
|
+
`scripts/install/install.sh` installs into `~/.pinggy/versions/<version>/` and points the link `~/.pinggy/bin/pinggy` at it. `install.sh` and `install.ps1` install or update the binary, put it on PATH, then ask "Connect this device to Pinggy? [Y/n]" and run `pinggy device login -b` unless the answer starts with `n`. `-b` is the default, and the scripts pass it so an older binary the user kept also runs the agent in its daemon. pinggy.io serves copies that `website-cli-download-links-pr.yml` writes at each release tag. The scripts read the version to install from `https://pinggy.io/cli/version.json`, which the website builds from the `data/cli_releases.yaml` that the same PR updates, and they exit 1 when it does not answer. They download the binary from the GitHub release. The updater in `src/update/` still reads GitHub's `/releases/latest`. Copies of the scripts stay in use, so that URL and its `version` field never change. Renaming a release asset, changing the `Pinggy CLI version:` line, or changing `device login`'s `--manage` or `-b` flag means changing both scripts in the same commit. `DEVICE_AGENT_TOKEN` on either script updates without asking and runs `pinggy device connect -b` instead, with the token in the environment, never on a command line. `handleDevice()` deletes the variable from `process.env` before any verb runs, so no shell or daemon the agent starts inherits it. Renaming the variable or `connect`'s `--manage` or `-b` flag also changes both scripts in the same commit. `pinggy daemon service-install` runs only from the path the scripts install to (`installerBinaryPath()` in `src/daemon/lifecycle/serviceInstaller.ts`), so changing either script's install directory changes that function in the same commit. Once the device connects, both scripts offer `pinggy daemon service-install` unless the service exists. They look for the task name, plist or unit file that `serviceInstaller.ts` writes, and the installed binary's path in it, so renaming any of them changes both scripts in the same commit.
|
|
82
83
|
|
|
83
|
-
Section 17 of `ARCHITECTURE.md` has the protocol, the retry and terminal outcome table, the `device.json` rules, and the full composition table. The design docs are in the `pinggy_backend` repo under `docs/pinggy-devices/`; read `cli.md`
|
|
84
|
+
Section 17 of `ARCHITECTURE.md` has the protocol, the retry and terminal outcome table, the `device.json` rules, and the full composition table. The design docs are in the `pinggy_backend` repo under `docs/pinggy-devices/`; read `cli.md` there before changing anything in `src/devices/`.
|
|
84
85
|
|
|
85
86
|
**Core types** are in `src/types.ts`: `TunnelStatus`, `Status`, `TunnelStateType` enum (`idle/starting/running/live/closed/exited`), `FinalConfig` (extends SDK's `TunnelConfigurationV1`). Browse `src/daemon/` and `src/cli/` for the rest of the module layout.
|
|
86
87
|
|
|
@@ -94,19 +95,28 @@ Section 17 of `ARCHITECTURE.md` has the protocol, the retry and terminal outcome
|
|
|
94
95
|
| `pinggy ps` | Table of running tunnels (ID, name, status, local, URL) |
|
|
95
96
|
| `pinggy attach <name\|id>` | Re-attach TUI to a running tunnel |
|
|
96
97
|
| `pinggy daemon start \| stop \| status \| service-install \| service-uninstall` (alias `d`) | Daemon lifecycle and system-service installation |
|
|
97
|
-
| `pinggy
|
|
98
|
+
| `pinggy update [--check \| --rollback]` | Update to the latest release now, print the latest version and change nothing, or go back to the previous version. A background check starts on its own; `PINGGY_AUTO_UPDATE=false` turns it off |
|
|
99
|
+
| `pinggy device login \| connect [--foreground] \| stop \| status \| remove [-f]` | Sign this machine in by email, or enrol it with a token, as a Pinggy device; the agent runs in the daemon, or in this terminal with `--foreground`, and `stop` stops the daemon's; show whether the agent runs, the enrolment and the background agent; show the device and its connection, ask, then stop every agent and forget the credential (`-f` skips the question) |
|
|
100
|
+
|
|
101
|
+
### Auto-update
|
|
102
|
+
|
|
103
|
+
`src/update/` updates the CLI from GitHub releases. Section 20 of `ARCHITECTURE.md` has the flow. 3 rules hold for every change:
|
|
104
|
+
|
|
105
|
+
- Each installed copy keeps the updater it shipped with, so these never change: the `/releases/latest` redirect, the tag format `vX.Y.Z`, the 6 asset names, `SHA256SUMS` and its format, the `Pinggy CLI version: <x.y.z>` line, the `--_ipc-version` output, and the `update.json` field names.
|
|
106
|
+
- A rollback runs older code against `daemon-state.json`, `device.json` and saved configs, so they change by adding fields only.
|
|
107
|
+
- `SHA256SUMS` is the last upload of a release. A release that has it counts as complete.
|
|
98
108
|
|
|
99
109
|
## Build System
|
|
100
110
|
|
|
101
111
|
tsup bundles to `dist/` (CJS + ESM). tsc type-checks only (`npm run build:tsc`). pkg builds standalone platform binaries (`out/pinggy-<platform>`). ts-jest with the ESM preset for unit tests (`jest.config.cjs`).
|
|
102
112
|
|
|
103
|
-
pkg packs every file in a dependency's `files` list and every package in its `dependencies`, whether the code loads it or not. The `pkg.ignore` list in `package.json` keeps out what the binary never loads: node-pty's `.pdb` debug symbols and C++ source, the SDK's unlinked `libcrypto.dylib` and `libssl.dylib` copies, the SDK's install-time `node-gyp` and `@mapbox/node-pre-gyp`, and zod's `src/` and `v3/`. A new glob must not match node-pty's `package.json`, `lib/`, or any file under `prebuilds/` other than a `.pdb`: `resolveNodePtyRoot()` copies those out of the snapshot at runtime. The `**` in these globs does not match a folder whose name starts with a dot, so a checkout under such a path (`~/.work/cli-js`) ignores nothing and builds the full-size binary. `"compress": "Brotli"` compresses the snapshot: on macOS arm64 the binary drops from 83 MB to 59 MB, and each run starts about 80ms later.
|
|
113
|
+
pkg packs every file in a dependency's `files` list and every package in its `dependencies`, whether the code loads it or not. The `pkg.ignore` list in `package.json` keeps out what the binary never loads: node-pty's `.pdb` debug symbols and C++ source, the SDK's unlinked `libcrypto.dylib` and `libssl.dylib` copies, the SDK's install-time `node-gyp` and `@mapbox/node-pre-gyp`, and zod's `src/` and `v3/`. A new glob must not match node-pty's `package.json`, `lib/`, `build/Release/pty.node`, or any file under `prebuilds/` other than a `.pdb`: `resolveNodePtyRoot()` copies those out of the snapshot at runtime. node-pty has no Linux prebuild, so on Linux `npm ci` compiles `build/Release/pty.node`. Its `files` list leaves `build/` out, so `pkg.assets` names that file. Without it the Linux binary offers no terminal. Pack a Linux binary on Linux, on the architecture it targets: `npm ci`, then `scripts/build_node_pty_linux.sh` (needs Docker), then `pack:linux-<arch>`. The script compiles `pty.node` in `node:24-bookworm`, because one compiled on a newer distro needs a newer glibc: from `ubuntu-latest` (Ubuntu 26.04) it needs `GLIBC_2.42` and does not load on Ubuntu 24.04. `pack:linux-<arch>` first runs `scripts/check_linux_addons.js` on `pty.node` and the SDK's `addon.node` and `libpinggy.so`. It refuses a missing file, one for another architecture, and one that needs a symbol version RHEL 9's glibc 2.34, libgcc_s or libstdc++ lacks. So `pack:all` and `pack:linux` fail on macOS, and `pack:linux` fails at its 2nd architecture. The `**` in these globs does not match a folder whose name starts with a dot, so a checkout under such a path (`~/.work/cli-js`) ignores nothing and builds the full-size binary. `"compress": "Brotli"` compresses the snapshot: on macOS arm64 the binary drops from 83 MB to 59 MB, and each run starts about 80ms later.
|
|
104
114
|
|
|
105
115
|
## Testing
|
|
106
116
|
|
|
107
117
|
**Unit tests** live in `src/_tests_/`. Use `@jest/globals` imports (no global `jest`). `TunnelManager` is a singleton, so reset it between tests with `TunnelManager.instance = undefined`, and call `jest.clearAllMocks()` in `beforeEach`.
|
|
108
118
|
|
|
109
|
-
**End-to-end tests** live in `test/e2e/`. They run against a packaged `pkg` binary, spawn real Pinggy free-tier tunnels, and assert HTTP/TCP/UDP behavior over the live edge. See `test/e2e/README.md` for layout, framework helpers, and how to add a case. CI runs them across 6 platform binaries via `.github/workflows/e2e-test.yml`.
|
|
119
|
+
**End-to-end tests** live in `test/e2e/`. They run against a packaged `pkg` binary, spawn real Pinggy free-tier tunnels, and assert HTTP/TCP/UDP behavior over the live edge. See `test/e2e/README.md` for layout, framework helpers, and how to add a case. CI runs them across 6 platform binaries via `.github/workflows/e2e-test.yml`. CI sets `PINGGY_E2E_SUITE=ci`, which runs 3 combined cases in place of 15 separate ones. The default `full` suite runs the separate ones. A change to a separate case needs the same change in its combined case.
|
|
110
120
|
|
|
111
121
|
## Key Patterns
|
|
112
122
|
|
package/README.md
CHANGED
|
@@ -263,12 +263,22 @@ pinggy device connect --token <TOKEN> --manage dashboard.pinggy.io
|
|
|
263
263
|
|
|
264
264
|
`--token` here is the device token, not the tunnel token of the same flag name in [Options](#options). The 2 credentials are unrelated and the device agent never reads the tunnel one.
|
|
265
265
|
|
|
266
|
-
### Show
|
|
266
|
+
### Show the device and whether it runs
|
|
267
267
|
```bash
|
|
268
268
|
pinggy device status
|
|
269
269
|
```
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
The first line is the device's state:
|
|
272
|
+
|
|
273
|
+
| State | Meaning |
|
|
274
|
+
|-------|---------|
|
|
275
|
+
| `running, connected` | The agent runs in the daemon and the dashboard shows the device online |
|
|
276
|
+
| `running, connecting` or `running, reconnecting` | The agent runs in the daemon and is dialling the dashboard |
|
|
277
|
+
| `running, with --foreground in another terminal` | Another terminal runs `pinggy device connect --foreground` |
|
|
278
|
+
| `stopped` | No agent runs. `pinggy device connect` starts it |
|
|
279
|
+
| `unknown` | A daemon runs but does not answer, for example after an update. `pinggy daemon stop` fixes it, and stops all running tunnels |
|
|
280
|
+
|
|
281
|
+
Then it prints the device id, server, masked token, and enrolment time from the local file. It asks the running daemon about its agent and never starts one. It contacts no server.
|
|
272
282
|
|
|
273
283
|
### Forget the local credential
|
|
274
284
|
```bash
|
|
@@ -2,10 +2,11 @@ import {
|
|
|
2
2
|
TunnelAlreadyRunningError,
|
|
3
3
|
TunnelManager,
|
|
4
4
|
TunnelRebuildInProgressError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3WMTTJHI.js";
|
|
6
6
|
import "./chunk-UB26QJ4T.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-HTIWY3O5.js";
|
|
8
|
+
import "./chunk-LWCVB42S.js";
|
|
9
|
+
import "./chunk-MAK5R4WQ.js";
|
|
9
10
|
export {
|
|
10
11
|
TunnelAlreadyRunningError,
|
|
11
12
|
TunnelManager,
|
|
@@ -3,12 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-XZ64ZAGO.js";
|
|
4
4
|
import {
|
|
5
5
|
TunnelManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3WMTTJHI.js";
|
|
7
7
|
import "./chunk-UB26QJ4T.js";
|
|
8
|
+
import "./chunk-HTIWY3O5.js";
|
|
8
9
|
import {
|
|
9
10
|
logger
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-LWCVB42S.js";
|
|
12
|
+
import "./chunk-MAK5R4WQ.js";
|
|
12
13
|
|
|
13
14
|
// src/tui/blessed/TunnelTui.ts
|
|
14
15
|
import blessed3 from "blessed";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LWCVB42S.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureTunnelConfigDir,
|
|
6
6
|
getTunnelConfigDir
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MAK5R4WQ.js";
|
|
8
8
|
|
|
9
9
|
// src/cli/configStore.ts
|
|
10
10
|
import fs from "fs";
|
|
@@ -36,6 +36,7 @@ var Subcommand = {
|
|
|
36
36
|
Log: "log",
|
|
37
37
|
Restart: "restart",
|
|
38
38
|
Device: "device",
|
|
39
|
+
Update: "update",
|
|
39
40
|
// The old spelling, refused with a hint. As a subcommand it never reaches tunnel mode, where `--token` is the
|
|
40
41
|
// tunnel token and a device token would go to the tunnel server.
|
|
41
42
|
Devices: "devices"
|