dsh-remote-vs 0.28.0 → 0.30.0
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/README.en.md +63 -7
- package/README.md +51 -7
- package/lib/client.js +393 -112
- package/lib/index.js +2271 -160
- package/lib/p2-router-fs.js +1 -1
- package/lib/types/changes/recorder.d.ts +65 -10
- package/lib/types/changes/status.d.ts +48 -3
- package/lib/types/client/ConnectionsSection.d.ts +73 -0
- package/lib/types/client/HostsView.d.ts +139 -2
- package/lib/types/client/api.d.ts +65 -2
- package/lib/types/client/connection.d.ts +28 -1
- package/lib/types/client/scm/actions.d.ts +25 -1
- package/lib/types/forward.d.ts +11 -1
- package/lib/types/p2/helper-rpc.d.ts +48 -0
- package/lib/types/p2/worlds.d.ts +28 -0
- package/lib/types/pool.d.ts +337 -8
- package/lib/types/protocol.d.ts +218 -0
- package/lib/types/proxy.d.ts +136 -0
- package/lib/types/store.d.ts +81 -1
- package/lib/types/tools.d.ts +3 -0
- package/lib/{worlds-RG8K5eom.js → worlds-CRRZMZhg.js} +85 -6
- package/package.json +1 -1
- package/src/changes/recorder.ts +151 -15
- package/src/changes/status.ts +59 -4
- package/src/client/ConnectionStatus.tsx +19 -5
- package/src/client/ConnectionsSection.tsx +359 -0
- package/src/client/HostsView.tsx +552 -11
- package/src/client/MonitorView.tsx +14 -0
- package/src/client/PortsView.tsx +16 -0
- package/src/client/SettingsHosts.tsx +132 -6
- package/src/client/api.ts +102 -4
- package/src/client/connection.ts +76 -2
- package/src/client/i18n.ts +152 -2
- package/src/client/scm/actions.ts +63 -12
- package/src/client/vsc/vsc.css +281 -0
- package/src/forward.ts +38 -2
- package/src/importers.ts +125 -13
- package/src/keygen.ts +8 -1
- package/src/p2/helper-rpc.ts +73 -5
- package/src/p2/worlds.ts +48 -0
- package/src/pool.ts +1120 -100
- package/src/protocol.ts +228 -0
- package/src/proxy.ts +673 -0
- package/src/routes.ts +139 -5
- package/src/store.ts +335 -0
- package/src/tools.ts +47 -2
package/README.en.md
CHANGED
|
@@ -92,7 +92,7 @@ extra configuration is needed.
|
|
|
92
92
|
| Explorer | Lazy tree + one click expands/collapses a directory + hidden-files toggle; **new: a 150 ms hover prefetches** that folder's listing (the expand paints from cache and revalidates in the background; if the prefetch is still in flight, the click waits for it and shows the loading line like a cold directory). On the Host every browse request shares **one long-lived SFTP session**, cutting a listing from two round trips to one (**the first one after a cold start or after the 2 idle minutes still pays the channel open**); context menu: new / rename / delete / copy / move / paste / find in folder / insert `@` reference / **download to local** (files stream to this machine; a directory **or a multi-selection** is archived on the remote host as one `.tar.gz` and streamed, so nothing is buffered in Host memory; a native **Save as** dialog picks the destination when the browser supports it, otherwise the browser's download folder; a bottom-right **download panel** shows live progress, allows cancel, and reports completion/failure; the search-hit menu offers it too; a download ends in one of three honest states — **saved / handed to the browser / failed** — and a hand-off never reads as "done", nor does a Host failure get saved as a file; the tree's empty area has its own context menu (new / upload / paste) and uploads, pastes and drops are **serialized** (a second transfer is refused with an explanation); the tree is keyboard-operable (`↑↓` move, `←→` collapse/expand, `Enter` open, `Shift+F10` menu) and dialogs trap focus and close on `Esc`); git status colours and folder roll-up marks; **type-coloured file and folder icons** (coloured sheet + category mark, amber folders that open, same set as the local sidebar; the tree only — other lists keep the neutral glyph); **drag-hover expand**: while dragging a row or dropping OS files, resting the pointer on a collapsed directory for ~650 ms opens it (spring-loaded folder, so the drop lands inside the folder you just revealed; cancelling the drag leaves nothing half-open); **multi-select delete** runs as one remote `rm` batch (per-item progress and cancel, no per-file SFTP round trips for a large tree), re-lists only the deleted entries' parents and refreshes git status in the background; **very large directories render only the rows near the viewport** while keeping the full scroll range; a directory's context menu can **open it in a terminal** |
|
|
93
93
|
| Transfer speed | Uploads/downloads use a **256 KiB × 32 in-flight window** over SSH (pipelined SFTP): single-file downloads and drag-and-drop uploads run ~8× faster than one stream, and the helper push (47 MB) uses parallel `fastPut` too; large uploads are no longer killed by a 60 s deadline (progress watchdog instead). A **download above 4 MiB gets a second dedicated SFTP channel** (one SSH channel caps its window at 2 MiB, so each extra channel adds a window): an interleaved same-process A/B measured **about 1.1–1.4×** (medians of 1.08–1.43× across samples, link-dependent; raw read probes 1.6–1.8× — the product opens two channels, not four); small files keep one channel and one less channel slot, and uploads stay single-channel (the remote write path is the bound, extra channels gain nothing) |
|
|
94
94
|
| Search | Two modes: **file names** (remote `find`) and **contents** (remote `grep`). Content mode has a scope folder, `Aa` (case) / `ab_` (whole word) / `.*` (regex), results grouped per file with match highlights, and clicking a hit jumps to that line; **content mode can be aborted** (changing or clearing the query kills the running remote `grep`; an older Host without the streaming route degrades to a one-shot, non-cancellable query), success with stderr warnings is reported above the results, and a **directory** hit in name mode is revealed in the tree instead of being opened as a file |
|
|
95
|
-
| Connection status and offline read-only | The top bar and the editor info bar show the current workspace's SSH link state (**connection OK / connection issue / ready, connects on demand**): a drop is no longer silent — open editor tabs keep their cached content and turn **read-only** (saves are blocked with an explanation), the tree keeps showing cached directories while background refreshes stay quiet, and uncached directories say they are offline. When the link recovers, directories, git status, **unmodified file tabs and read-only diff tabs** refresh automatically (tabs with unsaved edits are left alone and the user is told). An errored link is retried at most three times, 30 s apart, then the chip is a manual retry control. While the link is down, "Undo this change" and the diff's hunk actions are blocked too; **a single operation's deadline is NOT treated as a broken link** — the chip stays ok and only that operation fails, with the real reason; when the link is down and the workspace has no cache, the SCM panel says it cannot read instead of sitting on "loading". **No cross-reload persistent cache** (remote source never lands on disk) — a deliberate privacy trade-off |
|
|
95
|
+
| Connection status and offline read-only | The top bar and the editor info bar show the current workspace's SSH link state (**connection OK / connection issue / ready, connects on demand**); **hovering the connection status** also shows **the egress THIS connection actually took** (`Egress: direct to host:port` / `Egress: via HTTP proxy host:port` / `Egress: via jump host <alias>`; with nothing connected it degrades to `Egress (configured): …`, plus the reason when the configuration cannot be used) — **runtime evidence**, not the "saved decision" the settings page shows: the saved decision says which route the NEXT dial takes and never rewrites a connection that is already up, so the chip wins when the two disagree. A drop is no longer silent — open editor tabs keep their cached content and turn **read-only** (saves are blocked with an explanation), the tree keeps showing cached directories while background refreshes stay quiet, and uncached directories say they are offline. When the link recovers, directories, git status, **unmodified file tabs and read-only diff tabs** refresh automatically (tabs with unsaved edits are left alone and the user is told). An errored link is retried at most three times, 30 s apart, then the chip is a manual retry control. While the link is down, "Undo this change" and the diff's hunk actions are blocked too; **a single operation's deadline is NOT treated as a broken link** — the chip stays ok and only that operation fails, with the real reason; when the link is down and the workspace has no cache, the SCM panel says it cannot read instead of sitting on "loading". **No cross-reload persistent cache** (remote source never lands on disk) — a deliberate privacy trade-off |
|
|
96
96
|
| Source control | **Repository-folder picker** (for workspaces whose git repository lives in a sub-folder: browse the remote tree, one-click jump to any repository discovered inside the workspace, type a relative or absolute path, and see which repository each folder resolves to); changes / staged / untracked / ignored buckets; **untracked directory rows expand on click**; per-file AND **per-hunk** stage / unstage / discard (behind a confirm) / commit; branches, remotes and stash panes; sync (fetch/pull/push), with **push refspec support** (Gerrit style `HEAD:refs/for/<branch>`; empty = plain `git push`, a non-empty value is remembered); fetch/pull/push/sync get a **live output panel** (server-sent events showing git/remote output, a running clock, **cancel** that kills the remote process group, and the full log for copying afterwards; an older Host without the streaming route falls back to the one-shot result); a non-repository workspace can **initialize a repository**, a branch can be **renamed**, and a remote URL can be **edited** (each behind a confirm/validation) |
|
|
97
97
|
| Session change review | The **collapsible** panel above the composer: what THIS SESSION changed, with a one-click switch to **this turn** (the most recent completed turn; the default stays the session total) — one row per file, file-type icon, `+a −b` on the right; clicking a file opens it in the remote editor with **line shading plus character-level inline diff**, `n/N ↑↓` jumps between change points; hovering a changed line puts a `⋯` menu at the row end with **Undo this change** (remote `git apply -R`, failures classified) and **Keep this change** (per block, local only, independent of the file-level ✓); a row's right-click opens a **read-only side-by-side diff** of the ledger baseline, and open tabs are marked "positions stale" when the panel's poll sees their row move. See "Session change review" below; the header can **show only unreviewed files** and **jump to the next unreviewed one** (wraps, never marks a file reviewed) |
|
|
98
98
|
| Side-by-side diff | Panes stay **exactly equal** + per-hunk buttons in the middle gutter + a **top horizontal scrollbar** (a very long line can no longer break the symmetry) + pinned line numbers, **rendering only the rows inside the viewport** (a 3000-line file goes from 9000 row containers to ~174, with exactly the same scroll range as a full render); switch between "before / after", and the after side is editable and savable (the save writes the working-tree file back; a diff above 8MiB is read-only, so a truncated prefix can never be written over the real file) |
|
|
@@ -107,24 +107,68 @@ extra configuration is needed.
|
|
|
107
107
|
| Terminals | Tabbed multi-terminal (`+` to create, `✕`/middle-click to close behind a confirm), across hosts; session ids are persisted so a page refresh reattaches to the running shells, and a session is kept for **10 minutes after its last socket goes away** (enough for a refresh or a browser-tab switch) before the remote shell is closed; **a socket drop (as opposed to a shell exit) keeps the session and offers a one-click reattach** (the same session id reattaches, and the Host still reclaims it after the 10-minute TTL above), and only a real exit clears it; a reattach **replays the recent output**, so switching sessions no longer leaves a blank terminal |
|
|
108
108
|
| Workspaces | Binding list + routing-mode dropdown + the dual-mode (local / remote) new-workspace wizard; **unbinding asks first** (sessions and history stay readable, new remote calls are refused) |
|
|
109
109
|
| View preferences | The two controls at the bottom of Settings → Remote hosts: **open the remote workspace for a new remote session** (off by default; only remote-workspace sessions trigger it, local sessions never do, it is decided once per session per page load, and a panel you close stays closed) and the **remote workspace width share** (45% by default, 20%–70%): when the plugin opens its “Remote Workspace” right-panel page, the column takes that share of the window width, and changing the share applies immediately while the panel is open. Both live host-side (`$DSH_HOME/dsh-remote-view.json`) so every window of the profile agrees |
|
|
110
|
-
| Port forwarding | A sidebar **"Ports"** page: lists the remote host's listening TCP ports (`ss`, falling back to `netstat`) and forwards any of them to a local port in one click, with the local URL for copying/opening. Manual rules ("remote address:port → local port, which may be auto-assigned") are supported too. **The local listener binds `127.0.0.1` only** (`ssh -L` semantics — never exposed to the LAN); each rule has its own channel budget and never consumes one of the six exec/SFTP slots. An SSH drop or the idle eviction does not kill the listener: the next local connection simply re-dials. Rules live in the browser (restored after a reload) and every one can be stopped; disabling the plugin, deleting the host, or unloading it releases the local ports. When the remote has neither `ss` nor `netstat`, or the probe times out or is interrupted, the panel says "cannot enumerate" instead of showing an empty list |
|
|
110
|
+
| Port forwarding | A sidebar **"Ports"** page: lists the remote host's listening TCP ports (`ss`, falling back to `netstat`) and forwards any of them to a local port in one click, with the local URL for copying/opening. Manual rules ("remote address:port → local port, which may be auto-assigned") are supported too. **The local listener binds `127.0.0.1` only** (`ssh -L` semantics — never exposed to the LAN); **each host gets its own dedicated SSH connection for forwarding** (separate from the shared browse/exec one and the PTY one, so forward traffic never queues ahead of `git status`/SFTP channels), with an automatic **fallback to the shared connection** when the server refuses an extra one (the row then says "Shared"), evicted with the connection after 30 idle minutes; each rule has its own channel budget and never consumes one of the six exec/SFTP slots. An SSH drop or the idle eviction does not kill the listener: the next local connection simply re-dials. Rules live in the browser (restored after a reload) and every one can be stopped; disabling the plugin, deleting the host, or unloading it releases the local ports. When the remote has neither `ss` nor `netstat`, or the probe times out or is interrupted, the panel says "cannot enumerate" instead of showing an empty list |
|
|
111
111
|
|
|
112
112
|
### Hosts and transport
|
|
113
113
|
|
|
114
114
|
| Capability | Notes |
|
|
115
115
|
| --- | --- |
|
|
116
116
|
| Host management | CRUD + connectivity test; key / password auth; config in `$DSH_HOME/dsh-remote.json` (0600), independent from `dsh-ssh.json` |
|
|
117
|
+
| Network egress | Every host picks **follow default / direct / proxy (HTTP CONNECT or SOCKS5) / jump host**. The host form's 「network egress」 block is **collapsed by default**: the collapsed row carries a read-only chip that already spells the route out (`direct` / `follow default (direct)` / `follow default (via HTTP proxy 192.0.2.10:3128)` / `via SOCKS5 proxy …` / `via jump host <alias>`), and only expanding it reveals the fields (four mode radios, type/host/port, username/password, jump-host dropdown); the toggle is a real `<button>` with `aria-expanded`, so Enter/Space work. Each host row carries the same chip (a `follow default` row resolves to the route it actually takes; with no known default it says just "follow default" instead of assuming direct); a setting that cannot work turns it **error-coloured** with the reason in `title` (jump host deleted, jump host pointing at itself, invalid endpoint). **Two levels**: Settings → Remote hosts also has a collapsible **default network egress** card (profile-wide, direct by default) — what `follow default` hosts use, overridable per host; that card's chip shows the **stored** value only, so an unsaved edit does not appear there. Proxy passwords are **never echoed**: editing an existing host shows an empty password box with "stored — leave empty to keep", and an empty box keeps the stored secret **for the same endpoint** (a changed `kind`/host/port/username drops it — re-enter it; the `password` field is not sent) |
|
|
117
118
|
| Key bootstrap | One click generates a dedicated keypair on password hosts and deploys `authorized_keys`, key auth from then on |
|
|
118
119
|
| Push pipeline | Remote arch/OS probe → version compare → skip-if-same / else push; the executable channel pushes a self-built helper. A failed deploy no longer retries on every remote file operation: it backs off from **5 seconds up to 5 minutes**, and the Settings "Push" button forces an immediate retry; **an automatic push (first contact or upgrade self-heal) raises a bottom-right toast on success** (`alias: pushed remote helper <version>`), while a manual push stays quiet (Settings already shows its state) |
|
|
119
120
|
| Remote files | SFTP browse / read / write / create / delete / rename. Boundaries hardened: 0-byte files no longer deadlock, and every SFTP operation times out at 60s and releases its channel; **a single directory listing is capped at 20000 entries** (the first 20000 after sorting — directories first, then names — announced in the host log; the protocol carries no "truncated" field, so the UI has no marker); **a save goes through a side file and a rename** (server-side `posix-rename` when available, otherwise backup-rename-rollback), **writes through symlinks** (the link itself survives) and keeps the mode bits **on a best-effort basis**; SCM status parsing unquotes git's C-quoted paths (any name with whitespace is quoted) |
|
|
120
121
|
| Remote terminal | ssh2 PTY + WebSocket, xterm rendering (copy-paste/theme-follow/reconnect-on-refresh; **the selection highlight is a visible blue in the light theme** — `#add6ff` light / `#264f78` dark, plus unfocused variants — no more white-on-white); `Shift+Insert` / `Ctrl+Shift+V` **paste exactly once** (xterm calls the key hook for keyup too, so the gesture used to run twice); **a reattach only takes over, it does not resize** (a page reload no longer shrinks a running shell to 80×24), and no resize frame is sent when rows/columns did not change; an output backlog applies real backpressure to the far end, and output within a short window is **coalesced into one frame** (flushed immediately past 64 KiB, and always before the exit frame) **Ctrl+click a path** reveals its folder in the directory tree (absolute / `~/` / relative tokens containing `/`, validated by stat in cwd → workspace-root → home order); a **"snippets" panel** next to the title stores name+command pairs, a click pastes into the command line **without Enter**, `Ctrl+B` adds one, and rows can be edited, deleted and dragged (Alt+Up/Down too), persisted in localStorage; echo after idle is flushed immediately, the client output path does not wait on xterm render callbacks, a closing socket releases its unsettled backpressure bytes, and the marks are 2 MiB / 512 KiB. so a busy command (`cat` of a large log, `dmesg`) costs far fewer frames and JSON parses; the terminal dials **its own SSH connection** per host (+1 connection, shared one as fallback) so bulk SFTP/git traffic no longer queues ahead of terminal I/O; **frames are capped at 1 MiB**, and pastes past 64 Ki characters are chunked on code points by the client instead of dropping the connection |
|
|
121
|
-
| Concurrent channels |
|
|
122
|
-
| Monitor | A sidebar **"Monitor"** page samples one host or every host **only while the panel and the page are visible**, at the configured refresh interval (5 s by default; 5/10/30 s in its settings): CPU, memory, disk, load, network rate, temperature and uptime, with 60-point history curves plus manual refresh and pause. The scope is "current host / a named host / all hosts" and survives a reload. The **first sample reports CPU% and the network rate as unknown** (both are deltas and need a second sample), and a non-Linux host shows unknown instead of 0. The Host caches one sample per alias for 3 seconds and joins concurrent requests, so one sample uses one exec channel and never the port-forward budget. Samples live in memory only — nothing is written to disk. A **process section** (single host, collapsed by default, sampled only while expanded) shows a `ps` snapshot sorted by CPU/memory/PID, filterable by command/user/PID, with a confirmed **End** action per row; a PID must come from the latest snapshot, and a host without a usable `ps` says it cannot enumerate. |
|
|
122
|
+
| Concurrent channels | The shared connection counts by purpose: **4** exec channels + **2** network-verb channels (fetch/pull/push) + **3** git-command channels (status/diff/log, the ledger's scans, and local writes such as commit/stage) = **9 counted**; one session is deliberately left free for the transient capability probe / group kill, so the total stays inside the measured `MaxSessions` (10) — a **bounded design, not spare headroom** (that one slot moved from exec to git: several workspaces/repositories scanning at once is more common than concurrent exec, at the cost of exec dropping from five to four — the fifth concurrent exec queues instead of being refused); a surplus operation queues for up to **30 seconds** (instead of being refused hard by sshd, which looks like a broken host) and then fails with `remote host <alias> is busy`. File transfer, terminals and port forwards ride their own connections and never take any of those 9 |
|
|
123
|
+
| Monitor | A sidebar **"Monitor"** page samples one host or every host **only while the panel and the page are visible**, at the configured refresh interval (5 s by default; 5/10/30 s in its settings): CPU, memory, disk, load, network rate, temperature and uptime, with 60-point history curves plus manual refresh and pause. The scope is "current host / a named host / all hosts" and survives a reload. The **first sample reports CPU% and the network rate as unknown** (both are deltas and need a second sample), and a non-Linux host shows unknown instead of 0. The Host caches one sample per alias for 3 seconds and joins concurrent requests, so one sample uses one exec channel and never the port-forward budget. Samples live in memory only — nothing is written to disk. A **process section** (single host, collapsed by default, sampled only while expanded) shows a `ps` snapshot sorted by CPU/memory/PID, filterable by command/user/PID, with a confirmed **End** action per row; a PID must come from the latest snapshot, and a host without a usable `ps` says it cannot enumerate. An **SSH connections section** (collapsed by default, sampled only while expanded) shows, per host, the four connection kinds (shared / terminals / port forwards / file transfer) as "open or closed · N channels", with the route the shared connection **actually took** on that line (direct / HTTP or SOCKS5 proxy / jump host, the same wording the connection chip uses); below it one line per channel budget, **each with its own queue**: `Shared channels 3/4 · 0 queued`, then — when the Host reports them — `File-transfer channels 1/6 · 0 queued`, `Network-verb channels 2/2 · 1 queued` (git fetch/pull/push) and `Git-command channels 2/3 · 1 queued` (git status/diff/log, the session ledger's own scans, and local writes such as commit/stage). At most four lines, and a line appears only while that budget has something running or waiting. The **helper** (the p2 transport) keeps its own SSH connection too: when the Host reports it, one more lane follows the four pool kinds — `Helper` with `open · 1 ch · 3 calls in flight` — and that last part is the number of RPC calls in flight, **not a queue**, so it never adds to the queue badge, the summary's queued count or the ordering. A Host that cannot report the helper omits the lane entirely rather than claiming "closed". **The host this workspace is bound to always leads**, then a host with work queued (which shows its queue count); the rest keep a stable alias order. Numbers are tabular so a refresh does not make the text jump. When a host refused its own SFTP connection and file operations fall back to the shared one, the file-transfer lane says so under it (`sftpFallback`, not an error state). The data is a local read of the pool the Host already holds in memory (no remote command rides it); a Host that does not know the route leaves the header plus one muted line. |
|
|
123
124
|
| Timeouts and process cleanup | Ordinary git commands default to 300 s (configurable); the **network verbs (fetch/pull/push/sync) default to 20 minutes with a 30-minute ceiling**. exec runs in its own session (`setsid --wait`); on timeout OR cancel it sends TERM and **escalates to KILL after 3 seconds**, reaping the child processes with it; a host without `setsid --wait` is detected by a one-shot probe and falls back to the old behaviour, with a host-log line saying the timed-out remote command may still be running; **directory / multi-selection archive downloads carry a 600 s server-side budget** (remote `timeout -k 3 600`; a host without GNU `timeout` falls back to the unbudgeted old behaviour) and fail with the real reason when it expires |
|
|
124
125
|
| Git graph | Remote repo status + branches + SVG commit graph + commit details/contents/diff pane (exec + frontend parsing, zero Host additions) |
|
|
125
126
|
| Import | One-click import from `~/.ssh/config` and from an existing `dsh-ssh.json` (read once, no coupling); `Host a b` multi-pattern entries are expanded one by one, `Include` is reported as not expanded instead of being silently dropped, and every skipped host names an actionable reason (no User / no IdentityFile / invalid port …) |
|
|
126
127
|
| Environment check | An "environment check" per host: one remote command probes OS/kernel, glibc, `git`, `ripgrep`, `tar`, `setsid --wait`, `$HOME` free space, CPU/memory, the deployed helper version and sshd's `MaxSessions`, shown as a three-state table (**available / missing / unknown**). "Could not determine" is reported as **unknown**, never as "missing" (insufficient permission, unparseable output and a dropped link are all unknown); every row keeps the remote's own words, stderr is merged rather than discarded, and the whole report copies in one click |
|
|
127
128
|
|
|
129
|
+
### Network egress (proxy / jump host)
|
|
130
|
+
|
|
131
|
+
For hosts the machine can reach, but only through one more hop out of this network. Four points:
|
|
132
|
+
|
|
133
|
+
- **Two levels**: one profile-wide **default network egress** (Settings → Remote hosts → Default network egress,
|
|
134
|
+
`direct` by default), plus a per-host `follow default / direct / proxy / jump host`. A host without the field
|
|
135
|
+
reads as `follow default`, and the default's own default is direct ⇒ **an upgrade changes nothing**;
|
|
136
|
+
`follow default` stores "no opinion", it does not copy the value of the moment.
|
|
137
|
+
- **Proxy** supports `HTTP CONNECT` and `SOCKS5`, both with optional username/password (Basic /
|
|
138
|
+
SOCKS5 user-pass sub-negotiation).
|
|
139
|
+
- A **jump host** rides another stored host's SSH connection (one `direct-tcpip` hop), and the jump host dials
|
|
140
|
+
through **its own** egress (direct / proxy / follow default). **Multi-hop is refused at parse time**
|
|
141
|
+
(`ProxyJump a,b` is skipped with the reason), and a host that others already jump through cannot be turned into
|
|
142
|
+
a jump host itself (that would make every dependent a two-hop chain). What the row names are the two runtime
|
|
143
|
+
problems — a **chain** (the jump host is itself a jump host) and a **dangling** one (the jump host was deleted) —
|
|
144
|
+
instead of surfacing as "connection failed" at dial time.
|
|
145
|
+
- Failures stay layered: `proxy layer` (unreachable / auth required / tunnel refused / wrong protocol) and
|
|
146
|
+
`target layer` (jump host unusable, endpoint invalid) each get an actionable sentence.
|
|
147
|
+
- It only affects the plugin's own SSH dials (exec / SFTP / terminal / port forwarding share the same resolution);
|
|
148
|
+
system environment variables and DSH's own `HTTP_PROXY` are untouched.
|
|
149
|
+
|
|
150
|
+
Importing `~/.ssh/config` maps `ProxyJump` / `ProxyCommand` too: a single-hop `ProxyJump bastion` **whose jump
|
|
151
|
+
host is imported from the same config** (being visible in that import is enough — **file order does not matter**,
|
|
152
|
+
so `Host target` before `Host bastion` still imports both) becomes a jump host; `ProxyCommand nc -X connect -x
|
|
153
|
+
host:port` → HTTP proxy, `nc -x host:port` → SOCKS5, `ssh -W %h:%p bastion` → jump host. Multi-hop, a third-party
|
|
154
|
+
program (`corkscrew`, …) or a jump host that was not imported is **skipped with a reason**, instead of quietly
|
|
155
|
+
dropping the proxy and leaving a host that can never connect.
|
|
156
|
+
|
|
157
|
+
#### How to confirm the jump host is really used
|
|
158
|
+
|
|
159
|
+
**Start with the connection chip's tooltip**: it states **the egress THIS connection actually took**
|
|
160
|
+
(`Egress: via jump host <alias>` and friends), not what the settings store. The two can disagree — switching a
|
|
161
|
+
host from direct to a jump host leaves an already-open connection serving on the old route until that edit drops
|
|
162
|
+
it (see above). For an independent check, look at three machines:
|
|
163
|
+
|
|
164
|
+
1. **Target host**: `ss -tn state established '( sport = :<port> )'` — the peer should be **the jump host's
|
|
165
|
+
public IP**, not your own.
|
|
166
|
+
2. **Jump host**: `ss -tnp | grep <port>` — the `sshd` process should have an outbound connection to the
|
|
167
|
+
target's `host:port`.
|
|
168
|
+
3. **Your machine**: no direct connection to the target port (empty output is what you want):
|
|
169
|
+
`ss -tn state established '( dport = :<port> )'` on Linux, `Get-NetTCPConnection -RemotePort <port>` on
|
|
170
|
+
Windows, `netstat -an | grep <port>` on macOS.
|
|
171
|
+
|
|
128
172
|
### Agent capabilities
|
|
129
173
|
|
|
130
174
|
| Capability | Notes |
|
|
@@ -149,7 +193,8 @@ dsh_remote_vs/
|
|
|
149
193
|
│ ├── sftp.ts # remote file engine (SFTP windowed reads-writes/tree ops)
|
|
150
194
|
│ ├── keygen.ts # password-host key bootstrap (generate→deploy→flip)
|
|
151
195
|
│ ├── deploy.ts # push pipeline (probe/compare/ship/double-verify/manifest)
|
|
152
|
-
│ ├── importers.ts # ssh_config / dsh-ssh.json parsing importers
|
|
196
|
+
│ ├── importers.ts # ssh_config / dsh-ssh.json parsing importers (ProxyJump/ProxyCommand → egress)
|
|
197
|
+
│ ├── proxy.ts # egress tunnels (HTTP CONNECT / SOCKS5 handshake + pure ProxyJump/ProxyCommand parsing)
|
|
153
198
|
│ ├── routes.ts # /api/dsh-remote/* route table + terminal WebSocket upgrade
|
|
154
199
|
│ ├── terminal.ts # PTY session registry (reconnect-on-refresh/disconnect cleanup)
|
|
155
200
|
│ ├── forward.ts # local port-forward manager (direct-tcpip channels / one listener per rule / budgets)
|
|
@@ -214,16 +259,17 @@ dsh_remote_vs/
|
|
|
214
259
|
│ ├── ai-review.ts # AI review prompt builder (single diff / whole commit, byte tiers, pure)
|
|
215
260
|
│ ├── api.ts # typed fetch wrapper over /api/dsh-remote
|
|
216
261
|
│ ├── MonitorView.tsx # monitor panel (one/all hosts, curves, pause/refresh, persisted scope)
|
|
262
|
+
│ ├── ConnectionsSection.tsx # monitor SSH pool section (four kinds/channels/slots+queues/actual egress; no sampling while collapsed)
|
|
217
263
|
│ ├── metrics-model.ts # monitor model (history window/sparkline geometry/capacity+rate formatting)
|
|
218
264
|
│ ├── HostsView / WorkspacesView / WorkspaceWizard / TerminalView / XTerm / PortsView / Dialog
|
|
219
|
-
│ ├── SettingsHosts.tsx # settings occupants (host mgmt/binding list, self-fetching)
|
|
265
|
+
│ ├── SettingsHosts.tsx # settings occupants (host mgmt/binding list/default egress, self-fetching)
|
|
220
266
|
│ ├── DirectoryFlow.tsx # native entry occupant (local dual-mode/remote wizard)
|
|
221
267
|
│ ├── RemoteDirectoryPicker.tsx# remote directory browser dialog
|
|
222
268
|
│ └── i18n.ts / theme.ts / ui.tsx # bilingual dictionary/theme signal/shared styles
|
|
223
269
|
├── vendor/dsh-remote-helpers/ # helper seeds (shipped, seeded into cache at startup, see below)
|
|
224
270
|
├── docs/ # local-only working docs (only docs/media/ screenshots ship)
|
|
225
271
|
│ ├── MAINTENANCE.md # local-only (.gitignore), not shipped: upgrade impact, checklist, pitfalls, release
|
|
226
|
-
│ ├── VERSION-HISTORY.md # local-only: per-release change log (0.7.1 → 0.
|
|
272
|
+
│ ├── VERSION-HISTORY.md # local-only: per-release change log (0.7.1 → 0.30.0)
|
|
227
273
|
│ └── GATES.md # local-only: local gate inventory and measured assertion counts
|
|
228
274
|
├── locale/ # bilingual plugin metadata
|
|
229
275
|
└── lib/ # build output (**must be committed**; only .map is ignored; restart after link install)
|
|
@@ -327,6 +373,10 @@ when the seat changes.
|
|
|
327
373
|
`/proc`, so other platforms show unknown; temperature exists only when the host exposes a thermal
|
|
328
374
|
zone (many VMs do not); CPU% and the network rate are deltas, so the **first frame is unknown**;
|
|
329
375
|
samples live in memory only and the curves restart after a page reload.
|
|
376
|
+
- **Pool section limits**: sampled only while the section is expanded, the Monitor panel is the visible
|
|
377
|
+
view AND the page is in the foreground (collapsed means zero requests and zero traffic); it reads the
|
|
378
|
+
connection state the Host holds in memory, never a remote command; a Host that does not know the route
|
|
379
|
+
(404) leaves the header plus one muted line and is not asked again.
|
|
330
380
|
|
|
331
381
|
## Session change review (Cursor style)
|
|
332
382
|
|
|
@@ -337,6 +387,12 @@ change?". Its data comes from the plugin's own change ledger (`/api/dsh-remote/c
|
|
|
337
387
|
`workspaceChanges` — the latter cannot see a routed session at all (the probe measured 58 remote sessions
|
|
338
388
|
with zero change events).
|
|
339
389
|
|
|
390
|
+
- **How new files are found**: the untracked scan first runs a cheap `git ls-files --others --directory`
|
|
391
|
+
(an untracked directory is reported once instead of being walked file by file, which is what made this step
|
|
392
|
+
expensive on a monorepo), then expands only the reported directories **within bounds** (one batched command for all of them, so a directory holding nothing visible costs no round trip; at most 20 directories,
|
|
393
|
+
the same 500-row cap, one 60-second budget shared with the walk). Hitting any limit — or an expansion failing —
|
|
394
|
+
marks the list **incomplete** and says so in the panel instead of silently listing fewer files; with no
|
|
395
|
+
untracked directory it runs **no extra command at all**.
|
|
340
396
|
- **The panel**: one row per file (file-type icon + relative path + `+a −b` on the right), aligned left and
|
|
341
397
|
right with the composer card; click the header to collapse/expand, `⟳` forces an immediate rescan. With no
|
|
342
398
|
changes it says "this session has not changed any file yet"; when it cannot compute, it states the
|
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Host 转发(终端按 `__DSH_TRANSPORT__.streamBaseUrl` 解析地址),无
|
|
|
77
77
|
| 资源管理器 | 懒加载目录树 + 单击目录即展开/折叠 + 隐藏文件开关;**新增悬停 150 ms 预取**下一层列表(展开时先用缓存上屏、后台再校验;预取仍未返回时点开会等它,与冷启动一样显示加载行);Host 侧浏览请求复用**一条常驻 SFTP 会话**,一次列目录的往返从 2 个降到 1 个(**冷启动或空闲 2 分钟关闭后的第一次仍要开会话**);右键菜单:新建/改名/删除/复制/移动/粘贴/在此文件夹查找/插入 `@` 引用/**在终端中打开**/**下载到本地**(文件流式下载、目录或**多选**在远端打包成 `.tar.gz` 流式下载,不占 Host 内存;浏览器支持时先弹**另存为**对话框选保存路径,不支持时落到默认下载目录;右下角**下载面板**显示实时进度、可取消,并提示完成/失败;搜索结果右键同样支持;下载结果分「已保存 / 已交给浏览器 / 失败」三态,交给浏览器后**不再显示成已完成**,Host 失败也不会被当成文件存下;树空白区也有右键菜单(新建/上传/粘贴),上传、粘贴、拖放等写操作**串行**(另一个传输进行中会拒绝并提示);键盘可用(`↑↓` 选择、`←→` 折叠/展开、`Enter` 打开、`Shift+F10` 菜单),对话框有焦点陷阱与 `Esc` 关闭);**多选删除**一次远端 `rm` 批次完成(带逐项进度与取消,大目录不再逐文件 SFTP 往返)、只刷新被删除项的父目录并由后台补 git 状态;**超大目录只渲染视口附近的行**(滚动范围与整篇一致);git 状态色与文件夹聚合标记;**文件/目录按类型着色**(彩色纸张 + 类别标记、琥珀色目录开合,与本地侧栏同款;仅目录树,其它列表保持单色);**拖拽悬停展开**:拖动行或拖入系统文件时,指针在收起目录上停留约 650 ms 就自动展开该目录(spring-loaded folder,松手即落在已展开的目标里;中途取消不会留下自动展开) |
|
|
78
78
|
| 传输性能 | 上传/下载走 SSH 的 **256 KiB × 32 并发窗口**(ssh2 pipelined SFTP):单文件下载与拖放上传比单流快约 8 倍,helper 推送(47 MB 包)同样走并行 `fastPut`;大文件上传不再被 60 秒期限误杀(改用进度看门狗)。**大于 4 MiB 的下载再开一条专用 SFTP 通道**(单条 SSH 通道的窗口上限是 2 MiB,多一条通道多一个窗口):同进程交错 A/B 实测**约 1.1–1.4×**(多次采样中位 1.08–1.43×,随链路波动;原始读探针 1.6–1.8×,产品只开两条通道,不开四条);小文件不开第二条,省一个通道槽。上传保持单通道(服务端写入是瓶颈,多通道无收益) |
|
|
79
79
|
| 搜索 | 两档:**文件名**(远端 `find`)与**内容**(远端 `grep`)。内容档带范围目录、`Aa`(大小写)/`ab_`(全字)/`.*`(正则)、结果按文件分组、命中高亮,点条目跳到该行;**内容档可中止**(改写或清空查询会终止正在跑的远端 `grep`;老 Host 无流式路由时退化为不可取消的一次性查询),成功但远端给了 stderr 警告时在结果上方提示;文件名档里命中**目录**时在树中定位,而不是当文件打开 |
|
|
80
|
-
| 连接状态与离线只读 | 顶部栏与编辑器信息栏显示当前工作区的 SSH 连接状态(**连接正常 / 连接异常 /
|
|
80
|
+
| 连接状态与离线只读 | 顶部栏与编辑器信息栏显示当前工作区的 SSH 连接状态(**连接正常 / 连接异常 / 就绪·按需连接**);**把鼠标放在连接状态上**,悬浮提示里还能看到**这次连接实际走的出口**(`出口:直连 host:port` / `出口:经 HTTP 代理 host:port` / `出口:经跳板 <alias>`;没有连接时退化为 `出口(按配置):…`,配置读不出来时附上原因)——是**运行期的证据**,而不是设置页里"已保存的决定":后者描述的是下一次拨号会用哪条路,已经建立的连接不会被它改写,两者不一致时以 chip 为准。断线不再静默——已打开的编辑器标签保留缓存内容并切为**只读**(保存被拦截并说明原因),目录树继续显示已缓存目录、后台刷新静默,未缓存目录显示离线提示;连接恢复后自动刷新目录、Git 状态、**未修改的文件标签和只读 diff 标签**(有未保存改动的标签不动并提示)。错误态不会无限重连:每 30 秒最多自动重试 3 次,之后点状态图标手动重试。断线时「撤销这处改动」和 diff 的 hunk 操作同样被拦截;**单次操作的超时(deadline)不当作链路故障**——chip 保持正常,只有该次操作失败并说明原因;断线且该工作区没有缓存时,SCM 面板直接说明无法读取,而不是停在「加载中」。**不做**跨页面刷新的持久化缓存(远端源码不落盘),这是有意的隐私取舍 |
|
|
81
81
|
| 源代码管理 | **仓库目录选择器**(工作区里的 git 在子目录时用:浏览远端目录、一键跳到工作区内发现的仓库、手输相对/绝对路径,并逐目录提示会落在哪个仓库);变更/暂存/未跟踪/忽略分桶,**未跟踪目录行可点击展开**,逐文件与**逐 hunk** 暂存/还原、丢弃(带确认)、提交;分支/远程/stash 面板,**分支可重命名**、**远程可改 URL**、非仓库目录可直接**初始化仓库**(均需确认);同步(fetch/pull/push),**推送支持自定义 refspec**(如 Gerrit `HEAD:refs/for/<分支>`;留空 = 普通 `git push`,非空值会记住);fetch/pull/push/sync 有**实时输出面板**(SSE 流式显示 git/远端输出、运行计时、**可取消**(杀掉远端进程组)、完成后可复制完整输出;老 Host 无流式路由时自动回退到一次性结果) |
|
|
82
82
|
| 会话改动审阅 | 输入框上方的**可收纳**面板,按**会话**列出改了什么,可一键切到**本轮**(最近一个已完成轮次,默认仍是会话累计);一行一个文件(文件类型图标 + 右侧 `+a −b`);头部可**只看未审阅**并**跳到下一个未审阅**(回绕、不自动打 ✓);点文件在远程编辑器里打开并画**整行着色 + 行内字符级差异**,右上角 `n/N ↑↓` 跳改动点;悬浮改动行时行尾出现 `⋯` 菜单:**撤销**这处改动(远端 `git apply -R`,失败原因分类说明)或**确认保留**(块级、纯本地、与文件级 ✓ 不联动);行右键**查看差异**打开账本基线的**只读并排 diff**;已打开标签页的标记会随面板轮询被标成「位置已过期」。详见下文「会话改动审阅」 |
|
|
83
83
|
| 并排 Diff | 左右**严格等分** + 中间 gutter 逐 hunk 按钮 + **顶部横向滚动条**(一行很长也不会破坏对称)+ 行号钉在左侧,**只渲染视口内的行**(3000 行文件从 9000 个行容器降到约 174 个,滚动范围与整篇渲染完全一致);可切「变更前 / 变更后」,变更后可编辑并保存(保存写回工作树文件;超过 8MiB 的差异只读,避免把截断内容写回去) |
|
|
@@ -92,24 +92,60 @@ Host 转发(终端按 `__DSH_TRANSPORT__.streamBaseUrl` 解析地址),无
|
|
|
92
92
|
| 多终端 | 标签式多终端(`+` 新建、`✕`/中键关闭带确认)、可跨主机;刷新页面按 session id 自动重连回原会话,**重连时重放最近输出**(切换会话/重挂侧栏不再出现空白终端),**socket 全断开后会话保留 10 分钟**(够刷新、够切浏览器标签页接回),超时才关闭远端 shell;**socket 断开(而不是 shell 退出)时会话保留、可一键接回**(同一 session id 重连,Host 侧仍按上面 10 分钟 TTL 回收),只有真正退出才清会话 |
|
|
93
93
|
| 工作区 | 绑定列表 + 路由档位下拉 + 新建工作区双模向导(本地 / 远端);**解绑前确认**(会话与历史仍可读,新的远端调用会被拒绝) |
|
|
94
94
|
| 视图偏好 | 设置 → 远程主机页底部的两项:**新建的远程会话自动打开远程工作区**(默认关;只认远端工作区的会话,本机会话永不触发;每次页面加载对同一会话只判断一次,手动关掉的面板不会被重新打开)与**远程工作区占比**(默认 45%,20%–70%):插件打开右栏「远程工作台」页时,右侧面板按这个比例占窗口宽度;面板已打开时改占比立即生效。两项都存 Host 侧(`$DSH_HOME/dsh-remote-view.json`),同一 profile 的各窗口一致 |
|
|
95
|
-
| 端口转发 | 侧边栏「端口」页:列出远端监听端口(`ss`,没有则 `netstat`),对任一端口**一键转发到本地**、复制本地 URL、在浏览器打开;也支持手动「远端地址:端口 → 本地端口(可自动分配)」规则。**本地只监听 `127.0.0.1`**(`ssh -L`
|
|
95
|
+
| 端口转发 | 侧边栏「端口」页:列出远端监听端口(`ss`,没有则 `netstat`),对任一端口**一键转发到本地**、复制本地 URL、在浏览器打开;也支持手动「远端地址:端口 → 本地端口(可自动分配)」规则。**本地只监听 `127.0.0.1`**(`ssh -L` 语义,不暴露到局域网);**每台主机一条独立的转发 SSH 连接**(与浏览/命令共用的那条、以及终端专用那条分开,转发流量不会挤在 `git status`/SFTP 的通道前面),服务器拒绝额外连接时自动**回落共享连接**并在行上标「共享连接」,空闲 30 分钟随连接一起回收;每条转发有自己的通道预算,不占池里的 6 个执行/SFTP 通道;SSH 掉线或闲置回收后,下一条本地连接自动重拨而不影响监听;规则存浏览器(刷新后恢复),可逐条停止;关闭插件、删除主机、卸载插件都会释放本地端口。远端既没有 `ss` 也没有 `netstat`、或探测超时/中断时,明确显示「无法枚举」而不是空列表 |
|
|
96
96
|
|
|
97
97
|
### 主机与通道
|
|
98
98
|
|
|
99
99
|
| 能力 | 说明 |
|
|
100
100
|
| --- | --- |
|
|
101
101
|
| 主机管理 | 增删改查、连接测试;证书 / 密码认证;配置存 `$DSH_HOME/dsh-remote.json`(0600),与 `dsh-ssh.json` 独立 |
|
|
102
|
+
| 网络出口 | 每台主机可选 **跟随默认 / 直连 / 代理(HTTP CONNECT 或 SOCKS5)/ 跳板**。主机表单里的「网络出口」**默认收起**:收起时右侧一枚只读 chip 直接写出走向(`直连` / `跟随默认(直连)` / `跟随默认(经 HTTP 代理 192.0.2.10:3128)` / `经 SOCKS5 代理 …` / `经跳板 <alias>`),展开才出现字段(4 个模式单选、类型/主机/端口、用户名/密码、跳板下拉);按钮带 `aria-expanded`,Enter/Space 可切换。主机列表每行也有同样一枚 chip(「跟随默认」的行同样解析出实际走向,默认未知时只写「跟随默认」而不猜直连),配置无法使用时变**错误色**并把原因放进 `title`(跳板主机已被删除、跳板指向自己、端点非法)。**两级**:设置 →「远程主机」页另有一张可折叠的「默认网络出口」卡片(profile 级,默认直连),是「跟随默认」主机走的路,单台主机可覆盖;卡片的 chip 只反映**已保存**的值,改了没保存不会提前显示。代理密码**永不回显**:编辑既有主机时密码框为空、placeholder 写"已设置,留空则不修改",同一端点留空提交即保留(不发送 `password` 字段);**端点(类型/主机/端口/用户名)改了就不再沿用**,需要重填 |
|
|
102
103
|
| 密钥 bootstrap | 密码主机一键生成专用密钥对并下发 `authorized_keys`,之后走密钥 |
|
|
103
104
|
| 推送流水线 | 远端 arch/系统探测 → 版本比对 → 一致跳过 / 否则推送;executable 通道推送自编译 helper。失败后不再每次远端文件操作都重试:按 **5 秒起步、上限 5 分钟**的退避重试,设置页「推送」按钮可强制立即重试;**首次连接或协议自愈触发的自动推送成功后,右下角弹一条提示**(`alias:已自动推送远端 helper <版本>`),手动推送不弹(设置页已有状态) |
|
|
104
105
|
| 远端文件 | SFTP 浏览 / 读 / 写 / 新建 / 删除 / 改名。边界已加固:0 字节文件不再卡死,每个 SFTP 操作 60s 超时回收通道;**单个目录列表上限 20000 条**(按"目录在前、其余按名"排序后取前 20000,宿主日志说明——协议里没有"已截断"字段,界面上没有标记);**保存走侧文件 + 重命名**(优先服务端 `posix-rename`,不支持时备份-重命名-失败回滚),**写穿符号链接**(链接本身保留)并**尽力保留权限位**;SCM 状态解析会反解 git 的 C-quote 路径(凡名字含空格都会被加引号) |
|
|
105
106
|
| 远端终端 | ssh2 PTY + WebSocket,xterm 渲染(复制粘贴/主题跟随/刷新重连;**亮色主题下的选中高亮是可见的蓝底**(亮 `#add6ff` / 暗 `#264f78` + 失焦变体),不再是白底白字);`Shift+Insert` / `Ctrl+Shift+V` **只粘贴一次**(xterm 的按键钩子对 keyup 也会回调,此前同一个手势被处理两遍);**重新挂接只接管、不改尺寸**(刷新页面不会把运行中的 shell 缩成 80×24),行列没变化时不再发 resize 帧;**Ctrl+点击路径**在目录树里定位到该目录(绝对路径/`~/`/带 `/` 的相对路径,先按 shell 上报的 cwd、再按工作区根、最后按 home 逐个 stat 验证;路径不在任何工作区内会明确提示);**「常用指令」**面板(标题旁按钮)保存「指令名 + 指令内容」,点一条只粘贴到命令行**不发送**,`Ctrl+B` 快速新增,支持编辑/删除/拖拽排序(Alt+↑↓ 亦可),存在浏览器 localStorage;输入输出方面:**echo 走即时通道**(空闲后的第一段输出不等合并窗口)、一个短窗口内的输出**合并成一帧**(缓冲超过 64 KiB 立即刷、退出帧前必刷)、客户端输出**不依赖 xterm 的渲染回调**(渲染被节流时不再堵住后续输出)、socket 断开时释放未结算的背压字节(否则通道会被永久暂停),背压高水位 2 MiB / 低水位 512 KiB(在"内存有界"与"echo 延迟有界"之间取更偏交互的一侧);**终端独占一条 SSH 连接**(每主机 +1 条,握手失败回落共享连接),SFTP/git 的大流量不再排在终端输入输出前面;**单帧上限 1 MiB**,超过 64 Ki 字符的粘贴在客户端按码点分块发送,不再撑断连接 |
|
|
106
|
-
| 并发通道 |
|
|
107
|
-
| 运行监控 | 侧栏「监控」页:**仅在面板可见且页面在前台时**按刷新设置(默认 5 秒,可改 5/10/30 秒)采样一台/全部主机的 CPU、内存、磁盘、负载、网络速率、温度与运行时长,带 60 点历史曲线、手动刷新与暂停;范围可选「当前主机 / 指定主机 / 全部主机」并跨刷新记住。**首帧 CPU% 与网络速率显示「未知」**(差分需要第二帧),Linux 之外的平台如实显示「未知」而不是 0;Host 侧按 alias 缓存 3 秒并合并并发请求,一次采样只占一条执行通道、不占端口转发预算;样本只在内存,不落盘。**进程分区**(单主机、默认折叠、展开才采样):`ps` 快照按 CPU/内存/PID 排序,可按命令/用户/PID 过滤,行尾「结束」先确认;PID 必须来自最近快照,`ps`
|
|
107
|
+
| 并发通道 | 共享连接上按用途分开计数:**4 条**执行通道 + **2 条**网络命令通道(fetch/pull/push)+ **3 条 git 命令通道**(status/diff/log 与账本扫描、以及 commit/stage 等本地写)= **9 条计入上限**,另留 1 条给瞬时的能力探测/组 kill,合计不超过远端 sshd 实测的 `MaxSessions`(10)——**这是有界设计,不是余量**(这 1 个名额是从执行通道挪给 git 的:多工作区/多仓库同时扫描比并发 exec 更常见,代价是执行通道从 5 降到 4,第 5 个并发 exec 会排队而不是被拒);超出的操作排队最多等 **30 秒**(而不是被 sshd 硬拒,那会看起来像主机坏了),超时明确报 `remote host <alias> is busy`。文件传输、终端、端口转发各走自己的连接,不占这 9 条 |
|
|
108
|
+
| 运行监控 | 侧栏「监控」页:**仅在面板可见且页面在前台时**按刷新设置(默认 5 秒,可改 5/10/30 秒)采样一台/全部主机的 CPU、内存、磁盘、负载、网络速率、温度与运行时长,带 60 点历史曲线、手动刷新与暂停;范围可选「当前主机 / 指定主机 / 全部主机」并跨刷新记住。**首帧 CPU% 与网络速率显示「未知」**(差分需要第二帧),Linux 之外的平台如实显示「未知」而不是 0;Host 侧按 alias 缓存 3 秒并合并并发请求,一次采样只占一条执行通道、不占端口转发预算;样本只在内存,不落盘。**进程分区**(单主机、默认折叠、展开才采样):`ps` 快照按 CPU/内存/PID 排序,可按命令/用户/PID 过滤,行尾「结束」先确认;PID 必须来自最近快照,`ps` 不可用时明确显示无法枚举。**SSH 连接分区**(默认折叠、展开才采样):每台主机四类连接(共享 / 终端 / 端口转发 / 文件传输)各显示「开着或未开 · N 通道」,共享那一行附带这条连接**实际走的路**(直连 / HTTP 或 SOCKS5 代理 / 跳板,与连接 chip 同一套文案);下一行起是**通道预算与排队**,每个预算一行、**各自独立排队**:共享 `共享通道 3/4 · 排队 0`;宿主报告时再加 `文件传输通道 1/6 · 排队 0`、`网络命令通道 2/2 · 排队 1`(git fetch/pull/push)与 `git 命令通道 2/3 · 排队 1`(git status/diff/log 与会话账本扫描,以及 commit/stage/discard 等本地写)——**最多四行**,且只在对应预算有活跃或排队时出现。此外,**helper(p2 传输)走自己的 SSH 连接**:宿主报告时在四类连接之后再出一行 `helper 工具`(`开着 · 1 通道 · 3 个调用进行中`),括号外那半句是在飞 RPC 调用数——**不是队列**,所以它不计入排队徽标、摘要排队数与排序;宿主拿不到 helper 状态时整行不出现(不谎报「未开」)。**当前工作区绑定的主机始终排最前**,其次排队 >0 的主机(并标出排队数),其余按 alias 稳定排序;数字等宽,刷新不跳。主机拒绝专用 SFTP 连接、文件操作回落到共享连接时,「文件传输」行下方标出原因(读 `sftpFallback`,不是错误态)。数据是宿主对自己内存里连接池的一次本地读取(不发远端命令),宿主版本不认识该接口时只留标题 + 一行说明 |
|
|
108
109
|
| 超时与进程清理 | 普通 git 命令默认 300s(设置可调);**网络动词(fetch/pull/push/sync)默认 20 分钟、上限 30 分钟**。exec 跑在独立会话里(`setsid --wait`),超时/取消都先发 TERM、**3 秒后升级 KILL**,连同子进程一起收掉;远端没有 `setsid --wait` 时探测一次即知,退回旧行为并在宿主日志里写明"超时可能没停掉远端命令";**目录/多选归档下载有 600 秒服务端预算**(远端 `timeout -k 3 600`;远端没有 GNU `timeout` 时退回无预算的旧行为),超时以真实原因失败 |
|
|
109
110
|
| Git 图谱 | 远端仓库状态 + 分支 + SVG 提交图 + 提交详情/内容/差异面板(exec + 前端解析,零 Host 增量)|
|
|
110
111
|
| 导入 | 从 `~/.ssh/config`、从现有 `dsh-ssh.json` 一键导入(只读一次,不耦合);`Host a b` 这类多模式条目会逐个展开,`Include` 如实报告为未展开,被跳过的主机会给出可操作原因(缺 User / 缺 IdentityFile / 端口非法等)|
|
|
111
112
|
| 环境自检 | 每台主机一个「环境自检」:一条远端命令体检 OS/内核、glibc、`git`、`ripgrep`、`tar`、`setsid --wait` 能力、`$HOME` 磁盘余量、CPU/内存、已推送的 helper 版本、sshd 的 `MaxSessions`,结果一屏三态(**有 / 无 / 未知**)。"查不出"明确写成**未知**而不是"没有"(权限不足、输出不可解析、链路中断都属于未知);每项保留远端原话,stderr 合并而不是丢弃;可一键复制整份报告 |
|
|
112
113
|
|
|
114
|
+
### 网络出口(代理 / 跳板)
|
|
115
|
+
|
|
116
|
+
主机本身能直连、但这份网络里还需要一层出网时用得上。四个要点:
|
|
117
|
+
|
|
118
|
+
- **两级配置**:整个 profile 一个「默认网络出口」(设置 → 远程主机 → 默认网络出口,默认**直连**),每台主机
|
|
119
|
+
再选 `跟随默认 / 直连 / 代理 / 跳板`。旧主机没有这个字段,读作「跟随默认」,而默认的默认是直连 ⇒
|
|
120
|
+
**升级前后行为完全一致**;`跟随默认` 存的是"没有主张",不是把当时的值抄一份。
|
|
121
|
+
- **代理**支持 `HTTP CONNECT` 与 `SOCKS5`,两种都可带用户名/密码(Basic / SOCKS5 user-pass 子协商)。
|
|
122
|
+
- **跳板**是"用另一台已保存主机的 SSH 连接转发"(`direct-tcpip` 一跳),跳板本身按**它自己的**出口拨号
|
|
123
|
+
(直连 / 代理 / 跟随默认)。**多跳在解析阶段就被拒绝**(`ProxyJump a,b` 会被跳过并给出原因),写入阶段
|
|
124
|
+
也不允许把"正被别的主机当作跳板"的主机改成跳板(否则依赖方变成两跳链);行上标注的是两类运行期问题:
|
|
125
|
+
「链」(跳板自己又是跳板)与「悬空」(跳板主机已被删除),而不是等拨号时报一句"连接失败"。
|
|
126
|
+
- 失败信息分层:`代理层`(不可达 / 需要认证 / 拒绝隧道 / 协议不符)与 `目标层`(跳板不可用、端点非法)
|
|
127
|
+
分别给出可操作的句子,不再一律"connection failed"。
|
|
128
|
+
- 它只作用于插件自己的 SSH 拨号(exec / SFTP / 终端 / 端口转发都走同一套解析),不改系统环境变量,
|
|
129
|
+
也不接管 DSH 自身的 `HTTP_PROXY`。
|
|
130
|
+
|
|
131
|
+
导入 `~/.ssh/config` 时 `ProxyJump` / `ProxyCommand` 会一起映射:单跳 `ProxyJump bastion` 且该跳板主机
|
|
132
|
+
**也在同一份 config 里被导入**(条目可见即可,**与出现顺序无关**——`Host target` 写在 `Host bastion` 之前
|
|
133
|
+
照样两台都入库)→ `跳板`;`ProxyCommand nc -X connect -x host:port` → HTTP 代理、
|
|
134
|
+
`nc -x host:port` → SOCKS5、`ssh -W %h:%p bastion` → 跳板。多跳、第三方程序(`corkscrew` 等)、
|
|
135
|
+
跳板主机没被导入 —— 一律**跳过并给出原因**,而不是悄悄丢掉代理、留下一条注定连不上的直连主机。
|
|
136
|
+
|
|
137
|
+
#### 怎么确认"真的走了跳板"
|
|
138
|
+
|
|
139
|
+
**先看连接状态 chip 的悬浮提示**:它写的是**这次连接实际用的出口**(`出口:经跳板 <alias>` 之类),
|
|
140
|
+
不是设置里存的那条。两者会不一致——把出口从直连改成跳板时,已经建立的旧连接会按老出口继续服务,
|
|
141
|
+
直到这次 PATCH 把它丢掉(见上一条)。做完改动想独立确认,再登机器看三条:
|
|
142
|
+
|
|
143
|
+
1. **目标机**看对端是谁:`ss -tn state established '( sport = :<port> )'` —— 对端应当是**跳板的公网 IP**,
|
|
144
|
+
不是你本机。
|
|
145
|
+
2. **跳板机**看 sshd 有没有出站:`ss -tnp | grep <port>` —— 应当看到 `sshd` 进程到目标 `host:port` 的连接。
|
|
146
|
+
3. **本机**确认**没有**到目标端口的直连(理想是空输出):Linux `ss -tn state established '( dport = :<port> )'`;
|
|
147
|
+
Windows `Get-NetTCPConnection -RemotePort <port>`;macOS `netstat -an | grep <port>`。
|
|
148
|
+
|
|
113
149
|
### Agent 能力
|
|
114
150
|
|
|
115
151
|
| 能力 | 说明 |
|
|
@@ -134,7 +170,8 @@ dsh_remote_vs/
|
|
|
134
170
|
│ ├── sftp.ts # 远端文件引擎(SFTP 窗口读写/目录树操作)
|
|
135
171
|
│ ├── keygen.ts # 密码机密钥 bootstrap(生成→下发→翻转)
|
|
136
172
|
│ ├── deploy.ts # 推送流水线(探测/比对/传包/双验/manifest)
|
|
137
|
-
│ ├── importers.ts # ssh_config / dsh-ssh.json
|
|
173
|
+
│ ├── importers.ts # ssh_config / dsh-ssh.json 解析导入(ProxyJump/ProxyCommand → 出网设置)
|
|
174
|
+
│ ├── proxy.ts # 出网隧道(HTTP CONNECT / SOCKS5 握手 + ProxyJump/ProxyCommand 纯解析)
|
|
138
175
|
│ ├── routes.ts # /api/dsh-remote/* 路由表 + 终端 WebSocket 升级
|
|
139
176
|
│ ├── terminal.ts # PTY 会话注册表(刷新重连/断开清理)
|
|
140
177
|
│ ├── forward.ts # 本地端口转发管理器(direct-tcpip 通道/每规则监听器/连接预算)
|
|
@@ -199,16 +236,17 @@ dsh_remote_vs/
|
|
|
199
236
|
│ ├── ai-review.ts # AI 审查 prompt 构造(单文件 diff / 整提交,按字节分级,纯函数)
|
|
200
237
|
│ ├── api.ts # /api/dsh-remote 类型化 fetch 封装
|
|
201
238
|
│ ├── MonitorView.tsx # 监控面板(单机/全部主机、曲线、暂停/刷新、范围持久化)
|
|
239
|
+
│ ├── ConnectionsSection.tsx # 监控页 SSH 连接池分区(四类连接/通道数/槽位排队/实际出口;折叠即零采样)
|
|
202
240
|
│ ├── metrics-model.ts # 监控纯模型(历史窗口/Sparkline 几何/容量与速率格式化)
|
|
203
241
|
│ ├── HostsView / WorkspacesView / WorkspaceWizard / TerminalView / XTerm / PortsView / Dialog
|
|
204
|
-
│ ├── SettingsHosts.tsx # 设置两节 occupant
|
|
242
|
+
│ ├── SettingsHosts.tsx # 设置两节 occupant(主机管理/绑定列表/默认网络出口,自取数)
|
|
205
243
|
│ ├── DirectoryFlow.tsx # 原生入口 occupant(本地双模/远端向导)
|
|
206
244
|
│ ├── RemoteDirectoryPicker.tsx# 远端目录浏览弹窗
|
|
207
245
|
│ └── i18n.ts / theme.ts / ui.tsx # 双语词典/主题信号/共享样式
|
|
208
246
|
├── vendor/dsh-remote-helpers/ # helper 种子(随包发布,启动铺缓存,见下)
|
|
209
247
|
├── docs/ # 本地工作文档(不推送 GitHub;只有 docs/media/ 的截图随仓库公开)
|
|
210
248
|
│ ├── MAINTENANCE.md # 本地私有(.gitignore,不入库):升级影响面/检查清单/踩坑/发布流程
|
|
211
|
-
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.
|
|
249
|
+
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.30.0)
|
|
212
250
|
│ └── GATES.md # 本地私有:本地门禁清单与实跑条数
|
|
213
251
|
├── locale/ # 插件元信息双语
|
|
214
252
|
└── lib/ # 构建产物(**必须入库**,只有 .map 忽略;link 安装后重启即生效)
|
|
@@ -294,6 +332,8 @@ dsh_remote_vs/
|
|
|
294
332
|
- **监控的边界**:采样只在「监控」面板可见且页面在前台时进行(隐藏即完全停止,不产生远端流量);完整指标来自 Linux `/proc`,
|
|
295
333
|
其它平台显示「未知」;温度只在主机暴露 thermal zone 时有值(很多虚拟机没有);CPU% 与网络速率是两帧差分,**首帧为未知**;
|
|
296
334
|
样本只进内存,刷新页面后曲线从头开始。
|
|
335
|
+
- **连接池分区的边界**:采样同样只在「分区已展开 + 面板可见 + 页面在前台」时进行(折叠即零请求,不产生任何流量);
|
|
336
|
+
它读的是宿主内存里的连接状态,不发远端命令;宿主版本不认识该接口(404)时只留标题与一行说明,之后不再重复请求。
|
|
297
337
|
|
|
298
338
|
## 会话改动审阅(Cursor 式)
|
|
299
339
|
|
|
@@ -303,6 +343,10 @@ dsh_remote_vs/
|
|
|
303
343
|
会话改动账本(`/api/dsh-remote/changes`),不是 DSH 的 `workspaceChanges` —— 后者看不见被路由的会话
|
|
304
344
|
(探针实测:58 个远端会话、0 个改动事件)。
|
|
305
345
|
|
|
346
|
+
- **新文件怎么扫**:未跟踪文件先跑一次 `git ls-files --others --directory` 的**快走**(遇到未跟踪目录只报目录、
|
|
347
|
+
不再逐个下潜,monorepo 上省掉整趟遍历),再只对报出来的目录做**有界展开**(一条批量命令问全部目录,空目录不花往返;最多 20 个目录、累计文件仍受
|
|
348
|
+
500 行上限、与快走共用一个 60 秒预算);超限/超时/展开失败会把列表标成**不完整**并在面板说明,不会静默少列。
|
|
349
|
+
没有未跟踪目录时这一步**不发任何额外命令**。
|
|
306
350
|
- **面板**:一行一个文件(文件类型图标 + 相对路径 + 右侧 `+a −b`),宽度与输入卡**左右对齐**;
|
|
307
351
|
点标题栏折叠/展开,`⟳` 强制立即重扫。没有改动时显示「本会话还没有改动文件。」;统计不出来时显示
|
|
308
352
|
**具体原因**(见下面的边界),不会丢一个空列表让人猜。
|