@zhangfengshun/dsh-remote-ssh 2.3.5 → 2.3.6

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/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  本文件的版本号与 `package.json` 的 `version` 保持一致。每个版本对应一个 Cordis Package 快照(`pkg-N`)。
4
4
 
5
+ ## [2.3.6] — settings 注册迁移至字符串命名空间,移除 legacy 导出依赖
6
+ ### 变更
7
+ - **不再从 `@deepseek-ai/dsh-settings` 导入 `settingsNamespace`**:该导出在 dsh-settings 中被标注为 legacy(仅为 alpha.2 之前的插件保留,未来版本可能移除)。`parseSettingsNamespace` 实为恒等函数(校验 `/^[a-z][a-z0-9-]*$/` 后原样返回),故 `register(NS, schema)` 与原 `register(settingsNamespace(NS), schema)` 存储键完全一致——零数据迁移,老用户配置无缝保留。
8
+ - **peerDependencies 移除 `@deepseek-ai/dsh-settings`**(已无导入;`ctx.settings` 能力由 DSH 内核的 settings 服务提供,与该 npm 包导入无关),安装时少一条未解析 peer 警告。
9
+
5
10
  ## [2.3.5] — 地球角标样式重制:右下角、默认文件夹形状、透明底白经纬线
6
11
  ### 变更
7
12
  - **文件夹形状与默认完全一致**:不再自绘/改写文件夹几何,壳层 IconFolderOpen16/Close16 的原始路径与几何零改写,仅向工作区行首槽位 svg **追加**一个透明地球经纬线组(appendChild 不触碰 React 管理的子节点,零对账风险)。
package/README.md CHANGED
@@ -13,14 +13,31 @@
13
13
  | 💻 远程终端 | 内置「终端」页签自动检测远程工作区,SSH 交互式终端 |
14
14
  | 🌐 远程工作区 | 选择远程目录创建原生工作区,一键进入远程环境 |
15
15
  | 🤖 模型工具 | 12 个 `remote_ssh_*` 工具,会话感知免填连接参数 |
16
+ | ⚡ 打开提速 | 单往返合并读 + raw 文本快路径 + 结果缓存(LRU + 5s TTL):首开 ≈**1.31×**,TTL 内重复打开 **0 往返**,过期复验 **≈5×**(真实超算实测);`remote_ssh_exec` 连接复用 **≈15×** |
17
+
18
+ ## 截图
19
+
20
+ **设置 → 🖥️ 远程连接**:连接配置(密钥 / 密码 / ProxyJump 跳板机)· 连接测试 · 从 `~/.ssh/config` 一键导入
21
+
22
+ <p align="center"><img src="assets/settings-remote-connections.png" width="420" alt="设置:远程连接"></p>
23
+
24
+ **内置「文件」页签**:直接浏览远程主机文件(右侧文件树即远程目录,编辑保存直写远程)
25
+
26
+ <p align="center"><img src="assets/remote-files-tab.webp" width="820" alt="内置文件页签直接浏览远程文件"></p>
27
+
28
+ **内置「终端」页签**:自动 SSH 到远程超算(图为 SLURM 作业调度环境);左侧会话即模型免填调用 `remote_ssh_*` 工具
29
+
30
+ <p align="center"><img src="assets/remote-terminal.webp" width="820" alt="内置终端页签自动 SSH 远程超算"></p>
16
31
 
17
32
  ## 安装
18
33
 
19
34
  ```bash
20
- dsh plugin --profile <name> add @zhangfengshun/dsh-remote-ssh@2.3.0
35
+ dsh plugin --profile <name> add @zhangfengshun/dsh-remote-ssh@2.3.5
21
36
  ```
22
37
 
23
38
  > 安装后需**重启 DSH**。`@zhangfengshun/dsh-remote-ssh` 必须在 bundles 列表中排在 `dsh-better-sidebar` **之后**。
39
+ >
40
+ > 内置「文件」页签的 SSH 直读依赖 **dsh-better-sidebar ≥ 0.15** 的文件 API(`/sidebar/api/fs.*` 端点),请勿使用更早版本;当前已逐点验证至 **dsh-better-sidebar 0.18.0**。
24
41
 
25
42
  ## 使用
26
43
 
@@ -46,17 +63,19 @@ dsh plugin --profile <name> add @zhangfengshun/dsh-remote-ssh@2.3.0
46
63
  | `remote_ssh_sync` | 远端同步到本地镜像 |
47
64
  | `remote_ssh_push` | 本地镜像推送回远端 |
48
65
 
49
- 远程工作区会话中调用工具可免填 `profileId` 等连接参数。
66
+ 远程工作区会话中调用工具可免填 `profileId` 等连接参数;全部文件/命令类工具走持久 SSH 会话池 + 结果缓存,`remote_ssh_exec` 单命令实测 ≈15× 提速。
50
67
 
