dsh-remote-deck 0.0.0-stage → 1.46.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.
Files changed (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +227 -2
  3. package/README.zh-CN.md +201 -0
  4. package/client.js +8645 -0
  5. package/cordis.patch.yml +6 -0
  6. package/icon.svg +19 -0
  7. package/index.js +701 -0
  8. package/lib/api.js +1452 -0
  9. package/lib/bash-result.js +93 -0
  10. package/lib/connection.js +1133 -0
  11. package/lib/delete.js +199 -0
  12. package/lib/drafts.js +299 -0
  13. package/lib/encoding.js +247 -0
  14. package/lib/file-edit.js +339 -0
  15. package/lib/file-ops.js +402 -0
  16. package/lib/forwards.js +186 -0
  17. package/lib/fs-actions.js +235 -0
  18. package/lib/guide.js +162 -0
  19. package/lib/metrics.js +523 -0
  20. package/lib/remote-shells.js +320 -0
  21. package/lib/remote-terminal.js +427 -0
  22. package/lib/routing.js +695 -0
  23. package/lib/ssh-config.js +118 -0
  24. package/lib/terminal.js +123 -0
  25. package/lib/tool-forward.js +185 -0
  26. package/lib/transfer.js +235 -0
  27. package/lib/upload-chunks.js +306 -0
  28. package/lib/util.js +154 -0
  29. package/locale/README.md +160 -0
  30. package/locale/en-ui.json +477 -0
  31. package/locale/en.json +6 -0
  32. package/locale/zh.json +6 -0
  33. package/package.json +63 -4
  34. package/vendor/codemirror/LICENSE +21 -0
  35. package/vendor/codemirror/README.md +18 -0
  36. package/vendor/codemirror/addon/edit/closebrackets.min.js +8 -0
  37. package/vendor/codemirror/addon/edit/matchbrackets.min.js +8 -0
  38. package/vendor/codemirror/addon/search/search.min.js +8 -0
  39. package/vendor/codemirror/addon/search/searchcursor.min.js +8 -0
  40. package/vendor/codemirror/addon/selection/active-line.min.js +8 -0
  41. package/vendor/codemirror/lib/codemirror.css +344 -0
  42. package/vendor/codemirror/lib/codemirror.min.js +8 -0
  43. package/vendor/codemirror/mode/clike/clike.min.js +8 -0
  44. package/vendor/codemirror/mode/css/css.min.js +8 -0
  45. package/vendor/codemirror/mode/go/go.min.js +8 -0
  46. package/vendor/codemirror/mode/htmlmixed/htmlmixed.min.js +8 -0
  47. package/vendor/codemirror/mode/javascript/javascript.min.js +8 -0
  48. package/vendor/codemirror/mode/markdown/markdown.min.js +8 -0
  49. package/vendor/codemirror/mode/python/python.min.js +8 -0
  50. package/vendor/codemirror/mode/rust/rust.min.js +8 -0
  51. package/vendor/codemirror/mode/shell/shell.min.js +8 -0
  52. package/vendor/codemirror/mode/xml/xml.min.js +8 -0
  53. package/vendor/codemirror/mode/yaml/yaml.min.js +8 -0
  54. package/vendor/node_modules/asn1/Jenkinsfile +65 -0
  55. package/vendor/node_modules/asn1/LICENSE +19 -0
  56. package/vendor/node_modules/asn1/README.md +50 -0
  57. package/vendor/node_modules/asn1/lib/ber/errors.js +13 -0
  58. package/vendor/node_modules/asn1/lib/ber/index.js +27 -0
  59. package/vendor/node_modules/asn1/lib/ber/reader.js +262 -0
  60. package/vendor/node_modules/asn1/lib/ber/types.js +36 -0
  61. package/vendor/node_modules/asn1/lib/ber/writer.js +317 -0
  62. package/vendor/node_modules/asn1/lib/index.js +20 -0
  63. package/vendor/node_modules/asn1/package.json +31 -0
  64. package/vendor/node_modules/bcrypt-pbkdf/CONTRIBUTING.md +13 -0
  65. package/vendor/node_modules/bcrypt-pbkdf/LICENSE +66 -0
  66. package/vendor/node_modules/bcrypt-pbkdf/README.md +45 -0
  67. package/vendor/node_modules/bcrypt-pbkdf/index.js +556 -0
  68. package/vendor/node_modules/bcrypt-pbkdf/package.json +15 -0
  69. package/vendor/node_modules/safer-buffer/LICENSE +21 -0
  70. package/vendor/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  71. package/vendor/node_modules/safer-buffer/Readme.md +156 -0
  72. package/vendor/node_modules/safer-buffer/dangerous.js +58 -0
  73. package/vendor/node_modules/safer-buffer/package.json +34 -0
  74. package/vendor/node_modules/safer-buffer/safer.js +77 -0
  75. package/vendor/node_modules/safer-buffer/tests.js +406 -0
  76. package/vendor/node_modules/ssh2/LICENSE +19 -0
  77. package/vendor/node_modules/ssh2/README.md +1529 -0
  78. package/vendor/node_modules/ssh2/SFTP.md +413 -0
  79. package/vendor/node_modules/ssh2/lib/Channel.js +295 -0
  80. package/vendor/node_modules/ssh2/lib/agent.js +1123 -0
  81. package/vendor/node_modules/ssh2/lib/client.js +2176 -0
  82. package/vendor/node_modules/ssh2/lib/http-agents.js +84 -0
  83. package/vendor/node_modules/ssh2/lib/index.js +44 -0
  84. package/vendor/node_modules/ssh2/lib/keygen.js +582 -0
  85. package/vendor/node_modules/ssh2/lib/protocol/Protocol.js +2136 -0
  86. package/vendor/node_modules/ssh2/lib/protocol/SFTP.js +4052 -0
  87. package/vendor/node_modules/ssh2/lib/protocol/constants.js +356 -0
  88. package/vendor/node_modules/ssh2/lib/protocol/crypto/binding.gyp +23 -0
  89. package/vendor/node_modules/ssh2/lib/protocol/crypto/poly1305.js +43 -0
  90. package/vendor/node_modules/ssh2/lib/protocol/crypto/src/binding.cc +2300 -0
  91. package/vendor/node_modules/ssh2/lib/protocol/crypto.js +1602 -0
  92. package/vendor/node_modules/ssh2/lib/protocol/handlers.js +16 -0
  93. package/vendor/node_modules/ssh2/lib/protocol/handlers.misc.js +1285 -0
  94. package/vendor/node_modules/ssh2/lib/protocol/kex.js +1908 -0
  95. package/vendor/node_modules/ssh2/lib/protocol/keyParser.js +1484 -0
  96. package/vendor/node_modules/ssh2/lib/protocol/node-fs-compat.js +115 -0
  97. package/vendor/node_modules/ssh2/lib/protocol/utils.js +356 -0
  98. package/vendor/node_modules/ssh2/lib/protocol/zlib.js +255 -0
  99. package/vendor/node_modules/ssh2/lib/server.js +1380 -0
  100. package/vendor/node_modules/ssh2/lib/utils.js +336 -0
  101. package/vendor/node_modules/ssh2/package.json +49 -0
  102. package/vendor/node_modules/tweetnacl/AUTHORS.md +28 -0
  103. package/vendor/node_modules/tweetnacl/CHANGELOG.md +221 -0
  104. package/vendor/node_modules/tweetnacl/LICENSE +24 -0
  105. package/vendor/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md +20 -0
  106. package/vendor/node_modules/tweetnacl/README.md +459 -0
  107. package/vendor/node_modules/tweetnacl/nacl-fast.js +2388 -0
  108. package/vendor/node_modules/tweetnacl/nacl-fast.min.js +2 -0
  109. package/vendor/node_modules/tweetnacl/nacl.d.ts +98 -0
  110. package/vendor/node_modules/tweetnacl/nacl.js +1175 -0
  111. package/vendor/node_modules/tweetnacl/nacl.min.js +1 -0
  112. package/vendor/node_modules/tweetnacl/package.json +58 -0
  113. package/vendor/xterm/LICENSE.addon-fit +19 -0
  114. package/vendor/xterm/LICENSE.xterm +21 -0
  115. package/vendor/xterm/README.md +9 -0
  116. package/vendor/xterm/addon-fit.js +2 -0
  117. package/vendor/xterm/xterm.css +218 -0
  118. package/vendor/xterm/xterm.js +2 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Remote Deck contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,228 @@
1
- # Temporary Holding Version
1
+ # Remote Deck
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **SSH workspaces for DeepSeek Harness — one window, local and remote conversations side by side.**
4
+
5
+ Remote Deck connects your DSH desktop app to any number of SSH machines and turns a remote
6
+ folder into an ordinary DSH workspace. Inside that workspace the agent reads, writes, searches,
7
+ runs commands, opens a terminal and forwards ports on the remote host — while the UI stays the
8
+ same window you already use.
9
+
10
+ - **Conversation first.** A compact status chip, a few badges, and a console that only appears
11
+ when you open it. Nothing competes with the chat.
12
+ - **Many machines at once.** Every host has a colour identity, its own connection, and its own
13
+ group of workspaces and sessions.
14
+ - **No agent on the server.** Only `sshd`: SFTP for files, exec channels for commands and search,
15
+ a PTY for the terminal, `direct-tcpip` for port forwarding.
16
+
17
+ ## Screens
18
+
19
+ | Console | Quick panel |
20
+ | --- | --- |
21
+ | ![Console](docs/design/v2/03.png) | ![Quick panel](docs/design/v2/01.png) |
22
+
23
+ | Session identity | Add a machine |
24
+ | --- | --- |
25
+ | ![Session identity](docs/design/v2/02.png) | ![Add a machine](docs/design/v2/05.png) |
26
+
27
+ | New workspace | Terminal and ports |
28
+ | --- | --- |
29
+ | ![New workspace](docs/design/v2/04.png) | ![Terminal and ports](docs/design/v2/06.png) |
30
+
31
+ Screenshots are rendered from the sanitized design mockups in `docs/design/v2/`. Host names,
32
+ addresses and paths are demo data (`dev-box`, `203.0.113.10`, `/srv/demo-app`).
33
+
34
+ ## Features
35
+
36
+ | Area | What you get |
37
+ | --- | --- |
38
+ | Connections | Multiple hosts, key or password auth, `~/.ssh/config` import, connection test with OS/latency, per-host auto-connect (off by default; toggle in the dialog, quick panel or console), keepalive and backoff reconnect |
39
+ | Language | English UI with a system/中文/English switch; the Chinese strings are the lookup keys |
40
+ | Editor | Encoding-aware: UTF-8 edits normally, GBK/Big5 are detected and never silently rewritten, CRLF is preserved |
41
+ | Editor | Double-click a text file to edit it in a CodeMirror tab with **auto-save** (configurable) and disk drafts that survive closing the tab or the app in a vendored CodeMirror 5 tab with `Ctrl/Cmd+S`, atomic saves and a stale-file conflict dialog |
42
+ | Remote files | Rename (`F2`), new folder, new file and a name filter; header is one line with a click-to-type path field; keyboard (Ctrl+A / C / X / V with a plugin clipboard), drag onto a folder to move, and 下载到本地并显示 for the local copy — plus its own guide card, plus a sidebar tab: remote paths, per-type icons (links, devices and unknown types included), a hidden-file toggle, Ctrl/Shift multi-select, packaged multi-download, permanent delete with one confirmation, a cancellable task bar and double-click preview in a new tab |
43
+ | Workspace files | The workspace-files card opens a remote file page in a Remote Deck workspace: remote path, right-click upload / download / delete (permanent-deletion confirmation) and a cancellable task bar |
44
+ | Settings | Settings → 远端工作台 applies as you change it (no save button) and follows DSH's own settings styling: terminal font and size, monitor thresholds, transfer cap |
45
+ | Console | The console follows DSH's neutral palette: one background layer, no gradients, colour only for status and destructive actions |
46
+ | Settings (old) | Settings → 远端工作台 holds the terminal font and size, the monitor thresholds and the transfer cap |
47
+ | Sidebar terminal | In a Remote Deck workspace the right-sidebar terminal opens a remote PTY on the SSH host (`bash -l`) instead of a local shell |
48
+ | Monitoring | The header pill shows CPU, memory and the free space of the session path's filesystem, raises an alert icon past a threshold, and keeps the refresh interval, per-metric switches and thresholds in settings |
49
+ | Transfers | Download a remote folder as a streamed `tar.gz` (symlinks skipped, never followed through a loop or a mount) or upload files into the displayed folder over SFTP. A pre-flight scan reports files, bytes and unreadable entries first; upload failures offer 跳过 / 跳过该目录 / 停止; both directions are capped by a size guard |
50
+ | Header pill | Click it for a dropdown: the machine's port forwards with open / copy / stop per row, plus a button into the remote console |
51
+ | ProxyJump | Reach a machine through one or more jump hosts: `[user@]host[:port]`, comma-separated for a chain. A hop reuses the configured connection it names, otherwise the target's own key |
52
+ | Workspaces | Browse remote folders with breadcrumbs, filters and keyboard navigation; add one as a DSH workspace; custom sidebar name; remove locally without touching the remote directory |
53
+ | Sessions | Remote sessions get a header pill, a colour-coded sidebar badge and a hover line; local sessions are unchanged |
54
+ | Console | Machine rail, host overview, stats, workspace cards, recent sessions, search, and a remote file browser with download / save-to-local / reveal |
55
+ | Terminal | Remote PTY in a full xterm.js terminal: colours, cursor, full-screen programs, paste and replay buffer |
56
+ | Ports | Automatic discovery of remote listening ports, one-click forwarding, persistence and restore on reconnect |
57
+ | Agent tools | `bash` with `run_in_background` starts remote background jobs, `remote_job` lists, reads and kills them, and `remote_forward` requests and manages loopback port forwards |
58
+ | Theme | Light and dark, driven by DSH theme tokens |
59
+
60
+ ## Agent tools
61
+
62
+ Three tools connect the model to the remote machine:
63
+
64
+ | Tool | What it does |
65
+ | --- | --- |
66
+ | `bash` with `run_in_background` | Runs the command detached on the remote host (`setsid`, its own session), streams its output into a per-job file and returns a job id immediately instead of waiting |
67
+ | `remote_job` | `list` running and finished jobs with status, pid and elapsed time; `output` reads what the job printed since a previous offset (`wait: true` follows until it exits); `kill` terminates the whole process group; `forget` drops a finished job and its remote directory |
68
+ | `remote_forward` | `list` the active forwards; `detect` the ports listening on the remote host; `start` a forward from a remote port to `127.0.0.1:<local port>` on the DSH machine; `stop` one by id. A forward remembers its origin: the console marks agent-created ones with an `Agent` badge, and the Session header pill counts the forwards of that session's host |
69
+
70
+ When the composition carries the DSH job registry (the desktop app does), each remote job is also
71
+ registered there: it appears in the Session header job list with live output and a stop control, sends
72
+ the usual completion notice, and answers the built-in `job_list`, `job_output` and `job_kill` tools.
73
+ Without the registry it stays reachable through `remote_job`.
74
+
75
+ The header pill shares its row with DSH's own chips (agent team, mode, subagents) and now matches their
76
+ metrics: 28 px high, `var(--dsw-radius-sm)`, 12 px text, neutral colours and the same hover background.
77
+ The connection dot keeps the per-machine colour identity.
78
+
79
+ Background-job bookkeeping lives inside the DSH process and does **not** survive a DSH restart: the remote
80
+ processes keep running, but the job list starts empty. For a service that must outlive DSH, start it with
81
+ `tmux` or `systemd-run --user` instead.
82
+
83
+ ## Install
84
+
85
+ From the plugin market (after listing) or npm:
86
+
87
+ ```sh
88
+ dsh plugin add dsh-remote-deck
89
+ ```
90
+
91
+ From GitHub:
92
+
93
+ ```sh
94
+ dsh plugin add git+https://github.com/dsh-plugins-cn/dsh-remote-deck.git
95
+ ```
96
+
97
+ In mainland China, use the GitHub proxy:
98
+
99
+ ```sh
100
+ dsh plugin add "git+https://ghproxy.laiyouxi.com/https://github.com/dsh-plugins-cn/dsh-remote-deck.git"
101
+ ```
102
+
103
+ From a checkout:
104
+
105
+ ```sh
106
+ git clone https://github.com/dsh-plugins-cn/dsh-remote-deck.git
107
+ cd dsh-remote-deck
108
+ powershell -ExecutionPolicy Bypass -File .\install.ps1 -Profile desktop
109
+ ```
110
+
111
+ Restart DSH (or press `Ctrl+R`) after installing; the SSH chip appears at the bottom of the
112
+ sidebar and **远程开发** appears in the sidebar navigation.
113
+
114
+ The plugin has **no npm dependencies**: `ssh2` and its small dependency tree are vendored under
115
+ `vendor/node_modules`, and the terminal assets under `vendor/xterm`. Installation therefore never
116
+ runs package build scripts.
117
+
118
+ ## Migrating from `dsh-remote-ssh`
119
+
120
+ Remote Deck is the successor of `dsh-remote-ssh`.
121
+
122
+ - On first load it copies connections from `<DSH_HOME>/remote-ssh` and **reuses existing workspace
123
+ stubs in place**, so workspaces and sessions keep their place in the sidebar.
124
+ - The old plugin keeps working until you remove it. Use one profile at a time: both plugins patch
125
+ `ctx.fs`, so only one of them should be enabled in a profile.
126
+ - Cut over in one command (backs up `package.json` first and keeps the old plugin files for
127
+ rollback):
128
+
129
+ ```powershell
130
+ .\install.ps1 -Profile desktop -RemoveOld
131
+ ```
132
+
133
+ - Roll back at any time:
134
+
135
+ ```powershell
136
+ .\install.ps1 -Rollback # restores package.json.bak-before-deck
137
+ ```
138
+
139
+ Data stays in `<DSH_HOME>/remote-deck` and survives plugin reinstalls.
140
+
141
+ ## How it works
142
+
143
+ ```text
144
+ ┌────────────────────────────── DSH desktop ──────────────────────────────┐
145
+ │ conversation · sidebar · Remote Deck console │
146
+ │ │ ctx.fs / ctx.shell / ripgrep / tools │
147
+ │ ▼ │
148
+ │ host half: connection pool, workspace stubs, loopback API │
149
+ └────────┬────────────────────────────────────────────────────────────────┘
150
+ │ SSH (ssh2): exec channels · SFTP · PTY · port forwarding
151
+ ▼
152
+ remote host: sshd only (Linux / macOS)
153
+ ```
154
+
155
+ A remote workspace is a marked stub directory under `<DSH_HOME>/remote-deck/workspaces`; the
156
+ marker records the connection id and the remote POSIX path. Every path under a marked workspace
157
+ resolves through SFTP; commands run through an exec channel with the remote cwd; ripgrep moves to
158
+ the host; the terminal is one PTY channel; forwarding is one local listener per port.
159
+
160
+ ### Remote bash behaviour
161
+
162
+ - Every call runs as a DSH background job. The foreground wait defaults to 10 minutes
163
+ (`DSH_REMOTE_DECK_FOREGROUND_TIMEOUT_MS`); when it expires the command keeps running in the
164
+ background and the tool returns its job id — it is never killed on timeout. Follow it with the
165
+ built-in `job_output` / `job_list` tools and stop it with `job_kill`.
166
+ - `run_in_background: true` returns a job id immediately, for servers and long acceptance runs.
167
+ - The remote stdin is closed immediately. Interactive prompts (for example `psql` without
168
+ `PGPASSWORD`) fail fast with their own error instead of blocking the turn forever.
169
+ - The working directory is strict. Relative paths resolve against the session workspace; a missing
170
+ directory fails the command instead of silently falling back to the home directory.
171
+ - Output is capped at 4 MiB per stream (`DSH_REMOTE_DECK_MAX_OUTPUT_BYTES`) and marked
172
+ `[output truncated; …]` when it exceeds the cap.
173
+ - Stopping the tool or calling `job_kill` signals the recorded remote pid (TERM, then KILL).
174
+ Processes detached with `setsid`/double fork may survive; use `timeout` for those.
175
+
176
+ ## Security
177
+
178
+ - Remote commands run on the SSH host outside the local DSH sandbox/approval layer; the remote
179
+ account is the execution boundary. Pin the host key with `hostKeyFingerprint` on the connection
180
+ record and use a restricted account for untrusted repositories.
181
+ - `apply_patch` is not supported on remote workspaces yet; use `edit`/`write`.
182
+ - A remote Session routes POSIX paths to the SSH host and drive/backslash paths (`C:\\...`,
183
+ `E:\\...`) to the local machine, so remote development can still use local Windows
184
+ files/resources. Both worlds are intentionally reachable; review remote-sourced content before
185
+ letting it touch local paths.
186
+ - The loopback API accepts the desktop `dsh-app://app` origin and loopback HTTP(S); every route
187
+ still requires the per-session token.
188
+
189
+ - Passwords and key passphrases live in the DSH credential store, never in `connections.json`.
190
+ - The browser half talks to the host over a loopback HTTP server guarded by a per-session token.
191
+ - The terminal and forwarding endpoints are behind the same token.
192
+ - Removing a workspace only unregisters it locally; remote files are never deleted by the plugin.
193
+
194
+ ## Requirements
195
+
196
+ - DeepSeek Harness desktop 0.2.x or newer.
197
+ - Node 20+.
198
+ - `sshd` on the remote host; Linux or macOS; remote shell `bash`.
199
+
200
+ ## Known limits
201
+
202
+ - Background-job bookkeeping (`remote_job`) is not persisted across a DSH restart; the remote processes keep running.
203
+ - The terminal ships a vendored xterm.js build (colours, cursor, full-screen programs). If the
204
+ asset loader is blocked, the plugin falls back to a plain line renderer.
205
+ - The UI is Chinese-first; English strings land in v1.1.0.
206
+ - `~/.ssh/config` import covers Host/HostName/Port/User/IdentityFile/ProxyJump; proxy commands and
207
+ host-key pinning are not wired into the connection dialogs yet.
208
+ - `ss` or `netstat` is required for automatic port discovery; manual forwarding still works.
209
+
210
+ ## Development
211
+
212
+ ```sh
213
+ npm run check # syntax + manifest
214
+ npm test # parser unit tests
215
+ npm run pack:dry # inspect the published file list
216
+ ```
217
+
218
+ Design mockups and their sanitized renders live in `docs/design/v2/`; acceptance runs are
219
+ recorded in the CHANGELOG. The version plan is in [ROADMAP.md](ROADMAP.md), release steps in
220
+ [PUBLISH.md](PUBLISH.md), and the iteration runbook in [docs/MAINTENANCE.md](docs/MAINTENANCE.md).
221
+
222
+ ## License
223
+
224
+ MIT
225
+
226
+ ## Release policy
227
+
228
+ See [RELEASE-POLICY.md](./RELEASE-POLICY.md): batch fixes, test before publishing, and use semantic versions (patch = bugfix, minor = capability).
@@ -0,0 +1,201 @@
1
+ # Remote Deck · 远程工作台
2
+
3
+ **给 DeepSeek Harness 的 SSH 工作区插件:一个窗口,本地对话与远程对话并存。**
4
+
5
+ 把任意一台 SSH 机器接进 DSH,把远端目录变成普通工作区。在这个工作区里,模型读写文件、
6
+ 搜索、执行命令、开终端、转发端口,全部发生在远端;界面还是你现在这个窗口。
7
+
8
+ - **对话优先**:只有一个状态胶囊、几处标识;控制台点开才出现,不抢主界面。
9
+ - **多机并行**:每台机器一个颜色身份、一条独立连接、一组自己的工作区与会话。
10
+ - **远端零安装**:只用 `sshd`——SFTP 读文件、exec 通道跑命令与搜索、PTY 开终端、
11
+ `direct-tcpip` 做端口转发。
12
+
13
+ ## 界面
14
+
15
+ | 控制台 | 快速面板 |
16
+ | --- | --- |
17
+ | ![控制台](docs/design/v2/03.png) | ![快速面板](docs/design/v2/01.png) |
18
+
19
+ | 会话标识 | 添加机器 |
20
+ | --- | --- |
21
+ | ![会话标识](docs/design/v2/02.png) | ![添加机器](docs/design/v2/05.png) |
22
+
23
+ | 新建工作区 | 终端与端口 |
24
+ | --- | --- |
25
+ | ![新建工作区](docs/design/v2/04.png) | ![终端与端口](docs/design/v2/06.png) |
26
+
27
+ 截图由 `docs/design/v2/` 的脱敏设计稿渲染;主机名、地址和路径均为演示数据
28
+ (`dev-box`、`203.0.113.10`、`/srv/demo-app`)。
29
+
30
+ ## 能力
31
+
32
+ | 模块 | 内容 |
33
+ | --- | --- |
34
+ | 连接 | 多机器、密钥/密码、`~/.ssh/config` 导入、测试连接(系统/延迟)、按机器自动连接(默认关闭,可在对话框/快速面板/控制台切换)、keepalive + 退避重连 |
35
+ | 界面语言 | 跟随系统,可在设置里改为中文/English;英文为内置词条表,中文原文逐字保留 |
36
+ | 编辑器编码 | UTF-8 直接编辑;GBK/Big5 会被识别、默认只读、确认编码后才写回原编码;CRLF 行尾原样保留 |
37
+ | 编辑器 | 双击文本文件在自带 CodeMirror 5 标签页里编辑:**自动保存**(可关/可调延迟)、磁盘**草稿兜底**(关标签页或关应用后仍可恢复)、原子替换、冲突时二选一 |
38
+ | 远端文件 | 重命名(`F2`)、新建文件夹/文件、按名字筛选;头部一行、点空白可直接输入路径;键盘操作(Ctrl+A / C / X / V,插件自带剪贴板)、拖到文件夹即移动、「下载到本地并显示」落盘;以及自己的引导卡 + 侧栏标签页:远端路径、**按类型图标**(软链/设备/未知类型都有默认图标)、**隐藏文件开关**、**Ctrl/Shift 多选**、**多选打包下载**、一次确认的**永久删除**、可取消任务栏、**双击在新标签预览** |
39
+ | 设置 | 「设置 → 远端工作台」**改动即生效、无需保存**,风格与 DSH 原生设置一致:终端字体与字号、监控阈值、传输上限 |
40
+ | 控制台 | 收敛为 DSH 的中性配色:单一背景层级、无渐变,彩色只用于状态与危险动作 |
41
+ | 侧栏终端 | 在远端工作区里,Web 右侧栏的终端直接开**远端 PTY**(`bash -l`),不再是本地 shell |
42
+ | 监控 | 头部胶囊下拉显示 CPU、内存与「会话路径顶级目录所在存储体」的剩余容量;任一指标越过阈值时胶囊出现感叹号;刷新间隔、各指标开关与阈值都可在设置里调整 |
43
+ | 传输 | 目录可流式打包成 `tar.gz` 下载(默认跳过软链,不跟随、不跨挂载点),文件可上传到当前目录(SFTP 写入)。下载前会预扫描并汇报文件数/体积/不可读项;上传失败可选「跳过 / 跳过该目录 / 停止」;两个方向都有大小上限 |
44
+ | 头部胶囊 | 点击展开下拉:当前机器的端口转发(逐行可打开/复制/停止),底部按钮进入该机器的远程开发界面 |
45
+ | 跳板机 | 支持 ProxyJump:`[user@]host[:port]`,逗号分隔可串多跳。某一跳若匹配已配置的机器就复用它的凭据,否则回退用目标机自己的密钥 |
46
+ | 工作区 | 面包屑浏览、筛选、键盘操作、自定义侧栏名、添加/移除(不删远端目录) |
47
+ | 会话标识 | 头部机器胶囊、侧栏彩色徽标、悬停卡远程路径;本地会话保持原样 |
48
+ | 控制台 | 机器栏、主机概览、指标、工作区卡片、最近会话、搜索,以及远程文件浏览/下载/本地定位 |
49
+ | 终端 | 完整 xterm.js 终端:颜色、光标、全屏程序,键盘/Ctrl 组合/粘贴,重连缓冲 |
50
+ | 端口 | 自动发现监听端口、一键转发、持久化、连接恢复后重建 |
51
+ | Agent 工具 | `bash` 带 `run_in_background` 起远端后台任务,`remote_job` 查看列表/增量输出/终止,`remote_forward` 申请与管理端口转发 |
52
+ | 主题 | 浅色/深色,跟随 DSH 主题 |
53
+
54
+ ## Agent 工具
55
+
56
+ 三个工具把模型接到远端机器上:
57
+
58
+ | 工具 | 作用 |
59
+ | --- | --- |
60
+ | `bash` + `run_in_background` | 命令在远端 detach 执行(`setsid`,独立会话),输出写进该作业自己的文件,调用立刻返回作业 id,不再同步等结果 |
61
+ | `remote_job` | `list` 列出运行中与已结束的作业(状态、pid、已运行时长);`output` 读取某个偏移之后的新输出(`wait: true` 一直跟到退出);`kill` 结束整个进程组;`forget` 清理已结束作业及其远端目录 |
62
+ | `remote_forward` | `list` 现有转发;`detect` 发现远端监听端口;`start` 把远端端口转发到 DSH 机器的 `127.0.0.1:<本地端口>`;`stop` 按 id 关闭。由 Agent 创建的转发会记下来源:控制台「端口转发」页标为 `Agent`,会话头部胶囊把当前机器的转发数计在机器名后面 |
63
+
64
+ 当组合里带 DSH 任务注册表时(桌面版默认有),每个远端后台作业会同时登记进去:它出现在会话头部的
65
+ 任务列表里(可展开看实时输出、两下确认即可停止),照常发完成通知,也能被内置的 `job_list` /
66
+ `job_output` / `job_kill` 直接管理。注册表不可用时自动退回只用 `remote_job`。
67
+
68
+ 头部胶囊与 DSH 自带的 chip(智能体团队、标准模式等)同处一行,尺寸也对齐它们:28px 高、
69
+ `var(--dsw-radius-sm)` 圆角、12px 字号、中性色与同一套悬停底色——机器身份只由连接圆点的颜色保留。
70
+
71
+ 后台作业的记录只存在 DSH 进程内,**不跨 DSH 重启**:重启后远端进程照旧运行,但作业列表是空的。
72
+ 需要比 DSH 活得更久的服务,请改用 `tmux` 或 `systemd-run --user` 启动。
73
+
74
+ ## 安装
75
+
76
+ 插件市场上架后(或 npm 发布后):
77
+
78
+ ```sh
79
+ dsh plugin add dsh-remote-deck
80
+ ```
81
+
82
+ 直接从 GitHub 安装:
83
+
84
+ ```sh
85
+ dsh plugin add git+https://github.com/dsh-plugins-cn/dsh-remote-deck.git
86
+ ```
87
+
88
+ 国内网络可走 GitHub 代理:
89
+
90
+ ```sh
91
+ dsh plugin add "git+https://ghproxy.laiyouxi.com/https://github.com/dsh-plugins-cn/dsh-remote-deck.git"
92
+ ```
93
+
94
+ 从源码安装:
95
+
96
+ ```sh
97
+ git clone https://github.com/dsh-plugins-cn/dsh-remote-deck.git
98
+ cd dsh-remote-deck
99
+ powershell -ExecutionPolicy Bypass -File .\install.ps1 -Profile desktop
100
+ ```
101
+
102
+ 装完重启 DSH(或窗口里按 `Ctrl+R`),侧栏底部出现 **SSH** 胶囊,导航里出现 **远程开发**。
103
+
104
+ 插件**没有任何 npm 依赖**:`ssh2` 及其依赖内置在 `vendor/node_modules`,终端资源在
105
+ `vendor/xterm`。安装过程不会执行任何构建脚本。
106
+
107
+ ## 从 dsh-remote-ssh 迁移
108
+
109
+ - 首次加载会把 `<DSH_HOME>/remote-ssh` 的连接复制过来,并**原地复用**已有工作区,
110
+ 侧栏位置、会话归属都不变。
111
+ - 旧插件在卸载前一直可用;**同一个 profile 不要同时启用两个**(都会接管 `ctx.fs`)。
112
+ - 一条命令切换(会先备份 `package.json`,旧插件文件保留以便回滚):
113
+
114
+ ```powershell
115
+ .\install.ps1 -Profile desktop -RemoveOld
116
+ ```
117
+
118
+ - 一键回滚:
119
+
120
+ ```powershell
121
+ .\install.ps1 -Rollback # 还原 package.json.bak-before-deck
122
+ ```
123
+
124
+ 插件数据在 `<DSH_HOME>/remote-deck`,重装不丢。
125
+
126
+ ## 原理
127
+
128
+ ```text
129
+ ┌────────────────────────────── DSH 桌面 ─────────────────────────────────┐
130
+ │ 对话 · 侧栏 · Remote Deck 控制台 │
131
+ │ │ ctx.fs / ctx.shell / ripgrep / tools │
132
+ │ ▼ │
133
+ │ host 半:连接池、工作区 stub、回环 API │
134
+ └────────┬────────────────────────────────────────────────────────────────┘
135
+ │ SSH(ssh2):exec 通道 · SFTP · PTY · 端口转发
136
+ ▼
137
+ 远端机器:只需要 sshd(Linux / macOS)
138
+ ```
139
+
140
+ 远程工作区是 `<DSH_HOME>/remote-deck/workspaces` 下带标记文件的目录,标记记录连接 id 和远端
141
+ POSIX 路径。落在标记目录下的路径走 SFTP;命令走带远端 cwd 的 exec 通道;ripgrep 移到远端;
142
+ 终端是一条 PTY;每个转发是一个本地监听。
143
+
144
+ ### 远端 bash 行为
145
+
146
+ - 每次调用都会注册成 DSH 后台 job。前台等待默认 10 分钟
147
+ (`DSH_REMOTE_DECK_FOREGROUND_TIMEOUT_MS`);超时后命令**继续在后台运行**,工具返回 job id,
148
+ **不会杀进程**。用内置 `job_output` / `job_list` 跟进,用 `job_kill` 停止。
149
+ - `run_in_background: true` 立即返回 job id,适合常驻服务与长时间验收。
150
+ - 远端 stdin 立即关闭:需要交互输入的命令(例如没带 `PGPASSWORD` 的 `psql`)会快速返回自己的
151
+ 错误,而不是把整个 turn 挂死。
152
+ - 工作目录严格:相对路径相对会话工作区解析;目录不存在直接报错,不再静默回退到 home。
153
+ - 每个流输出上限 4 MiB(`DSH_REMOTE_DECK_MAX_OUTPUT_BYTES`),超出标记
154
+ `[output truncated; …]`。
155
+ - 停止工具或 `job_kill` 会向记录的远端 pid 发 TERM→KILL;`setsid`/双 fork 脱离的孙进程可能
156
+ 残留,这类命令请自己加 `timeout`。
157
+
158
+ ## 安全
159
+
160
+ - 远端命令在 SSH 主机上执行,不经过本地 DSH 沙箱/审批层;远端账号就是执行边界。对不可信仓库请
161
+ 在连接记录里固定 `hostKeyFingerprint`,并使用受限账号。
162
+ - 远端工作区暂不支持 `apply_patch`,请用 `edit`/`write`。
163
+ - 远程会话把 POSIX 路径路由到 SSH 主机、把盘符/反斜杠路径(`C:\\...`、`E:\\...`)
164
+ 路由到本机,远程开发仍然可以使用 Windows 本机文件与资源;两边都可访问,请留意来自
165
+ 遥测/远端内容的路径指令。
166
+ - 本地回环 API 只对本地 DSH 源反射 CORS;`/local/download` 限定在工作区、Remote Deck 数据与
167
+ attachments 目录。
168
+
169
+ - 密码、私钥口令存 DSH 凭据库,不写进 `connections.json`。
170
+ - 浏览器半通过带回环 token 的本地 HTTP 与 host 通信;终端与转发接口同样受 token 保护。
171
+ - 移除工作区只取消本地注册,插件从不删除远端文件。
172
+
173
+ ## 要求
174
+
175
+ - DSH 桌面版 0.2.x 及以上;Node 20+。
176
+ - 远端有 `sshd`,支持 Linux / macOS,远端 shell 为 `bash`。
177
+
178
+ ## 已知限制
179
+
180
+ - 远端后台作业(`remote_job`)的记录不跨 DSH 重启保留;远端进程本身仍在运行。
181
+ - 终端内置 xterm.js(颜色、光标、全屏程序);如果资产加载被拦截,会回退为纯文本行渲染。
182
+ - 界面目前中文优先,英文文案在 v1.1.0。
183
+ - `~/.ssh/config` 导入覆盖 Host/HostName/Port/User/IdentityFile/ProxyJump;代理命令与
184
+ known_hosts 固定还没接进连接对话框。
185
+ - 自动端口发现依赖 `ss` 或 `netstat`;手动转发不受影响。
186
+
187
+ ## 开发
188
+
189
+ ```sh
190
+ npm run check # 语法 + manifest
191
+ npm test # 解析器单元测试
192
+ npm run pack:dry # 查看发布文件清单
193
+ ```
194
+
195
+ 脱敏后的设计稿与渲染截图在 `docs/design/v2/`,验收结果记录在 CHANGELOG。
196
+ 版本计划见 [ROADMAP.md](ROADMAP.md),发布步骤见 [PUBLISH.md](PUBLISH.md),
197
+ 日常迭代与故障处理见 [docs/MAINTENANCE.md](docs/MAINTENANCE.md)。
198
+
199
+ ## 许可证
200
+
201
+ MIT