dsh-remote-vs 0.18.0 → 0.19.1
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 -2
- package/README.md +10 -2
- package/lib/client.js +1075 -9
- package/lib/index.js +381 -4
- package/lib/types/client/MonitorView.d.ts +33 -0
- package/lib/types/client/api.d.ts +8 -0
- package/lib/types/client/metrics-model.d.ts +84 -0
- package/lib/types/client/store.d.ts +1 -1
- package/lib/types/metrics.d.ts +116 -0
- package/lib/types/monitor.d.ts +57 -0
- package/lib/types/protocol.d.ts +54 -0
- package/package.json +36 -36
- package/src/client/MonitorView.tsx +636 -0
- package/src/client/RemoteRoot.tsx +9 -2
- package/src/client/api.ts +16 -0
- package/src/client/i18n.ts +84 -0
- package/src/client/metrics-model.ts +242 -0
- package/src/client/store.tsx +2 -2
- package/src/client/vsc/vsc.css +464 -0
- package/src/metrics.ts +300 -0
- package/src/monitor.ts +203 -0
- package/src/protocol.ts +58 -1
- package/src/routes.ts +47 -0
package/README.en.md
CHANGED
|
@@ -38,7 +38,7 @@ dsh plugin --profile web add dsh-remote-vs
|
|
|
38
38
|
`dsh plugin --profile web add github:xiray-xia/dsh-remote-vs`.)
|
|
39
39
|
|
|
40
40
|
**Requires DSH `0.2.2-alpha.3` or newer and below `0.3.0`** (`engines.dsh` enforces the range;
|
|
41
|
-
**
|
|
41
|
+
**tested on `0.2.2-alpha.3` and `0.2.2-rc.1`**). On Host `0.2.2-alpha.2` use plugin `0.17.0` (or
|
|
42
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`
|
|
@@ -120,6 +120,7 @@ extra configuration is needed.
|
|
|
120
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) |
|
|
121
121
|
| 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 |
|
|
122
122
|
| 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 |
|
|
123
|
+
| Monitor | A sidebar **"Monitor"** page samples one host or every host **only while the panel and the page are visible**, at the configured refresh interval (5 s by default; 5/10/30 s in its settings): CPU, memory, disk, load, network rate, temperature and uptime, with 60-point history curves plus manual refresh and pause. The scope is "current host / a named host / all hosts" and survives a reload. The **first sample reports CPU% and the network rate as unknown** (both are deltas and need a second sample), and a non-Linux host shows unknown instead of 0. The Host caches one sample per alias for 3 seconds and joins concurrent requests, so one sample uses one exec channel and never the port-forward budget. Samples live in memory only — nothing is written to disk |
|
|
123
124
|
| Timeouts and process cleanup | Ordinary git commands default to 300 s (configurable); the **network verbs (fetch/pull/push/sync) default to 20 minutes with a 30-minute ceiling**. exec runs in its own session (`setsid --wait`); on timeout OR cancel it sends TERM and **escalates to KILL after 3 seconds**, reaping the child processes with it; a host without `setsid --wait` is detected by a one-shot probe and falls back to the old behaviour, with a host-log line saying the timed-out remote command may still be running; **directory / multi-selection archive downloads carry a 600 s server-side budget** (remote `timeout -k 3 600`; a host without GNU `timeout` falls back to the unbudgeted old behaviour) and fail with the real reason when it expires |
|
|
124
125
|
| Git graph | Remote repo status + branches + SVG commit graph + commit details/contents/diff pane (exec + frontend parsing, zero Host additions) |
|
|
125
126
|
| Import | One-click import from `~/.ssh/config` and from an existing `dsh-ssh.json` (read once, no coupling); `Host a b` multi-pattern entries are expanded one by one, `Include` is reported as not expanded instead of being silently dropped, and every skipped host names an actionable reason (no User / no IdentityFile / invalid port …) |
|
|
@@ -152,6 +153,8 @@ dsh_remote_vs/
|
|
|
152
153
|
│ ├── terminal.ts # PTY session registry (reconnect-on-refresh/disconnect cleanup)
|
|
153
154
|
│ ├── forward.ts # local port-forward manager (direct-tcpip channels / one listener per rule / budgets)
|
|
154
155
|
│ ├── listen-ports.ts # remote listening-port probe (ss/netstat command + pure parser)
|
|
156
|
+
│ ├── metrics.ts # host-monitor probe (one POSIX /proc command + pure parse/CPU·net deltas)
|
|
157
|
+
│ ├── monitor.ts # monitor sampler (per-alias TTL cache/in-flight join/counters/forget)
|
|
155
158
|
│ ├── tools.ts # the 5 Agent tool definitions
|
|
156
159
|
│ ├── http.ts / loopback.ts # JSON body IO + loopback trust fence
|
|
157
160
|
│ ├── git-format.ts # git command builders + pure frontend parsing (zero Host additions)
|
|
@@ -207,6 +210,8 @@ dsh_remote_vs/
|
|
|
207
210
|
│ ├── composer.ts / use-remote-chat-target.ts / selection-popup.ts # remote @refs/selection-to-chat
|
|
208
211
|
│ ├── ai-review.ts # AI review prompt builder (single diff / whole commit, byte tiers, pure)
|
|
209
212
|
│ ├── api.ts # typed fetch wrapper over /api/dsh-remote
|
|
213
|
+
│ ├── MonitorView.tsx # monitor panel (one/all hosts, curves, pause/refresh, persisted scope)
|
|
214
|
+
│ ├── metrics-model.ts # monitor model (history window/sparkline geometry/capacity+rate formatting)
|
|
210
215
|
│ ├── HostsView / WorkspacesView / WorkspaceWizard / TerminalView / XTerm / PortsView / Dialog
|
|
211
216
|
│ ├── SettingsHosts.tsx # settings occupants (host mgmt/binding list, self-fetching)
|
|
212
217
|
│ ├── DirectoryFlow.tsx # native entry occupant (local dual-mode/remote wizard)
|
|
@@ -215,7 +220,7 @@ dsh_remote_vs/
|
|
|
215
220
|
├── vendor/dsh-remote-helpers/ # helper seeds (shipped, seeded into cache at startup, see below)
|
|
216
221
|
├── docs/ # local-only working docs (only docs/media/ screenshots ship)
|
|
217
222
|
│ ├── MAINTENANCE.md # local-only (.gitignore), not shipped: upgrade impact, checklist, pitfalls, release
|
|
218
|
-
│ ├── VERSION-HISTORY.md # local-only: per-release change log (0.7.1 → 0.
|
|
223
|
+
│ ├── VERSION-HISTORY.md # local-only: per-release change log (0.7.1 → 0.19.1)
|
|
219
224
|
│ └── GATES.md # local-only: local gate inventory and measured assertion counts
|
|
220
225
|
├── locale/ # bilingual plugin metadata
|
|
221
226
|
└── lib/ # build output (**must be committed**; only .map is ignored; restart after link install)
|
|
@@ -292,6 +297,11 @@ Both surfaces share one state module (`store.tsx`): **the sidebar "Remote" page*
|
|
|
292
297
|
- A directory listing past 20000 entries is truncated, and since the protocol has no "truncated" field
|
|
293
298
|
the UI shows **no marker at all** — only the host log line
|
|
294
299
|
`listing <path> on <alias> shows 20000 of N entries`.
|
|
300
|
+
- **Monitor limits**: sampling happens only while the Monitor panel is the visible view AND the page is
|
|
301
|
+
in the foreground (hidden means zero remote traffic); the complete metric set comes from Linux
|
|
302
|
+
`/proc`, so other platforms show unknown; temperature exists only when the host exposes a thermal
|
|
303
|
+
zone (many VMs do not); CPU% and the network rate are deltas, so the **first frame is unknown**;
|
|
304
|
+
samples live in memory only and the curves restart after a page reload.
|
|
295
305
|
|
|
296
306
|
## Session change review (Cursor style)
|
|
297
307
|
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ 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
|
-
**需要 DSH `0.2.2-alpha.3` 及以上、`0.3.0` 以下**(`engines.dsh`
|
|
37
|
+
**需要 DSH `0.2.2-alpha.3` 及以上、`0.3.0` 以下**(`engines.dsh` 门到底;已在 `0.2.2-alpha.3` 与 `0.2.2-rc.1` 上验证)。
|
|
38
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 名为准);
|
|
@@ -105,6 +105,7 @@ Host 转发(终端按 `__DSH_TRANSPORT__.streamBaseUrl` 解析地址),无
|
|
|
105
105
|
| 远端文件 | SFTP 浏览 / 读 / 写 / 新建 / 删除 / 改名。边界已加固:0 字节文件不再卡死,每个 SFTP 操作 60s 超时回收通道;**单个目录列表上限 20000 条**(按"目录在前、其余按名"排序后取前 20000,宿主日志说明——协议里没有"已截断"字段,界面上没有标记);**保存走侧文件 + 重命名**(优先服务端 `posix-rename`,不支持时备份-重命名-失败回滚),**写穿符号链接**(链接本身保留)并**尽力保留权限位**;SCM 状态解析会反解 git 的 C-quote 路径(凡名字含空格都会被加引号) |
|
|
106
106
|
| 远端终端 | ssh2 PTY + WebSocket,xterm 渲染(复制粘贴/主题跟随/刷新重连);**重新挂接只接管、不改尺寸**(刷新页面不会把运行中的 shell 缩成 80×24);输出积压时对远端施加真背压;**单帧上限 1 MiB**,超过 64 Ki 字符的粘贴在客户端按码点分块发送,不再撑断连接 |
|
|
107
107
|
| 并发通道 | 每主机同时最多 **6 条**远端通道(不再撞远端 sshd 的 `MaxSessions`);第 7 个排队最多等 **30 秒**,超时明确报 `remote host <alias> is busy`,而不是无限堆连接 |
|
|
108
|
+
| 运行监控 | 侧栏「监控」页:**仅在面板可见且页面在前台时**按刷新设置(默认 5 秒,可改 5/10/30 秒)采样一台/全部主机的 CPU、内存、磁盘、负载、网络速率、温度与运行时长,带 60 点历史曲线、手动刷新与暂停;范围可选「当前主机 / 指定主机 / 全部主机」并跨刷新记住。**首帧 CPU% 与网络速率显示「未知」**(差分需要第二帧),Linux 之外的平台如实显示「未知」而不是 0;Host 侧按 alias 缓存 3 秒并合并并发请求,一次采样只占一条执行通道、不占端口转发预算;样本只在内存,不落盘 |
|
|
108
109
|
| 超时与进程清理 | 普通 git 命令默认 300s(设置可调);**网络动词(fetch/pull/push/sync)默认 20 分钟、上限 30 分钟**。exec 跑在独立会话里(`setsid --wait`),超时/取消都先发 TERM、**3 秒后升级 KILL**,连同子进程一起收掉;远端没有 `setsid --wait` 时探测一次即知,退回旧行为并在宿主日志里写明"超时可能没停掉远端命令";**目录/多选归档下载有 600 秒服务端预算**(远端 `timeout -k 3 600`;远端没有 GNU `timeout` 时退回无预算的旧行为),超时以真实原因失败 |
|
|
109
110
|
| Git 图谱 | 远端仓库状态 + 分支 + SVG 提交图 + 提交详情/内容/差异面板(exec + 前端解析,零 Host 增量)|
|
|
110
111
|
| 导入 | 从 `~/.ssh/config`、从现有 `dsh-ssh.json` 一键导入(只读一次,不耦合);`Host a b` 这类多模式条目会逐个展开,`Include` 如实报告为未展开,被跳过的主机会给出可操作原因(缺 User / 缺 IdentityFile / 端口非法等)|
|
|
@@ -137,6 +138,8 @@ dsh_remote_vs/
|
|
|
137
138
|
│ ├── terminal.ts # PTY 会话注册表(刷新重连/断开清理)
|
|
138
139
|
│ ├── forward.ts # 本地端口转发管理器(direct-tcpip 通道/每规则监听器/连接预算)
|
|
139
140
|
│ ├── listen-ports.ts # 远端监听端口探测(ss/netstat 命令 + 纯解析器)
|
|
141
|
+
│ ├── metrics.ts # 主机监控探针(一条 POSIX /proc 命令 + 纯解析/CPU·网络差分)
|
|
142
|
+
│ ├── monitor.ts # 监控采样器(按 alias 的 TTL 缓存/单飞/计数器/forget)
|
|
140
143
|
│ ├── tools.ts # 5 个 Agent 工具定义
|
|
141
144
|
│ ├── http.ts / loopback.ts # JSON 体读写 + 回环信任围栏
|
|
142
145
|
│ ├── git-format.ts # git 命令构造 + 纯前端解析(Host 零增量)
|
|
@@ -192,6 +195,8 @@ dsh_remote_vs/
|
|
|
192
195
|
│ ├── composer.ts / use-remote-chat-target.ts / selection-popup.ts # 远端 @引用/选中加对话
|
|
193
196
|
│ ├── ai-review.ts # AI 审查 prompt 构造(单文件 diff / 整提交,按字节分级,纯函数)
|
|
194
197
|
│ ├── api.ts # /api/dsh-remote 类型化 fetch 封装
|
|
198
|
+
│ ├── MonitorView.tsx # 监控面板(单机/全部主机、曲线、暂停/刷新、范围持久化)
|
|
199
|
+
│ ├── metrics-model.ts # 监控纯模型(历史窗口/Sparkline 几何/容量与速率格式化)
|
|
195
200
|
│ ├── HostsView / WorkspacesView / WorkspaceWizard / TerminalView / XTerm / PortsView / Dialog
|
|
196
201
|
│ ├── SettingsHosts.tsx # 设置两节 occupant(主机管理/绑定列表,自取数)
|
|
197
202
|
│ ├── DirectoryFlow.tsx # 原生入口 occupant(本地双模/远端向导)
|
|
@@ -200,7 +205,7 @@ dsh_remote_vs/
|
|
|
200
205
|
├── vendor/dsh-remote-helpers/ # helper 种子(随包发布,启动铺缓存,见下)
|
|
201
206
|
├── docs/ # 本地工作文档(不推送 GitHub;只有 docs/media/ 的截图随仓库公开)
|
|
202
207
|
│ ├── MAINTENANCE.md # 本地私有(.gitignore,不入库):升级影响面/检查清单/踩坑/发布流程
|
|
203
|
-
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.
|
|
208
|
+
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.19.1)
|
|
204
209
|
│ └── GATES.md # 本地私有:本地门禁清单与实跑条数
|
|
205
210
|
├── locale/ # 插件元信息双语
|
|
206
211
|
└── lib/ # 构建产物(**必须入库**,只有 .map 忽略;link 安装后重启即生效)
|
|
@@ -266,6 +271,9 @@ dsh_remote_vs/
|
|
|
266
271
|
拖住远端命令,也不让宿主内存无界增长);
|
|
267
272
|
- 目录列表超过 20000 条会被截断,而协议里没有"已截断"字段 ⇒ 界面上没有任何标记,只有宿主日志里的
|
|
268
273
|
`listing <path> on <alias> shows 20000 of N entries`。
|
|
274
|
+
- **监控的边界**:采样只在「监控」面板可见且页面在前台时进行(隐藏即完全停止,不产生远端流量);完整指标来自 Linux `/proc`,
|
|
275
|
+
其它平台显示「未知」;温度只在主机暴露 thermal zone 时有值(很多虚拟机没有);CPU% 与网络速率是两帧差分,**首帧为未知**;
|
|
276
|
+
样本只进内存,刷新页面后曲线从头开始。
|
|
269
277
|
|
|
270
278
|
## 会话改动审阅(Cursor 式)
|
|
271
279
|
|