dsh-remote-vs 0.16.0 → 0.18.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 +12 -8
- package/README.md +11 -7
- package/cordis.patch.yml +5 -0
- package/lib/client.js +914 -8
- package/lib/index.js +692 -5
- package/lib/p2-router-fs.js +28 -0
- package/lib/types/client/PortsView.d.ts +30 -0
- package/lib/types/client/api.d.ts +29 -1
- package/lib/types/client/store.d.ts +1 -1
- package/lib/types/forward.d.ts +114 -0
- package/lib/types/listen-ports.d.ts +56 -0
- package/lib/types/p2/router-fs.d.ts +17 -1
- package/lib/types/pool.d.ts +18 -0
- package/lib/types/protocol.d.ts +72 -0
- package/lib/types/routes.d.ts +7 -0
- package/package.json +37 -37
- package/src/client/PortsView.tsx +850 -0
- package/src/client/RemoteRoot.tsx +7 -1
- package/src/client/api.ts +38 -0
- package/src/client/i18n.ts +54 -0
- package/src/client/store.tsx +2 -2
- package/src/client/vsc/vsc.css +183 -0
- package/src/forward.ts +445 -0
- package/src/index.ts +40 -1
- package/src/listen-ports.ts +241 -0
- package/src/p2/router-fs.ts +58 -0
- package/src/pool.ts +63 -0
- package/src/protocol.ts +76 -0
- package/src/routes.ts +125 -0
package/README.en.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
SSH host management inside the DSH Host process + helper push pipeline + a **VS Code-style remote
|
|
8
8
|
workbench** (explorer / search / source control / commit graph with its commit-details pane / multi-tab editor / floating editor /
|
|
9
|
-
side-by-side diff / multiple terminals). Hosts live in DSH Settings ("Remote hosts"); with `dsh-better-sidebar` installed
|
|
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" tab, otherwise it falls back to a native right-Sidebar "Remote"
|
|
11
11
|
page (same content, self-opened from the guide, per-session instances). The editor is ALSO mounted into
|
|
12
12
|
the conversation view slot as a "远程编辑器" (remote editor) tab next to "对话 / 轨迹", so the code area is
|
|
@@ -37,9 +37,9 @@ dsh plugin --profile web add dsh-remote-vs
|
|
|
37
37
|
(From npm, recommended; installing straight from the repository also works:
|
|
38
38
|
`dsh plugin --profile web add github:xiray-xia/dsh-remote-vs`.)
|
|
39
39
|
|
|
40
|
-
Requires DSH `0.2.2-alpha.
|
|
41
|
-
baseline is `0.2.2-alpha.
|
|
42
|
-
|
|
40
|
+
**Requires DSH `0.2.2-alpha.3` or newer and below `0.3.0`** (`engines.dsh` enforces the range;
|
|
41
|
+
**the tested baseline is `0.2.2-alpha.3`**). On Host `0.2.2-alpha.2` use plugin `0.17.0` (or
|
|
42
|
+
upgrade DSH first); the `0.2.1-rc.2` generation needs `0.9.3`. `--profile web` selects which profile to install into —
|
|
43
43
|
this is a Web plugin, so it has to go into the profile your Web GUI runs from (`web` is
|
|
44
44
|
the common name; use your own profile's name). Desktop uses the reserved `desktop`
|
|
45
45
|
profile instead — see [Desktop](#desktop-dsh-desktop) below.
|
|
@@ -74,7 +74,7 @@ Install either way:
|
|
|
74
74
|
`desktop` is reserved for the Electron application: an **npm-installed `dsh` cannot manage
|
|
75
75
|
it** (it answers `profile "desktop" is managed exclusively by the Electron application`),
|
|
76
76
|
so one of the two routes above is required. The Desktop release version equals the DSH
|
|
77
|
-
runtime it bundles, and it must satisfy `engines.dsh` (`>=0.2.2-alpha.
|
|
77
|
+
runtime it bundles, and it must satisfy `engines.dsh` (`>=0.2.2-alpha.3`; check About);
|
|
78
78
|
older releases make the Plugins page refuse the install. Desktop opens no visible Web
|
|
79
79
|
port, but the plugin's HTTP routes and terminal socket are forwarded through Desktop's
|
|
80
80
|
Host (the terminal resolves its address from `__DSH_TRANSPORT__.streamBaseUrl`), so no
|
|
@@ -108,6 +108,7 @@ extra configuration is needed.
|
|
|
108
108
|
| 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 |
|
|
109
109
|
| 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 |
|
|
110
110
|
| 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) |
|
|
111
|
+
| 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 |
|
|
111
112
|
|
|
112
113
|
### Hosts and transport
|
|
113
114
|
|
|
@@ -149,6 +150,8 @@ dsh_remote_vs/
|
|
|
149
150
|
│ ├── importers.ts # ssh_config / dsh-ssh.json parsing importers
|
|
150
151
|
│ ├── routes.ts # /api/dsh-remote/* route table + terminal WebSocket upgrade
|
|
151
152
|
│ ├── terminal.ts # PTY session registry (reconnect-on-refresh/disconnect cleanup)
|
|
153
|
+
│ ├── forward.ts # local port-forward manager (direct-tcpip channels / one listener per rule / budgets)
|
|
154
|
+
│ ├── listen-ports.ts # remote listening-port probe (ss/netstat command + pure parser)
|
|
152
155
|
│ ├── tools.ts # the 5 Agent tool definitions
|
|
153
156
|
│ ├── http.ts / loopback.ts # JSON body IO + loopback trust fence
|
|
154
157
|
│ ├── git-format.ts # git command builders + pure frontend parsing (zero Host additions)
|
|
@@ -204,7 +207,7 @@ dsh_remote_vs/
|
|
|
204
207
|
│ ├── composer.ts / use-remote-chat-target.ts / selection-popup.ts # remote @refs/selection-to-chat
|
|
205
208
|
│ ├── ai-review.ts # AI review prompt builder (single diff / whole commit, byte tiers, pure)
|
|
206
209
|
│ ├── api.ts # typed fetch wrapper over /api/dsh-remote
|
|
207
|
-
│ ├── HostsView / WorkspacesView / WorkspaceWizard / TerminalView / XTerm / Dialog
|
|
210
|
+
│ ├── HostsView / WorkspacesView / WorkspaceWizard / TerminalView / XTerm / PortsView / Dialog
|
|
208
211
|
│ ├── SettingsHosts.tsx # settings occupants (host mgmt/binding list, self-fetching)
|
|
209
212
|
│ ├── DirectoryFlow.tsx # native entry occupant (local dual-mode/remote wizard)
|
|
210
213
|
│ ├── RemoteDirectoryPicker.tsx# remote directory browser dialog
|
|
@@ -212,7 +215,7 @@ dsh_remote_vs/
|
|
|
212
215
|
├── vendor/dsh-remote-helpers/ # helper seeds (shipped, seeded into cache at startup, see below)
|
|
213
216
|
├── docs/ # local-only working docs (only docs/media/ screenshots ship)
|
|
214
217
|
│ ├── MAINTENANCE.md # local-only (.gitignore), not shipped: upgrade impact, checklist, pitfalls, release
|
|
215
|
-
│ ├── VERSION-HISTORY.md # local-only: per-release change log (0.7.1 → 0.
|
|
218
|
+
│ ├── VERSION-HISTORY.md # local-only: per-release change log (0.7.1 → 0.18.0)
|
|
216
219
|
│ └── GATES.md # local-only: local gate inventory and measured assertion counts
|
|
217
220
|
├── locale/ # bilingual plugin metadata
|
|
218
221
|
└── lib/ # build output (**must be committed**; only .map is ignored; restart after link install)
|
|
@@ -366,7 +369,7 @@ over helper RPC (fs) / ssh2 (processes), local stays untouched; both share one H
|
|
|
366
369
|
Upstream never published helper binaries (all Release assets are empty), so this plugin builds its own:
|
|
367
370
|
|
|
368
371
|
- Build machine: WSL2 Ubuntu-22.04 (glibc 2.35, matching the remote targets), Node v24.21.0 + pnpm 11.28.5
|
|
369
|
-
- Sources: the `dsh-v0.2.1-alpha.2` tag (the **build baseline**: what must match is the wire protocol version, not the Host version — our protocol is still **2**, so a Host upgrade to `0.2.2-alpha.
|
|
372
|
+
- Sources: the `dsh-v0.2.1-alpha.2` tag (the **build baseline**: what must match is the wire protocol version, not the Host version — our protocol is still **2**, so a Host upgrade to `0.2.2-alpha.3` needs no rebuild either: the plugin intentionally stays on `dsh-ssh@0.2.1-rc.2`, and the new generation's protocol 3 is deliberately not followed — see §2.26 of the maintenance notes)
|
|
370
373
|
- Command: stock script `pnpm exec tsx scripts/build-exe-for-ssh-helper.ts --target=node24-linux-x64`
|
|
371
374
|
- Only deviation: no docker for the manylinux 2.28 rebuild, so a `DSH_GLIBC_CEILING`
|
|
372
375
|
env override was added (default stays 2.28); this build targets 2.35 (see `glibc-ceiling.patch` in the cache dir)
|
|
@@ -382,6 +385,7 @@ Upstream never published helper binaries (all Release assets are empty), so this
|
|
|
382
385
|
- Pushed artifacts are sha256-verified both ways (tarball in, binary out); the helper install dir is separate from workspaces; the sidecar's `version`, platform and tarball path are whitelist-validated (no unvalidated string is interpolated into a remote shell line), and a failed install keeps the previous version.
|
|
383
386
|
- Host config writes are fsync'd and re-checked against a stamp (a concurrent Desktop/Web edit inside the read-modify-write window is replayed instead of silently overwritten).
|
|
384
387
|
- Remote sessions may read explicit local absolute paths (the tool spill-file contract requires it); acceptable under the same model trust — a known trade-off recorded in the local maintenance notes.
|
|
388
|
+
- **Port forwards bind `127.0.0.1` only**: another local process can reach one, which is exactly the `ssh -L` trust boundary (the local user account). The target is dialed **from the remote host**, so it can reach that host's private network; "open in browser" always builds an `http://` URL — a forwarded HTTPS service needs the scheme edited by hand.
|
|
385
389
|
|
|
386
390
|
## Development
|
|
387
391
|
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
中文 | [English](./README.en.md)
|
|
6
6
|
|
|
7
7
|
Host 进程内的 SSH 主机管理 + helper 推送流水线 + **VS Code 式远端工作台**
|
|
8
|
-
(资源管理器 / 搜索 / 源代码管理 / 提交图与提交详情面板 / 多标签编辑器 / 悬浮编辑器 / 并排 Diff /
|
|
8
|
+
(资源管理器 / 搜索 / 源代码管理 / 提交图与提交详情面板 / 多标签编辑器 / 悬浮编辑器 / 并排 Diff / 多终端 / 端口转发)。
|
|
9
9
|
主机配在 DSH 设置里(“远程主机”项);装了 `dsh-better-sidebar` 时另有
|
|
10
10
|
独立“远程”tab,没装则退到原生右侧栏“远程”页(同内容,引导页自助开,per-session 实例)。
|
|
11
11
|
编辑器还额外挂到会话视图槽,与“对话 / 轨迹”并列成一个**远程编辑器**标签,
|
|
@@ -34,8 +34,8 @@ dsh plugin --profile web add dsh-remote-vs
|
|
|
34
34
|
|
|
35
35
|
(从 npm 装,推荐;也可以直接跟仓库装:`dsh plugin --profile web add github:xiray-xia/dsh-remote-vs`。)
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
**需要 DSH `0.2.2-alpha.3` 及以上、`0.3.0` 以下**(`engines.dsh` 门到底;当前实测基线 `0.2.2-alpha.3`)。
|
|
38
|
+
Host 仍是 `0.2.2-alpha.2` 的请用插件 `0.17.0`(或先把 DSH 升到 `0.2.2-alpha.3`);`0.2.1-rc.2` 一代请用 `0.9.3`。
|
|
39
39
|
`--profile web` 指明装进哪个 profile —— 本插件是 Web 插件,
|
|
40
40
|
要装进 Web GUI 所用的那个(`web` 是常见命名,以你自己的 profile 名为准);
|
|
41
41
|
桌面端用的是保留 profile `desktop`,见下面「桌面端」。
|
|
@@ -63,7 +63,7 @@ dsh plugin --profile web add dsh-remote-vs
|
|
|
63
63
|
注意:`desktop` 是桌面端独占的保留 profile,**npm 全局安装的 `dsh` 不能管理它**
|
|
64
64
|
(会报 `profile "desktop" is managed exclusively by the Electron application`),
|
|
65
65
|
只能走上面两条路径。桌面端的版本号等于它捆绑的 DSH 运行时版本,同样要满足
|
|
66
|
-
`engines.dsh` 要求(`>=0.2.2-alpha.
|
|
66
|
+
`engines.dsh` 要求(`>=0.2.2-alpha.3`,关于面板可看);低于该版本时插件页会直接拒绝
|
|
67
67
|
安装。桌面端没有可见的 Web 端口,但本插件的 HTTP 路由与终端 socket 都经桌面端的
|
|
68
68
|
Host 转发(终端按 `__DSH_TRANSPORT__.streamBaseUrl` 解析地址),无需额外设置。
|
|
69
69
|
|
|
@@ -93,6 +93,7 @@ Host 转发(终端按 `__DSH_TRANSPORT__.streamBaseUrl` 解析地址),无
|
|
|
93
93
|
| 跳转 | 从搜索结果点进文件 → 跳到该行 + 垂直居中 + **落地行高亮**(约 2.6 秒后淡出);同文件反复跳都生效 |
|
|
94
94
|
| 多终端 | 标签式多终端(`+` 新建、`✕`/中键关闭带确认)、可跨主机;刷新页面按 session id 自动重连回原会话,**socket 全断开后会话保留 10 分钟**(够刷新、够切浏览器标签页接回),超时才关闭远端 shell;**socket 断开(而不是 shell 退出)时会话保留、可一键接回**(同一 session id 重连,Host 侧仍按上面 10 分钟 TTL 回收),只有真正退出才清会话 |
|
|
95
95
|
| 工作区 | 绑定列表 + 路由档位下拉 + 新建工作区双模向导(本地 / 远端);**解绑前确认**(会话与历史仍可读,新的远端调用会被拒绝) |
|
|
96
|
+
| 端口转发 | 侧边栏「端口」页:列出远端监听端口(`ss`,没有则 `netstat`),对任一端口**一键转发到本地**、复制本地 URL、在浏览器打开;也支持手动「远端地址:端口 → 本地端口(可自动分配)」规则。**本地只监听 `127.0.0.1`**(`ssh -L` 语义,不暴露到局域网);每条转发有自己的通道预算,不占池里的 6 个执行/SFTP 通道;SSH 掉线或闲置回收后,下一条本地连接自动重拨而不影响监听;规则存浏览器(刷新后恢复),可逐条停止;关闭插件、删除主机、卸载插件都会释放本地端口。远端既没有 `ss` 也没有 `netstat`、或探测超时/中断时,明确显示「无法枚举」而不是空列表 |
|
|
96
97
|
|
|
97
98
|
### 主机与通道
|
|
98
99
|
|
|
@@ -134,6 +135,8 @@ dsh_remote_vs/
|
|
|
134
135
|
│ ├── importers.ts # ssh_config / dsh-ssh.json 解析导入
|
|
135
136
|
│ ├── routes.ts # /api/dsh-remote/* 路由表 + 终端 WebSocket 升级
|
|
136
137
|
│ ├── terminal.ts # PTY 会话注册表(刷新重连/断开清理)
|
|
138
|
+
│ ├── forward.ts # 本地端口转发管理器(direct-tcpip 通道/每规则监听器/连接预算)
|
|
139
|
+
│ ├── listen-ports.ts # 远端监听端口探测(ss/netstat 命令 + 纯解析器)
|
|
137
140
|
│ ├── tools.ts # 5 个 Agent 工具定义
|
|
138
141
|
│ ├── http.ts / loopback.ts # JSON 体读写 + 回环信任围栏
|
|
139
142
|
│ ├── git-format.ts # git 命令构造 + 纯前端解析(Host 零增量)
|
|
@@ -189,7 +192,7 @@ dsh_remote_vs/
|
|
|
189
192
|
│ ├── composer.ts / use-remote-chat-target.ts / selection-popup.ts # 远端 @引用/选中加对话
|
|
190
193
|
│ ├── ai-review.ts # AI 审查 prompt 构造(单文件 diff / 整提交,按字节分级,纯函数)
|
|
191
194
|
│ ├── api.ts # /api/dsh-remote 类型化 fetch 封装
|
|
192
|
-
│ ├── HostsView / WorkspacesView / WorkspaceWizard / TerminalView / XTerm / Dialog
|
|
195
|
+
│ ├── HostsView / WorkspacesView / WorkspaceWizard / TerminalView / XTerm / PortsView / Dialog
|
|
193
196
|
│ ├── SettingsHosts.tsx # 设置两节 occupant(主机管理/绑定列表,自取数)
|
|
194
197
|
│ ├── DirectoryFlow.tsx # 原生入口 occupant(本地双模/远端向导)
|
|
195
198
|
│ ├── RemoteDirectoryPicker.tsx# 远端目录浏览弹窗
|
|
@@ -197,7 +200,7 @@ dsh_remote_vs/
|
|
|
197
200
|
├── vendor/dsh-remote-helpers/ # helper 种子(随包发布,启动铺缓存,见下)
|
|
198
201
|
├── docs/ # 本地工作文档(不推送 GitHub;只有 docs/media/ 的截图随仓库公开)
|
|
199
202
|
│ ├── MAINTENANCE.md # 本地私有(.gitignore,不入库):升级影响面/检查清单/踩坑/发布流程
|
|
200
|
-
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.
|
|
203
|
+
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.18.0)
|
|
201
204
|
│ └── GATES.md # 本地私有:本地门禁清单与实跑条数
|
|
202
205
|
├── locale/ # 插件元信息双语
|
|
203
206
|
└── lib/ # 构建产物(**必须入库**,只有 .map 忽略;link 安装后重启即生效)
|
|
@@ -326,7 +329,7 @@ helper RPC(fs)/ ssh2(进程),本地一切不变;两者同 Host、共
|
|
|
326
329
|
|
|
327
330
|
- 构建机:WSL2 Ubuntu-22.04(glibc 2.35,与目标远端一致),Node v24.21.0 + pnpm 11.28.5
|
|
328
331
|
- 源码:`dsh-v0.2.1-alpha.2` tag(**构建基线**:对齐的是 wire 协议号,不是 Host 版本号 —— 我们用到的
|
|
329
|
-
协议号仍是 **2**,Host 升到 `0.2.2-alpha.
|
|
332
|
+
协议号仍是 **2**,Host 升到 `0.2.2-alpha.3` 也不需要重编:插件自行停在 `dsh-ssh@0.2.1-rc.2`,
|
|
330
333
|
新 Host 那一代 `dsh-ssh` 的协议 3 我们故意不跟,差异见维护文档 §2.26)
|
|
331
334
|
- 命令:官方原脚本 `pnpm exec tsx scripts/build-exe-for-ssh-helper.ts --target=node24-linux-x64`
|
|
332
335
|
- 唯一偏离:无 docker 跑不了 manylinux 2.28 重编,加了 `DSH_GLIBC_CEILING`
|
|
@@ -343,6 +346,7 @@ helper RPC(fs)/ ssh2(进程),本地一切不变;两者同 Host、共
|
|
|
343
346
|
- 推送物逐包验 sha256(tarball 进、binary 出,双重校验);helper 安装目录与工作区分开;sidecar 的 `version`、平台与 tarball 路径都走白名单校验(不内插未校验字符串到远端 shell 行),安装失败会保留上一版。
|
|
344
347
|
- 主机配置写入走 fsync + 变更戳复核(读-改-写窗口内被别的进程改过会重放,而不是静默覆盖)。
|
|
345
348
|
- 远端会话可读显式本机绝对路径(工具 spill 文件契约要求);同模型信任下可接受,属已知取舍,本地维护文档有记录。
|
|
349
|
+
- **端口转发只绑 `127.0.0.1`**:本机其他进程能连它是 `ssh -L` 的既定语义(信任边界是本机用户账户)。目标地址由**远端主机**拨号,因此可访问远端内网;「在浏览器中打开」固定按 `http://` 生成,转发 HTTPS 服务需手工改成 `https://`。
|
|
346
350
|
|
|
347
351
|
## 开发
|
|
348
352
|
|
package/cordis.patch.yml
CHANGED
|
@@ -111,6 +111,11 @@
|
|
|
111
111
|
name: '@deepseek-ai/dsh-tool-bash'
|
|
112
112
|
- id: tool-fs
|
|
113
113
|
name: '@deepseek-ai/dsh-tool-fs'
|
|
114
|
+
config:
|
|
115
|
+
# alpha.3 stock pins this explicitly; false is the alpha.3 default.
|
|
116
|
+
# Kept explicit so the remote mirror cannot silently grow apply_patch
|
|
117
|
+
# (its remote half is protocol-2 and has no patch/delete/move yet).
|
|
118
|
+
applyPatch: false
|
|
114
119
|
- id: tool-fs-search
|
|
115
120
|
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
116
121
|
config:
|