51
68
  ## 原理
52
69
 
53
70
  插件注册 4 个 exact 路由(`/sidebar/api/fs.tree`、`fs.read`、`fs.write`、`fs.search`),在 better-sidebar 的 prefix 路由之前拦截。会话 cwd 含 `.remote-ssh.json` 时走 SSH,否则走本地 fs。客户端看到的是本地镜像路径,Host 自动转换为远程路径——对客户端完全透明。
54
71
 
72
+ 远程读取采用**单往返合并读**:一条池化命令同时返回 `size/mtime` 帧与文件内容(文本类扩展名优先 raw 直传,字节长 + U+FFFD 双校验失败自动回退 base64,结果逐字节一致);配合主机侧结果缓存与变更失效(见下节)。
73
+
55
74
  Shell wrapper(`~/.dsh/remote-ssh/dsh-remote-shell[.cmd]`)检测工作区 `.remote-ssh.json`,自动 `ssh -tt` 连接远程,使内置「终端」页签透明接入。
56
75
 
57
76
  ## 缓存与一致性
58
77
 
59
- 远程读取与目录列举结果在主机侧缓存(LRU 32/64 条,TTL 5 秒):TTL 内重复打开或切回页签 0 网络往返;过期后先做一次轻量 mtime+size 复验,未变化则免重传。写、删除、移动、建目录、上传、推送(push)、远端 exec git 面板操作会自动失效相关缓存。
78
+ 远程读取与目录列举结果在主机侧缓存(读 LRU 32 条 + 列举 LRU 64 条,TTL 5 秒;单条 >1MiB 不缓存、总量 32MB 字节预算,防止大文件驻留拖慢宿主):TTL 内重复打开或切回页签 **0 网络往返**;过期后先做一次轻量 mtime+size 复验,未变化则免重传。写、删除、移动、建目录、上传、推送(push)、成功的远端 exec 与变更类 git 子命令(add/reset/commit/checkout/revert/cherry-pick)会自动失效相关缓存,并以每 profile 缓存代(epoch)兜底「同秒同 size 写」等粒度盲区。
60
79
 
61
80
  已知限制:
62
81
 
package/README_EN.md CHANGED
@@ -13,14 +13,31 @@ A **DSH** plugin like **VSCode Remote-SSH**: connect to remote HPC / servers via
13
13
  | 💻 Remote Terminal | Built-in **Terminal** tab auto-detects remote workspaces, opens SSH interactive shell |
14
14
  | 🌐 Remote Workspace | Select a remote directory to create a native workspace, one-click enter |
15
15
  | 🤖 Model Tools | 12 `remote_ssh_*` tools, session-aware with auto-filled connection params |
16
+ | ⚡ Faster Opens | Single-roundtrip merged reads + raw text fast path + result cache (LRU + 5s TTL): first open ≈**1.31×**, repeat opens within TTL **0 round-trips**, expired revalidation **≈5×** (measured on a real HPC); `remote_ssh_exec` connection reuse **≈15×** |
17
+
18
+ ## Screenshots
19
+
20
+ **Settings → 🖥️ Remote SSH**: connection profiles (key / password / ProxyJump bastion) · connection test · one-click import from `~/.ssh/config`
21
+
22
+ <p align="center"><img src="assets/settings-remote-connections.png" width="420" alt="Settings: Remote Connections"></p>
23
+
24
+ **Built-in Files tab**: browse the remote host directly (the right-hand tree IS the remote directory, edits save back to remote)
25
+
26
+ <p align="center"><img src="assets/remote-files-tab.webp" width="820" alt="Built-in Files tab browsing remote files"></p>
27
+
28
+ **Built-in Terminal tab**: auto-SSH to the HPC (SLURM environment shown); the left panel shows the model calling `remote_ssh_*` tools without connection params
29
+
30
+ <p align="center"><img src="assets/remote-terminal.webp" width="820" alt="Built-in Terminal tab auto-SSH to remote HPC"></p>
16
31
 
17
32
  ## Installation
18
33
 
19
34
  ```bash
20
- dsh plugin --profile <name> add @zhangfengshun/dsh-remote-ssh@2.3.0
35
+ dsh plugin --profile <name> add @zhangfengshun/dsh-remote-ssh@2.3.5
21
36
  ```
22
37
 
23
38
  > **Restart DSH** after installation. `@zhangfengshun/dsh-remote-ssh` must come **after** `dsh-better-sidebar` in the bundles list.
39
+ >
40
+ > The built-in **Files** tab SSH interception relies on the file API of **dsh-better-sidebar ≥ 0.15** (`/sidebar/api/fs.*` endpoints) — do not use older versions; verified point-by-point against **dsh-better-sidebar 0.18.0**.
24
41
 
