dsh-remote-vs 0.23.0 → 0.25.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 +49 -15
- package/README.md +40 -14
- package/lib/client.js +45978 -43338
- package/lib/index.js +388 -90
- package/lib/p2-router-fs.js +1 -1
- package/lib/types/client/CodeEditor.d.ts +17 -0
- package/lib/types/client/EditorPane.d.ts +16 -5
- package/lib/types/client/FloatingPlaceholder.d.ts +16 -5
- package/lib/types/client/RemoteEditorView.d.ts +13 -10
- package/lib/types/client/RemoteRoot.d.ts +5 -5
- package/lib/types/client/SettingsHosts.d.ts +3 -0
- package/lib/types/client/TerminalSnippets.d.ts +36 -0
- package/lib/types/client/TerminalView.d.ts +1 -1
- package/lib/types/client/XTerm.d.ts +33 -0
- package/lib/types/client/api.d.ts +4 -1
- package/lib/types/client/auto-open-remote.d.ts +41 -0
- package/lib/types/client/editor-capability.d.ts +27 -0
- package/lib/types/client/i18n.d.ts +1 -1
- package/lib/types/client/store.d.ts +59 -4
- package/lib/types/client/terminal-input.d.ts +23 -0
- package/lib/types/client/terminal-snippets.d.ts +86 -0
- package/lib/types/client/use-remote-chat-target.d.ts +2 -0
- package/lib/types/client/view-settings.d.ts +40 -0
- package/lib/types/client/vsc/breadcrumb.d.ts +30 -0
- package/lib/types/client/vsc/editor-caret.d.ts +32 -0
- package/lib/types/client/vsc/editor-langs.d.ts +9 -0
- package/lib/types/client/vsc/editor-settings.d.ts +55 -0
- package/lib/types/client/vsc/image-preview.d.ts +36 -0
- package/lib/types/client/vsc/kit.d.ts +2 -0
- package/lib/types/client/vsc/terminal-clipboard.d.ts +15 -0
- package/lib/types/client/vsc/terminal-line.d.ts +25 -0
- package/lib/types/client/vsc/terminal-links.d.ts +62 -0
- package/lib/types/client/vsc/terminal-theme.d.ts +22 -0
- package/lib/types/client/vsc/terminal-writer.d.ts +52 -0
- package/lib/types/paths.d.ts +9 -0
- package/lib/types/pool.d.ts +25 -0
- package/lib/types/protocol.d.ts +35 -0
- package/lib/types/routes.d.ts +7 -0
- package/lib/types/terminal.d.ts +25 -1
- package/lib/types/view-settings.d.ts +26 -0
- package/lib/{worlds-DXdP4SMn.js → worlds-B7gEDBzC.js} +13 -1
- package/package.json +36 -36
- package/src/client/CodeEditor.tsx +54 -2
- package/src/client/EditorPane.tsx +485 -107
- package/src/client/FloatingPlaceholder.tsx +34 -5
- package/src/client/RemoteEditorView.tsx +14 -11
- package/src/client/RemoteRoot.tsx +20 -125
- package/src/client/SettingsHosts.tsx +81 -3
- package/src/client/TerminalSnippets.tsx +357 -0
- package/src/client/TerminalView.tsx +50 -1
- package/src/client/XTerm.tsx +228 -58
- package/src/client/api.ts +7 -0
- package/src/client/auto-open-remote.ts +439 -0
- package/src/client/editor-capability.ts +42 -0
- package/src/client/i18n.ts +158 -6
- package/src/client/index.tsx +30 -6
- package/src/client/store.tsx +165 -13
- package/src/client/terminal-input.ts +44 -0
- package/src/client/terminal-snippets.ts +216 -0
- package/src/client/use-remote-chat-target.ts +1 -1
- package/src/client/view-settings.ts +99 -0
- package/src/client/vsc/breadcrumb.tsx +251 -0
- package/src/client/vsc/editor-caret.ts +30 -0
- package/src/client/vsc/editor-langs.ts +20 -0
- package/src/client/vsc/editor-settings.ts +146 -0
- package/src/client/vsc/editor-theme.ts +4 -5
- package/src/client/vsc/image-preview.tsx +110 -0
- package/src/client/vsc/kit.tsx +20 -1
- package/src/client/vsc/terminal-clipboard.ts +19 -0
- package/src/client/vsc/terminal-line.ts +101 -0
- package/src/client/vsc/terminal-links.ts +166 -0
- package/src/client/vsc/terminal-theme.ts +71 -0
- package/src/client/vsc/terminal-writer.ts +112 -0
- package/src/client/vsc/vsc.css +687 -48
- package/src/index.ts +6 -0
- package/src/paths.ts +13 -0
- package/src/pool.ts +99 -27
- package/src/protocol.ts +45 -0
- package/src/routes.ts +47 -0
- package/src/terminal.ts +160 -6
- package/src/view-settings.ts +133 -0
package/README.en.md
CHANGED
|
@@ -8,10 +8,11 @@ SSH host management inside the DSH Host process + helper push pipeline + a **VS
|
|
|
8
8
|
workbench** (explorer / search / source control / commit graph with its commit-details pane / multi-tab editor / floating editor /
|
|
9
9
|
side-by-side diff / multiple terminals / port forwarding). Hosts live in DSH Settings ("Remote hosts"); with `dsh-better-sidebar` installed
|
|
10
10
|
there is an extra standalone "Remote Workspace" tab, otherwise it falls back to a native right-Sidebar "Remote Workspace"
|
|
11
|
-
page (same content, self-opened from the guide, per-session instances). The editor is
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
page (same content, self-opened from the guide, per-session instances). **The sidebar's editor is the DEFAULT
|
|
12
|
+
seat**: opening a file switches the whole column to it (one view at a time, no tree/editor split) and closing
|
|
13
|
+
the last file returns to the directory. The conversation view slot is registered too, but as the OPTIONAL
|
|
14
|
+
full-width seat — the editor's own expand/dock button moves the same buffer between the two. Since P2, native
|
|
15
|
+
tools inside remote workspaces transparently run remotely (see below).
|
|
15
16
|
|
|
16
17
|
```text
|
|
17
18
|
┌─ Local DSH Host ─────────────────────────┐
|
|
@@ -37,14 +38,14 @@ dsh plugin --profile web add dsh-remote-vs
|
|
|
37
38
|
(From npm, recommended; installing straight from the repository also works:
|
|
38
39
|
`dsh plugin --profile web add github:xiray-xia/dsh-remote-vs`.)
|
|
39
40
|
|
|
40
|
-
**Requires DSH `0.2.2-rc.
|
|
41
|
-
**adapted to and typechecked against `0.2.2-rc.
|
|
41
|
+
**Requires DSH `0.2.2-rc.5` or newer and below `0.3.0`** (`engines.dsh` enforces the range;
|
|
42
|
+
**adapted to and typechecked against `0.2.2-rc.5`**). On Host `0.2.2-rc.4` use plugin `0.23.0`; `0.2.2-rc.2` / `0.2.2-rc.3` use plugin `0.22.0`; on `0.2.2-alpha.3` / `0.2.2-rc.1` use `0.20.1`; the
|
|
42
43
|
`0.2.2-alpha.2` generation needs `0.17.0` and the `0.2.1-rc.2` generation needs `0.9.3`. `--profile web` selects which profile to install into —
|
|
43
44
|
this is a Web plugin, so it has to go into the profile your Web GUI runs from (`web` is
|
|
44
45
|
the common name; use your own profile's name). Desktop uses the reserved `desktop`
|
|
45
46
|
profile instead — see [Desktop](#desktop-dsh-desktop) below.
|
|
46
47
|
|
|
47
|
-
> **Upgrading from `0.22.0
|
|
48
|
+
> **Upgrading from `0.22.0` (or older)**: the remote helper's wire protocol moves from **2 to 3** (`0.23.0` onward keeps the helper stable, and `0.23.0 → 0.24.0` re-pushes nothing).
|
|
48
49
|
> Existing host records are recognised as an older generation and the new helper is pushed
|
|
49
50
|
> automatically on the first connection (this needs the old build to still be in the local
|
|
50
51
|
> helper cache; if that cache was cleared, press **Push** once in Settings). Each host pays
|
|
@@ -81,7 +82,7 @@ Install either way:
|
|
|
81
82
|
`desktop` is reserved for the Electron application: an **npm-installed `dsh` cannot manage
|
|
82
83
|
it** (it answers `profile "desktop" is managed exclusively by the Electron application`),
|
|
83
84
|
so one of the two routes above is required. The Desktop release version equals the DSH
|
|
84
|
-
runtime it bundles, and it must satisfy `engines.dsh` (`>=0.2.2-rc.
|
|
85
|
+
runtime it bundles, and it must satisfy `engines.dsh` (`>=0.2.2-rc.5`; check About);
|
|
85
86
|
older releases make the Plugins page refuse the install. Desktop opens no visible Web
|
|
86
87
|
port, but the plugin's HTTP routes and terminal socket are forwarded through Desktop's
|
|
87
88
|
Host (the terminal resolves its address from `__DSH_TRANSPORT__.streamBaseUrl`), so no
|
|
@@ -115,6 +116,7 @@ extra configuration is needed.
|
|
|
115
116
|
| Jump | Clicking a search hit opens the file at that line, centres it and **lights the landing line** (fades after ~2.6s); repeat jumps in the same file work |
|
|
116
117
|
| 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 |
|
|
117
118
|
| 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) |
|
|
119
|
+
| 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 |
|
|
118
120
|
| 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 |
|
|
119
121
|
|
|
120
122
|
### Hosts and transport
|
|
@@ -125,7 +127,7 @@ extra configuration is needed.
|
|
|
125
127
|
| Key bootstrap | One click generates a dedicated keypair on password hosts and deploys `authorized_keys`, key auth from then on |
|
|
126
128
|
| 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) |
|
|
127
129
|
| 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) |
|
|
128
|
-
| Remote terminal | ssh2 PTY + WebSocket, xterm rendering (copy-paste/theme-follow/reconnect-on-refresh); **a reattach only takes over, it does not resize** (a page reload no longer shrinks a running shell to 80×24); an output backlog applies real backpressure to the far end; **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 |
|
|
130
|
+
| 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 |
|
|
129
131
|
| Concurrent channels | At most **6** remote channels per host at a time (no longer colliding with the far end's sshd `MaxSessions`); the 7th queues for up to **30 seconds** and then fails with `remote host <alias> is busy` instead of piling on connections |
|
|
130
132
|
| 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 |
|
|
131
133
|
| 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 |
|
|
@@ -150,8 +152,9 @@ dsh_remote_vs/
|
|
|
150
152
|
├── src/
|
|
151
153
|
│ ├── index.ts # plugin entry: store/pool/worlds/routes/tools/preset-switch wiring
|
|
152
154
|
│ ├── protocol.ts # frontend/backend wire contract (route table + pure types, shared)
|
|
153
|
-
│ ├── paths.ts #
|
|
155
|
+
│ ├── paths.ts # addressing under $DSH_HOME (store/view preferences/keys/build cache/alias dirs)
|
|
154
156
|
│ ├── store.ts # host + binding + tombstone persistence (0600 JSON, atomic writes)
|
|
157
|
+
│ ├── view-settings.ts # client view-preference persistence (auto-open remote workspace / panel width share, 0600 JSON, atomic writes)
|
|
155
158
|
│ ├── pool.ts # ssh2 long-lived pool (exec/shell/sftp/putFile, TOFU host keys)
|
|
156
159
|
│ ├── sftp.ts # remote file engine (SFTP windowed reads-writes/tree ops)
|
|
157
160
|
│ ├── keygen.ts # password-host key bootstrap (generate→deploy→flip)
|
|
@@ -183,6 +186,8 @@ dsh_remote_vs/
|
|
|
183
186
|
│ │ └── bridge-refs.ts # standalone refs bridge (local-refs needs workingDirectory: must split)
|
|
184
187
|
│ └── client/ # ── browser half (React, bundled into lib/client.js) ──
|
|
185
188
|
│ ├── index.tsx # surface decision (better-first/settle-boost/native fallback) + settings + directoryFlow takeover
|
|
189
|
+
│ ├── auto-open-remote.ts # a remote session's first appearance opens the plugin's right-panel page at the configured width share
|
|
190
|
+
│ ├── view-settings.ts # client view-preference cache (load/save/subscribe; shared by the settings page and the auto-open behaviour)
|
|
186
191
|
│ ├── store.tsx # module-level state shared by both surfaces (useSyncExternalStore; open files/terminals/view live here)
|
|
187
192
|
│ ├── RemoteRoot.tsx # sidebar surface: VS Code activity rail (explorer/search/SCM/history/editor/terminal/workspaces)
|
|
188
193
|
│ ├── RemoteEditorView.tsx # conversation-view surface (the "remote editor" tab next to 对话/轨迹, full width)
|
|
@@ -228,7 +233,7 @@ dsh_remote_vs/
|
|
|
228
233
|
├── vendor/dsh-remote-helpers/ # helper seeds (shipped, seeded into cache at startup, see below)
|
|
229
234
|
├── docs/ # local-only working docs (only docs/media/ screenshots ship)
|
|
230
235
|
│ ├── MAINTENANCE.md # local-only (.gitignore), not shipped: upgrade impact, checklist, pitfalls, release
|
|
231
|
-
│ ├── VERSION-HISTORY.md # local-only: per-release change log (0.7.1 → 0.
|
|
236
|
+
│ ├── VERSION-HISTORY.md # local-only: per-release change log (0.7.1 → 0.25.0)
|
|
232
237
|
│ └── GATES.md # local-only: local gate inventory and measured assertion counts
|
|
233
238
|
├── locale/ # bilingual plugin metadata
|
|
234
239
|
└── lib/ # build output (**must be committed**; only .map is ignored; restart after link install)
|
|
@@ -251,9 +256,25 @@ checking the build artifact). Both are covered under "Development".
|
|
|
251
256
|
|
|
252
257
|

|
|
253
258
|
|
|
254
|
-
Both surfaces share one state module (`store.tsx`): **the sidebar "Remote Workspace" page** (
|
|
255
|
-
`dsh-better-sidebar` is installed, otherwise the native right-Sidebar page
|
|
256
|
-
"remote editor" tab** (
|
|
259
|
+
Both surfaces share one state module (`store.tsx`): **the sidebar "Remote Workspace" editor page** (the default
|
|
260
|
+
seat — a standalone tab when `dsh-better-sidebar` is installed, otherwise the native right-Sidebar page; it owns
|
|
261
|
+
the whole column) and **the conversation-view "remote editor" tab** (the optional full-width seat next to
|
|
262
|
+
对话/轨迹). Only one of them is mounted at a time and the buffer, caret and scroll position are handed over
|
|
263
|
+
when the seat changes.
|
|
264
|
+
|
|
265
|
+
- **Editor chrome** (ported from the local sidebar plugin): an opaque VS Code Dark+/Light+ code surface
|
|
266
|
+
(`#1e1e1e` / `#ffffff`) with editor-panel tokens, a 30px tab strip (dirty dot, middle-click close, diff/image
|
|
267
|
+
glyphs), an info bar with reload / save / word-wrap / font A−A+ / float / seat switch, and — in the full-width
|
|
268
|
+
seat — a **clickable breadcrumb** (sibling-file picker over the remote listing route) plus a **status bar**
|
|
269
|
+
(language, line:column, selected characters, indent, wrap, font size, save state, UTF-8). Word wrap is one
|
|
270
|
+
shared preference persisted in localStorage (all seats); font size is shared by the docked and full-width
|
|
271
|
+
seats, while the floating window keeps its own per-window `Ctrl+wheel` zoom.
|
|
272
|
+
- **Image preview**: png/jpg/jpeg/gif/webp/bmp/ico/avif render in the tab with a click-to-toggle
|
|
273
|
+
fit/actual size and the file size plus pixel dimensions; a capped read says "image too large" instead of
|
|
274
|
+
drawing a broken thumbnail. SVG keeps opening as TEXT (editable) — it is markup, not a raster image.
|
|
275
|
+
- **Closing the last file returns to the directory**: the editor page hands the column back to the explorer
|
|
276
|
+
(a dirty tab still asks first). A diff tab carries one extra icon: **switch to content editing**, opening the
|
|
277
|
+
same path as an editable content tab (commit drill-downs, deletions and binary diffs do not offer it).
|
|
257
278
|
|
|
258
279
|
- **Activity rail**: explorer / search / source control / commit graph / editor / terminal / workspaces.
|
|
259
280
|
A panel stays mounted after its first visit, so switching back neither refetches nor flashes. While it is
|
|
@@ -273,6 +294,9 @@ Both surfaces share one state module (`store.tsx`): **the sidebar "Remote Worksp
|
|
|
273
294
|
- **Editor**: tabs plus an info bar (path, language, **build stamp**, `tok N` coloured-token count,
|
|
274
295
|
saved state, reload/save). Those three marks exist for troubleshooting: the stamp answers "is the
|
|
275
296
|
browser running the bundle I just built?", `tok 0` answers "did a grammar match this extension?".
|
|
297
|
+
A **diff tab** carries one extra icon next to "reload the diff": **switch to content editing**, which opens
|
|
298
|
+
the same path as an editable content tab (working-tree / staged diffs; commit drill-downs do not offer it —
|
|
299
|
+
opening today's file from a historical blob would read as editing the commit).
|
|
276
300
|
- **Floating editor**: "Open in floating editor" from the file-tree / search-hit / source-control context
|
|
277
301
|
menus, or double-click the "remote editor" tab, lifts the editor into a window above the shell (same tabs
|
|
278
302
|
and buffers; closing or docking puts it back on its original surface). Drag the title bar, resize from the
|
|
@@ -287,9 +311,19 @@ Both surfaces share one state module (`store.tsx`): **the sidebar "Remote Worksp
|
|
|
287
311
|
- **Terminals**: tabbed sessions with the session id persisted one by one, so a page refresh reattaches
|
|
288
312
|
to the shells that are still running; **a reattach only takes over, it does not resize** (a live shell is
|
|
289
313
|
never shrunk to 80×24 — the true size comes from the one tab that can measure itself, sent as a `resize`
|
|
290
|
-
frame
|
|
314
|
+
frame, and no frame is sent when rows/columns did not change); the selection highlight is **readable in
|
|
315
|
+
both themes** (`#add6ff` light / `#264f78` dark, with dimmer unfocused variants) and `Shift+Insert` /
|
|
316
|
+
`Ctrl+Shift+V` insert exactly once; output within a short window is coalesced into one frame (far fewer
|
|
317
|
+
frames and JSON parses for a busy command, always flushed before the exit frame); a session is kept for **10 minutes** after its last socket goes away before the remote shell is
|
|
291
318
|
closed (it used to be kept forever, so closing the browser left the shell holding an sshd session slot).
|
|
292
319
|
- **Known limits (stated honestly)**:
|
|
320
|
+
- **Occasional terminal hitches have three known sources**: (1) the PTY shares ONE SSH connection with SFTP / git / helper traffic — **now fixed for the PTY: it dials its own connection per host** (falling back to the shared one if the server refuses another), so bulk transfer no longer queues ahead of the terminal;
|
|
321
|
+
(2) while output is streaming, the echo of what you type is ordered after the output already produced
|
|
322
|
+
(that is every terminal; `Ctrl+C` still works because the input path is not blocked by output
|
|
323
|
+
backpressure); (3) heavy agent work blocking the host's event loop slows both directions. This round
|
|
324
|
+
fixed what is ours to fix: the client no longer waits on xterm's render callback, the host does not hold
|
|
325
|
+
a post-idle echo in the coalescing window, the backpressure marks are 2 MiB / 512 KiB, and a closing
|
|
326
|
+
socket releases its unsettled bytes. **The host-side part needs a `dsh web` restart.**
|
|
293
327
|
- There is **no public API to select the "remote editor" view**; the plugin can only click the shell's
|
|
294
328
|
own tab by its label and toasts a hint when that fails (`revealEditor()`).
|
|
295
329
|
- Untracked directories arrive as a **single `dir/` row**; clicking it **expands** the files inside
|
package/README.md
CHANGED
|
@@ -8,8 +8,9 @@ Host 进程内的 SSH 主机管理 + helper 推送流水线 + **VS Code 式远
|
|
|
8
8
|
(资源管理器 / 搜索 / 源代码管理 / 提交图与提交详情面板 / 多标签编辑器 / 悬浮编辑器 / 并排 Diff / 多终端 / 端口转发)。
|
|
9
9
|
主机配在 DSH 设置里(“远程主机”项);装了 `dsh-better-sidebar` 时另有
|
|
10
10
|
独立“远程工作台”tab,没装则退到原生右侧栏“远程工作台”页(同内容,引导页自助开,per-session 实例)。
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
**侧栏「远程工作台」的编辑器是默认面**:打开文件即整栏切到编辑器,关闭最后一个文件自动回到目录,
|
|
12
|
+
外观对齐本地侧边栏插件(VS Code 不透明代码背景、标签条、信息栏、图片预览、查找/换行/字号)。
|
|
13
|
+
会话视图槽里的**远程编辑器**标签是可选的全宽面 —— 信息栏的展开按钮切过去、收回按钮切回来,两个面共用同一份缓冲区。
|
|
13
14
|
P2 起原生工具在远端工作区里透明跑远端(见下)。
|
|
14
15
|
|
|
15
16
|
```text
|
|
@@ -34,13 +35,13 @@ dsh plugin --profile web add dsh-remote-vs
|
|
|
34
35
|
|
|
35
36
|
(从 npm 装,推荐;也可以直接跟仓库装:`dsh plugin --profile web add github:xiray-xia/dsh-remote-vs`。)
|
|
36
37
|
|
|
37
|
-
**需要 DSH `0.2.2-rc.
|
|
38
|
-
Host 仍是 `0.2.2-rc.2` / `0.2.2-rc.3` 的请用插件 `0.22.0`;`0.2.2-alpha.3` / `0.2.2-rc.1` 的请用 `0.20.1`;`0.2.2-alpha.2` 一代请用 `0.17.0`;`0.2.1-rc.2` 一代请用 `0.9.3`。
|
|
38
|
+
**需要 DSH `0.2.2-rc.5` 及以上、`0.3.0` 以下**(`engines.dsh` 门到底;已按 rc.5 适配并通过类型检查与本地全量门禁)。
|
|
39
|
+
Host 仍是 `0.2.2-rc.4` 的请用插件 `0.23.0`;`0.2.2-rc.2` / `0.2.2-rc.3` 的请用插件 `0.22.0`;`0.2.2-alpha.3` / `0.2.2-rc.1` 的请用 `0.20.1`;`0.2.2-alpha.2` 一代请用 `0.17.0`;`0.2.1-rc.2` 一代请用 `0.9.3`。
|
|
39
40
|
`--profile web` 指明装进哪个 profile —— 本插件是 Web 插件,
|
|
40
41
|
要装进 Web GUI 所用的那个(`web` 是常见命名,以你自己的 profile 名为准);
|
|
41
42
|
桌面端用的是保留 profile `desktop`,见下面「桌面端」。
|
|
42
43
|
|
|
43
|
-
> **从 `0.22.0
|
|
44
|
+
> **从 `0.22.0`(或更早)升级要注意**:远端 helper 的 wire 协议由 **2 升到 3**(`0.23.0` 起 helper 不再变化,`0.23.0 → 0.24.0` 不涉及 helper 重推)。已有主机的部署记录会被识别为旧代,
|
|
44
45
|
> 首次连接该主机时自动重推新 helper(本机缓存里还留有旧版构建即可自动判定;缓存被清理过时,在设置页点一次
|
|
45
46
|
> 「推送」即可),每台主机首次会多一次约 47 MB 的上传。旧 helper 目录会保留,回滚就是推回旧版本。
|
|
46
47
|
|
|
@@ -67,7 +68,7 @@ Host 仍是 `0.2.2-rc.2` / `0.2.2-rc.3` 的请用插件 `0.22.0`;`0.2.2-alpha.
|
|
|
67
68
|
注意:`desktop` 是桌面端独占的保留 profile,**npm 全局安装的 `dsh` 不能管理它**
|
|
68
69
|
(会报 `profile "desktop" is managed exclusively by the Electron application`),
|
|
69
70
|
只能走上面两条路径。桌面端的版本号等于它捆绑的 DSH 运行时版本,同样要满足
|
|
70
|
-
`engines.dsh` 要求(`>=0.2.2-rc.
|
|
71
|
+
`engines.dsh` 要求(`>=0.2.2-rc.5`,关于面板可看);低于该版本时插件页会直接拒绝
|
|
71
72
|
安装。桌面端没有可见的 Web 端口,但本插件的 HTTP 路由与终端 socket 都经桌面端的
|
|
72
73
|
Host 转发(终端按 `__DSH_TRANSPORT__.streamBaseUrl` 解析地址),无需额外设置。
|
|
73
74
|
|
|
@@ -97,6 +98,7 @@ Host 转发(终端按 `__DSH_TRANSPORT__.streamBaseUrl` 解析地址),无
|
|
|
97
98
|
| 跳转 | 从搜索结果点进文件 → 跳到该行 + 垂直居中 + **落地行高亮**(约 2.6 秒后淡出);同文件反复跳都生效 |
|
|
98
99
|
| 多终端 | 标签式多终端(`+` 新建、`✕`/中键关闭带确认)、可跨主机;刷新页面按 session id 自动重连回原会话,**socket 全断开后会话保留 10 分钟**(够刷新、够切浏览器标签页接回),超时才关闭远端 shell;**socket 断开(而不是 shell 退出)时会话保留、可一键接回**(同一 session id 重连,Host 侧仍按上面 10 分钟 TTL 回收),只有真正退出才清会话 |
|
|
99
100
|
| 工作区 | 绑定列表 + 路由档位下拉 + 新建工作区双模向导(本地 / 远端);**解绑前确认**(会话与历史仍可读,新的远端调用会被拒绝) |
|
|
101
|
+
| 视图偏好 | 设置 → 远程主机页底部的两项:**新建的远程会话自动打开远程工作区**(默认关;只认远端工作区的会话,本机会话永不触发;每次页面加载对同一会话只判断一次,手动关掉的面板不会被重新打开)与**远程工作区占比**(默认 45%,20%–70%):插件打开右栏「远程工作台」页时,右侧面板按这个比例占窗口宽度;面板已打开时改占比立即生效。两项都存 Host 侧(`$DSH_HOME/dsh-remote-view.json`),同一 profile 的各窗口一致 |
|
|
100
102
|
| 端口转发 | 侧边栏「端口」页:列出远端监听端口(`ss`,没有则 `netstat`),对任一端口**一键转发到本地**、复制本地 URL、在浏览器打开;也支持手动「远端地址:端口 → 本地端口(可自动分配)」规则。**本地只监听 `127.0.0.1`**(`ssh -L` 语义,不暴露到局域网);每条转发有自己的通道预算,不占池里的 6 个执行/SFTP 通道;SSH 掉线或闲置回收后,下一条本地连接自动重拨而不影响监听;规则存浏览器(刷新后恢复),可逐条停止;关闭插件、删除主机、卸载插件都会释放本地端口。远端既没有 `ss` 也没有 `netstat`、或探测超时/中断时,明确显示「无法枚举」而不是空列表 |
|
|
101
103
|
|
|
102
104
|
### 主机与通道
|
|
@@ -107,7 +109,7 @@ Host 转发(终端按 `__DSH_TRANSPORT__.streamBaseUrl` 解析地址),无
|
|
|
107
109
|
| 密钥 bootstrap | 密码主机一键生成专用密钥对并下发 `authorized_keys`,之后走密钥 |
|
|
108
110
|
| 推送流水线 | 远端 arch/系统探测 → 版本比对 → 一致跳过 / 否则推送;executable 通道推送自编译 helper。失败后不再每次远端文件操作都重试:按 **5 秒起步、上限 5 分钟**的退避重试,设置页「推送」按钮可强制立即重试;**首次连接或协议自愈触发的自动推送成功后,右下角弹一条提示**(`alias:已自动推送远端 helper <版本>`),手动推送不弹(设置页已有状态) |
|
|
109
111
|
| 远端文件 | SFTP 浏览 / 读 / 写 / 新建 / 删除 / 改名。边界已加固:0 字节文件不再卡死,每个 SFTP 操作 60s 超时回收通道;**单个目录列表上限 20000 条**(按"目录在前、其余按名"排序后取前 20000,宿主日志说明——协议里没有"已截断"字段,界面上没有标记);**保存走侧文件 + 重命名**(优先服务端 `posix-rename`,不支持时备份-重命名-失败回滚),**写穿符号链接**(链接本身保留)并**尽力保留权限位**;SCM 状态解析会反解 git 的 C-quote 路径(凡名字含空格都会被加引号) |
|
|
110
|
-
| 远端终端 | ssh2 PTY + WebSocket,xterm
|
|
112
|
+
| 远端终端 | 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 字符的粘贴在客户端按码点分块发送,不再撑断连接 |
|
|
111
113
|
| 并发通道 | 每主机同时最多 **6 条**远端通道(不再撞远端 sshd 的 `MaxSessions`);第 7 个排队最多等 **30 秒**,超时明确报 `remote host <alias> is busy`,而不是无限堆连接 |
|
|
112
114
|
| 运行监控 | 侧栏「监控」页:**仅在面板可见且页面在前台时**按刷新设置(默认 5 秒,可改 5/10/30 秒)采样一台/全部主机的 CPU、内存、磁盘、负载、网络速率、温度与运行时长,带 60 点历史曲线、手动刷新与暂停;范围可选「当前主机 / 指定主机 / 全部主机」并跨刷新记住。**首帧 CPU% 与网络速率显示「未知」**(差分需要第二帧),Linux 之外的平台如实显示「未知」而不是 0;Host 侧按 alias 缓存 3 秒并合并并发请求,一次采样只占一条执行通道、不占端口转发预算;样本只在内存,不落盘 |
|
|
113
115
|
| 超时与进程清理 | 普通 git 命令默认 300s(设置可调);**网络动词(fetch/pull/push/sync)默认 20 分钟、上限 30 分钟**。exec 跑在独立会话里(`setsid --wait`),超时/取消都先发 TERM、**3 秒后升级 KILL**,连同子进程一起收掉;远端没有 `setsid --wait` 时探测一次即知,退回旧行为并在宿主日志里写明"超时可能没停掉远端命令";**目录/多选归档下载有 600 秒服务端预算**(远端 `timeout -k 3 600`;远端没有 GNU `timeout` 时退回无预算的旧行为),超时以真实原因失败 |
|
|
@@ -132,8 +134,9 @@ dsh_remote_vs/
|
|
|
132
134
|
├── src/
|
|
133
135
|
│ ├── index.ts # 插件入口:store/pool/worlds/路由/工具/预设切换接线
|
|
134
136
|
│ ├── protocol.ts # 前后端 wire 契约(路由表 + 纯类型,两边共用)
|
|
135
|
-
│ ├── paths.ts # $DSH_HOME
|
|
137
|
+
│ ├── paths.ts # $DSH_HOME 下寻址(存储/视图偏好/密钥/构建缓存/别名目录)
|
|
136
138
|
│ ├── store.ts # 主机 + 绑定 + 墓碑持久化(0600 JSON,原子写)
|
|
139
|
+
│ ├── view-settings.ts # 客户端视图偏好持久化(自动打开远程工作区 / 右栏占比,0600 JSON 原子写)
|
|
137
140
|
│ ├── pool.ts # ssh2 长连接池(exec/shell/sftp/putFile,TOFU 主机键)
|
|
138
141
|
│ ├── sftp.ts # 远端文件引擎(SFTP 窗口读写/目录树操作)
|
|
139
142
|
│ ├── keygen.ts # 密码机密钥 bootstrap(生成→下发→翻转)
|
|
@@ -165,6 +168,8 @@ dsh_remote_vs/
|
|
|
165
168
|
│ │ └── bridge-refs.ts # refs 独立桥(local-refs 依赖 workingDirectory,必须分离)
|
|
166
169
|
│ └── client/ # ── 浏览器半(React,打包进 lib/client.js)──
|
|
167
170
|
│ ├── index.tsx # 双面决策(better 优先/settle 加速/原生兜底)+ 设置两节 + directoryFlow 双槽接管
|
|
171
|
+
│ ├── auto-open-remote.ts # 远程会话首次出现→开本插件右栏页,并按占比拖拽右栏宽度
|
|
172
|
+
│ ├── view-settings.ts # 客户端侧视图偏好缓存(加载/保存/订阅,供设置页与自动打开共用)
|
|
168
173
|
│ ├── store.tsx # 双面共用的模块级状态(useSyncExternalStore;打开的文件/终端/视图都在这)
|
|
169
174
|
│ ├── RemoteRoot.tsx # 右侧栏挂载面:VS Code 式活动栏(资源管理器/搜索/SCM/提交图/编辑器/终端/工作区)
|
|
170
175
|
│ ├── RemoteEditorView.tsx # 会话视图挂载面(与 对话/轨迹 并列的「远程编辑器」标签,整屏宽)
|
|
@@ -210,7 +215,7 @@ dsh_remote_vs/
|
|
|
210
215
|
├── vendor/dsh-remote-helpers/ # helper 种子(随包发布,启动铺缓存,见下)
|
|
211
216
|
├── docs/ # 本地工作文档(不推送 GitHub;只有 docs/media/ 的截图随仓库公开)
|
|
212
217
|
│ ├── MAINTENANCE.md # 本地私有(.gitignore,不入库):升级影响面/检查清单/踩坑/发布流程
|
|
213
|
-
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.
|
|
218
|
+
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.25.0)
|
|
214
219
|
│ └── GATES.md # 本地私有:本地门禁清单与实跑条数
|
|
215
220
|
├── locale/ # 插件元信息双语
|
|
216
221
|
└── lib/ # 构建产物(**必须入库**,只有 .map 忽略;link 安装后重启即生效)
|
|
@@ -232,8 +237,9 @@ dsh_remote_vs/
|
|
|
232
237
|
|
|
233
238
|

|
|
234
239
|
|
|
235
|
-
两个挂载面共用一份状态(`store.tsx
|
|
236
|
-
|
|
240
|
+
两个挂载面共用一份状态(`store.tsx`):**右侧栏「远程工作台」的编辑器页**(默认面,装了 better-sidebar
|
|
241
|
+
走独立 tab,否则走原生右栏页;整栏显示,不与目录分栏)与**会话视图「远程编辑器」**(可选的全宽面,
|
|
242
|
+
与 对话/轨迹 并列)。同一时刻只挂载一个面,切换面时显式交接缓冲区与光标/滚动位置。
|
|
237
243
|
|
|
238
244
|
- **活动栏**:资源管理器 / 搜索 / 源代码管理 / 提交图 / 编辑器 / 终端 / 工作区;面板首次访问后
|
|
239
245
|
保持挂载,切回来不重新拉取、不闪。隐藏期间**不做远端工作**(目录列表、SCM 的 stash/分支/远程查询、
|
|
@@ -246,8 +252,18 @@ dsh_remote_vs/
|
|
|
246
252
|
手动刷新的结果一定晚于点击(排在后台读之后取最新结果),切走的读只写自己那份缓存、绝不上屏;后台读
|
|
247
253
|
失败保留原列表并显示原因,不会把工作区误判成"没有仓库"。刷新浏览器/重启 Host 后第一次切换仍要等
|
|
248
254
|
一次,这是有意的。
|
|
249
|
-
-
|
|
250
|
-
|
|
255
|
+
- **编辑器**:外观对齐本地侧边栏插件 —— VS Code Dark+/Light+ 的**不透明代码背景**(`#1e1e1e` / `#ffffff`)、
|
|
256
|
+
标签条(未保存圆点、中键关闭、diff/图片图标)、信息栏(路径、语言、**构建戳**、`tok N` 着色 token 数、
|
|
257
|
+
已保存状态、重载/保存/自动换行/字号 A−A+/悬浮/全宽切换)。会话区全宽面另带**可点面包屑**(同级文件下拉,
|
|
258
|
+
目录优先排序)与**状态栏**(语言、行:列、已选字符数、缩进、换行、字号、保存态、UTF-8)。
|
|
259
|
+
信息栏的构建戳与 `tok N` 是排障用的:构建戳判定"浏览器跑的是不是刚编的包",`tok 0` 判定语法包是否命中。
|
|
260
|
+
**diff 标签**的信息栏在「重新载入差异」旁多一个**切换为内容编辑**图标:一键把同一路径作为可编辑内容标签
|
|
261
|
+
打开(工作区/暂存 diff 有效;提交历史 drill-down 不显示——从历史 blob 打开"今天的文件"会被误读成编辑提交)。
|
|
262
|
+
自动换行与字号(含 `Ctrl+滚轮`)是跨面共享的本地偏好,**默认不换行**(与蓝本一致);悬浮窗内字号由浮窗
|
|
263
|
+
自身的缩放管理,所以 A−A+ 在浮窗里不显示。
|
|
264
|
+
- **图片预览**:png/jpg/jpeg/gif/webp/bmp/ico/avif 在编辑器里直接显示,点击切换「适应窗口 / 原始大小」,
|
|
265
|
+
并在下方给出大小与像素尺寸;读取被截断的图片明确提示过大而不是画一个破图。SVG 仍按文本打开(可编辑)。
|
|
266
|
+
- **关闭最后一个文件回到目录**:编辑器页没有打开的标签时自动切回资源管理器页;有未保存改动先确认。
|
|
251
267
|
- **悬浮编辑器**:文件树 / 搜索结果 / 源代码管理右键「在悬浮编辑器中打开」,或双击「远程编辑器」标签,
|
|
252
268
|
编辑器整体浮到页面最上层的窗口里(同一份标签与缓冲区,关闭/停靠后回原表面)。标题栏可拖动、八个边角
|
|
253
269
|
可缩放、可最大化/还原;**最小化成一个 44px 悬浮球**(不占整条标题栏,可拖到任意角落,单击/Enter 恢复,
|
|
@@ -256,9 +272,19 @@ dsh_remote_vs/
|
|
|
256
272
|
- **查找与跳转**:`Ctrl+F` 查找框固定右上角(`position: fixed` 锚定编辑器矩形,任何祖先滚动都不带走);
|
|
257
273
|
选中文本按 `Ctrl+F` 直接填入;从搜索结果跳转会**居中 + 落地行高亮**。
|
|
258
274
|
- **终端**:标签式多终端,session id 逐个持久化,刷新页面自动重连回原会话;**重连只接管、不改尺寸**
|
|
259
|
-
(活着的 shell 不会被缩成 80×24——真实尺寸由能测到自己的那个标签发 `resize`
|
|
275
|
+
(活着的 shell 不会被缩成 80×24——真实尺寸由能测到自己的那个标签发 `resize` 帧;行列没变不发帧);
|
|
276
|
+
选中高亮**明暗主题都可读**(亮 `#add6ff` / 暗 `#264f78`,失焦有更淡的变体),`Shift+Insert` /
|
|
277
|
+
`Ctrl+Shift+V` 只插入一次;一个短窗口内的输出合并成一帧(忙命令的帧数与 JSON 解析次数大幅下降,退出前必刷);
|
|
278
|
+
echo 不等合并窗口(空闲后的第一段输出立即发),客户端输出也不等 xterm 的渲染回调;
|
|
279
|
+
**Ctrl+点击路径**可在目录树里定位到对应目录;标题旁的**常用指令**面板支持新增/编辑/删除/拖拽排序,
|
|
280
|
+
点条目只粘贴不发送,`Ctrl+B` 快速新增;
|
|
281
|
+
socket 全断开后
|
|
260
282
|
会话保留 **10 分钟**,超时才关闭远端 shell(以前是永不回收,关掉浏览器后远端 shell 一直占着 sshd 会话槽)。
|
|
261
283
|
- **已知边界(诚实说明)**:
|
|
284
|
+
- **终端的偶发卡顿有三个已知来源**:① ~~同一条 SSH 连接被 SFTP/git/helper 大流量占满~~ —— 已改为**PTY 独占一条 SSH 连接**(每主机一条;被拒绝时回落到共享连接),SFTP/git 的大流量不再排在终端前面;② 正在刷屏时,输入的回显必须排在已产生的输出
|
|
285
|
+
之后(所有终端都如此,`Ctrl+C` 仍有效——输入路径不受输出背压影响);③ 宿主事件循环被 agent 的
|
|
286
|
+
重活占住时,终端的收发会一起变慢。本轮已把可控部分修掉:客户端不再等渲染回调、宿主 echo 不等
|
|
287
|
+
合并窗口、背压水位降到 2 MiB/512 KiB、socket 断开释放未结算字节。**宿主侧改动需重启 `dsh web`**。
|
|
262
288
|
- 切到「远程编辑器」标签**没有公开 API**,插件只能按标签文字点击外壳自己的 tab,失败时给 toast
|
|
263
289
|
提示手动切(`revealEditor()`);
|
|
264
290
|
- 未跟踪目录在状态里是**一行**(`dir/`),点它**展开**该目录里的文件(只发一条限定路径的
|