dsh-remote-vs 0.28.0 → 0.29.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 +50 -5
- package/README.md +42 -5
- package/lib/client.js +217 -112
- package/lib/index.js +1468 -51
- package/lib/types/client/HostsView.d.ts +139 -2
- package/lib/types/client/api.d.ts +25 -1
- package/lib/types/client/connection.d.ts +28 -1
- package/lib/types/forward.d.ts +11 -1
- package/lib/types/pool.d.ts +95 -1
- package/lib/types/protocol.d.ts +122 -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/package.json +1 -1
- package/src/client/ConnectionStatus.tsx +19 -5
- package/src/client/HostsView.tsx +552 -11
- package/src/client/PortsView.tsx +16 -0
- package/src/client/SettingsHosts.tsx +132 -6
- package/src/client/api.ts +30 -0
- package/src/client/connection.ts +76 -2
- package/src/client/i18n.ts +102 -0
- package/src/client/vsc/vsc.css +105 -0
- package/src/forward.ts +38 -2
- package/src/importers.ts +125 -13
- package/src/keygen.ts +8 -1
- package/src/pool.ts +422 -27
- package/src/protocol.ts +128 -0
- package/src/proxy.ts +673 -0
- package/src/routes.ts +73 -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,13 +107,14 @@ 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) |
|
|
@@ -125,6 +126,49 @@ extra configuration is needed.
|
|
|
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)
|
|
@@ -216,14 +261,14 @@ dsh_remote_vs/
|
|
|
216
261
|
│ ├── MonitorView.tsx # monitor panel (one/all hosts, curves, pause/refresh, persisted scope)
|
|
217
262
|
│ ├── metrics-model.ts # monitor model (history window/sparkline geometry/capacity+rate formatting)
|
|
218
263
|
│ ├── HostsView / WorkspacesView / WorkspaceWizard / TerminalView / XTerm / PortsView / Dialog
|
|
219
|
-
│ ├── SettingsHosts.tsx # settings occupants (host mgmt/binding list, self-fetching)
|
|
264
|
+
│ ├── SettingsHosts.tsx # settings occupants (host mgmt/binding list/default egress, self-fetching)
|
|
220
265
|
│ ├── DirectoryFlow.tsx # native entry occupant (local dual-mode/remote wizard)
|
|
221
266
|
│ ├── RemoteDirectoryPicker.tsx# remote directory browser dialog
|
|
222
267
|
│ └── i18n.ts / theme.ts / ui.tsx # bilingual dictionary/theme signal/shared styles
|
|
223
268
|
├── vendor/dsh-remote-helpers/ # helper seeds (shipped, seeded into cache at startup, see below)
|
|
224
269
|
├── docs/ # local-only working docs (only docs/media/ screenshots ship)
|
|
225
270
|
│ ├── 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.
|
|
271
|
+
│ ├── VERSION-HISTORY.md # local-only: per-release change log (0.7.1 → 0.29.0)
|
|
227
272
|
│ └── GATES.md # local-only: local gate inventory and measured assertion counts
|
|
228
273
|
├── locale/ # bilingual plugin metadata
|
|
229
274
|
└── lib/ # build output (**must be committed**; only .map is ignored; restart after link install)
|
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,13 +92,14 @@ 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 路径(凡名字含空格都会被加引号) |
|
|
@@ -110,6 +111,41 @@ Host 转发(终端按 `__DSH_TRANSPORT__.streamBaseUrl` 解析地址),无
|
|
|
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 通道/每规则监听器/连接预算)
|
|
@@ -201,14 +238,14 @@ dsh_remote_vs/
|
|
|
201
238
|
│ ├── MonitorView.tsx # 监控面板(单机/全部主机、曲线、暂停/刷新、范围持久化)
|
|
202
239
|
│ ├── metrics-model.ts # 监控纯模型(历史窗口/Sparkline 几何/容量与速率格式化)
|
|
203
240
|
│ ├── HostsView / WorkspacesView / WorkspaceWizard / TerminalView / XTerm / PortsView / Dialog
|
|
204
|
-
│ ├── SettingsHosts.tsx # 设置两节 occupant
|
|
241
|
+
│ ├── SettingsHosts.tsx # 设置两节 occupant(主机管理/绑定列表/默认网络出口,自取数)
|
|
205
242
|
│ ├── DirectoryFlow.tsx # 原生入口 occupant(本地双模/远端向导)
|
|
206
243
|
│ ├── RemoteDirectoryPicker.tsx# 远端目录浏览弹窗
|
|
207
244
|
│ └── i18n.ts / theme.ts / ui.tsx # 双语词典/主题信号/共享样式
|
|
208
245
|
├── vendor/dsh-remote-helpers/ # helper 种子(随包发布,启动铺缓存,见下)
|
|
209
246
|
├── docs/ # 本地工作文档(不推送 GitHub;只有 docs/media/ 的截图随仓库公开)
|
|
210
247
|
│ ├── MAINTENANCE.md # 本地私有(.gitignore,不入库):升级影响面/检查清单/踩坑/发布流程
|
|
211
|
-
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.
|
|
248
|
+
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.29.0)
|
|
212
249
|
│ └── GATES.md # 本地私有:本地门禁清单与实跑条数
|
|
213
250
|
├── locale/ # 插件元信息双语
|
|
214
251
|
└── lib/ # 构建产物(**必须入库**,只有 .map 忽略;link 安装后重启即生效)
|