25
42
  ## Usage
26
43
 
@@ -46,17 +63,19 @@ dsh plugin --profile <name> add @zhangfengshun/dsh-remote-ssh@2.3.0
46
63
  | `remote_ssh_sync` | Sync remote to local mirror |
47
64
  | `remote_ssh_push` | Push local mirror back to remote |
48
65
 
49
- In a remote-workspace session, `profileId` and other connection params can be omitted.
66
+ In a remote-workspace session, `profileId` and other connection params can be omitted. All file/command tools run over the persistent SSH session pool + result cache; `remote_ssh_exec` measures ≈15× faster per command.
50
67
 
51
68
  ## How It Works
52
69
 
53
70
  The plugin registers 4 exact routes (`/sidebar/api/fs.tree`, `fs.read`, `fs.write`, `fs.search`) that intercept better-sidebar's prefix route. When the session cwd contains `.remote-ssh.json`, requests go through SSH; otherwise local fs. The client sees local mirror paths — the Host transparently translates them to remote paths.
54
71
 
72
+ Remote reads use a **single-roundtrip merged read**: one pooled command returns the `size/mtime` frame plus the file content (text extensions prefer raw transfer with byte-length + U+FFFD validation and automatic base64 fallback — results are byte-identical), combined with host-side result caching and change invalidation (see below).
73
+
55
74
  A shell wrapper (`~/.dsh/remote-ssh/dsh-remote-shell[.cmd]`) detects the workspace's `.remote-ssh.json` and auto-launches `ssh -tt`, making the built-in **Terminal** tab transparently connect to remote.
56
75
 
57
76
  ## Caching & Consistency
58
77
 
59
- Remote reads and directory listings are cached host-side (LRU 32/64 entries, TTL 5s): re-opening or switching back to a tab within the TTL costs 0 network round-trips; after expiry a lightweight mtime+size revalidation runs first, and unchanged files are served without re-transfer. Write, delete, move, mkdir, upload, push (syncUp), remote exec and git-panel operations automatically invalidate the affected cache entries.
78
+ Remote reads and directory listings are cached host-side (read LRU 32 + listing LRU 64 entries, TTL 5s; entries >1MiB are not cached, total budget 32MB so large files never weigh down the host): re-opening or switching back to a tab within the TTL costs **0 network round-trips**; after expiry a lightweight mtime+size revalidation runs first, and unchanged files are served without re-transfer. Writes, deletes, moves, mkdir, uploads, push (syncUp), successful remote exec and mutating git subcommands automatically invalidate the affected cache entries, with a per-profile cache epoch guarding same-second same-size writes and path-space mismatches.
60
79
 
61
80
  Known limitations:
62
81
 
package/lib/index.js CHANGED
@@ -10,7 +10,6 @@
10
10
  */
11
11
  import z from "schemastery";
12
12
  import { defineTool } from "@deepseek-ai/dsh-tools";
13
- import { settingsNamespace } from "@deepseek-ai/dsh-settings";
14
13
  import { mkdir, rm, writeFile, readFile, opendir, stat, open, rename, readdir } from "node:fs/promises";
15
14
  import { existsSync, readFileSync } from "node:fs";
16
15
  import { homedir } from "node:os";
@@ -1110,7 +1109,10 @@ function apply(ctx, config) {
1110
1109
  updateWorkspaces: async () => {}
1111
1110
  };
1112
1111
  ctx.inject(["settings"], (sctx) => {
1113
- const scope = sctx.settings.register(settingsNamespace(NS), PrefsSchema);
1112
+ // settings 命名空间直接传插件 id(匹配 /^[a-z][a-z0-9-]*$/)。不再依赖
1113
+ // @deepseek-ai/dsh-settings 的 legacy `settingsNamespace` 构造器(该导出仅为
1114
+ // alpha.2 之前的插件保留,未来可能移除);恒等语义下两种写法存储键完全一致。
1115
+ const scope = sctx.settings.register(NS, PrefsSchema);
1114
1116
  settingsFace = {
1115
1117
  read: () => {
1116
1118
  const v = scope.get();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhangfengshun/dsh-remote-ssh",
3
- "version": "2.3.5",
3
+ "version": "2.3.6",
4
4
  "description": "DSH web plugin: VSCode Remote-SSH-like remote development (SSH to supercomputers/servers, remote workspace, file explorer, integrated terminal), integrated with dsh-better-sidebar and DSH settings.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -59,7 +59,6 @@
59
59
  "@deepseek-ai/cordis": "^4.0.1",
60
60
  "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6",
61
61
  "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6",
62
- "@deepseek-ai/dsh-settings": "^0.1.0-rc.6",
63
62
  "@deepseek-ai/dsh-tools": "^0.1.0-rc.6"
64
63
  },
65
64
  "files": [