@fish-under-sea/dsh-ssh-fish 0.0.0-stage → 0.5.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 (80) hide show
  1. package/LICENSE +202 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +98 -2
  4. package/README.zh.md +99 -0
  5. package/cordis.patch.yml +12 -0
  6. package/icon.svg +3 -0
  7. package/lib/client.js +16487 -0
  8. package/lib/client.js.map +1 -0
  9. package/lib/index.js +3511 -0
  10. package/lib/types/client/api.d.ts +141 -0
  11. package/lib/types/client/index.d.ts +37 -0
  12. package/lib/types/client/locales.d.ts +164 -0
  13. package/lib/types/client/native-panel.d.ts +70 -0
  14. package/lib/types/client/panel/ClusterTab.d.ts +7 -0
  15. package/lib/types/client/panel/HostFormDialog.d.ts +12 -0
  16. package/lib/types/client/panel/HostsTab.d.ts +25 -0
  17. package/lib/types/client/panel/SshPanel.d.ts +14 -0
  18. package/lib/types/client/panel/TerminalTab.d.ts +22 -0
  19. package/lib/types/client/panel/TransferTab.d.ts +7 -0
  20. package/lib/types/client/panel/TunnelsTab.d.ts +19 -0
  21. package/lib/types/client/panel/controller.d.ts +89 -0
  22. package/lib/types/client/panel/helpers.d.ts +45 -0
  23. package/lib/types/client/panel/xterm.css.d.ts +2 -0
  24. package/lib/types/client/settings-binding.d.ts +61 -0
  25. package/lib/types/dsh-home.d.ts +16 -0
  26. package/lib/types/engine/cluster.d.ts +19 -0
  27. package/lib/types/engine/connection-pool.d.ts +112 -0
  28. package/lib/types/engine/proxy-command.d.ts +36 -0
  29. package/lib/types/engine/pty.d.ts +32 -0
  30. package/lib/types/engine/sftp.d.ts +20 -0
  31. package/lib/types/engine/terminal-sessions.d.ts +67 -0
  32. package/lib/types/engine/tunnel.d.ts +36 -0
  33. package/lib/types/engine.d.ts +89 -0
  34. package/lib/types/http.d.ts +59 -0
  35. package/lib/types/index.d.ts +83 -0
  36. package/lib/types/loopback.d.ts +24 -0
  37. package/lib/types/mount-once.d.ts +55 -0
  38. package/lib/types/protocol.d.ts +239 -0
  39. package/lib/types/routes.d.ts +33 -0
  40. package/lib/types/ssh-config.d.ts +34 -0
  41. package/lib/types/store.d.ts +71 -0
  42. package/lib/types/tool-surface.d.ts +71 -0
  43. package/lib/types/tools.d.ts +42 -0
  44. package/package.json +106 -4
  45. package/src/client/api.ts +562 -0
  46. package/src/client/css-modules.d.ts +5 -0
  47. package/src/client/index.ts +137 -0
  48. package/src/client/locales.ts +338 -0
  49. package/src/client/native-panel.tsx +141 -0
  50. package/src/client/panel/ClusterTab.tsx +123 -0
  51. package/src/client/panel/HostFormDialog.tsx +258 -0
  52. package/src/client/panel/HostsTab.tsx +325 -0
  53. package/src/client/panel/SshPanel.tsx +90 -0
  54. package/src/client/panel/TerminalTab.tsx +330 -0
  55. package/src/client/panel/TransferTab.tsx +232 -0
  56. package/src/client/panel/TunnelsTab.tsx +244 -0
  57. package/src/client/panel/controller.ts +167 -0
  58. package/src/client/panel/helpers.ts +84 -0
  59. package/src/client/panel/panel.module.css +876 -0
  60. package/src/client/panel/xterm.css.ts +2 -0
  61. package/src/client/settings-binding.ts +165 -0
  62. package/src/dsh-home.ts +42 -0
  63. package/src/engine/cluster.ts +60 -0
  64. package/src/engine/connection-pool.ts +543 -0
  65. package/src/engine/proxy-command.ts +248 -0
  66. package/src/engine/pty.ts +78 -0
  67. package/src/engine/sftp.ts +226 -0
  68. package/src/engine/terminal-sessions.ts +280 -0
  69. package/src/engine/tunnel.ts +194 -0
  70. package/src/engine.ts +176 -0
  71. package/src/http.ts +127 -0
  72. package/src/index.ts +234 -0
  73. package/src/loopback.ts +63 -0
  74. package/src/mount-once.ts +142 -0
  75. package/src/protocol.ts +230 -0
  76. package/src/routes.ts +494 -0
  77. package/src/ssh-config.ts +153 -0
  78. package/src/store.ts +419 -0
  79. package/src/tool-surface.ts +95 -0
  80. package/src/tools.ts +404 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ # Bilingual-pair consistency record (docs/i18n.md): the git blob hash of each
2
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
+ # after editing either side, bring the other along and re-record with:
4
+ # node scripts/verify-docs.mjs --write <dir>
5
+ README.md: 9031d9df52f51011cc951cba61665da91b42c65b
6
+ README.zh.md: ddae66eb2e06138a8c9157dcfd07da00acdba0f1
package/README.md CHANGED
@@ -1,3 +1,99 @@
1
- # Temporary Holding Version
1
+ # dsh-ssh · Web SSH Terminal, SFTP Transfer & Remote Operations for DeepSeek Harness (DSH)
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
+ English | [中文](README.zh.md)
4
+
5
+ <p align="center">
6
+ <img src="https://img.shields.io/npm/v/@fish-under-sea/dsh-ssh-fish?style=flat-square" alt="Version">
7
+ &nbsp;
8
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.0--rc.2-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
9
+ &nbsp;
10
+ <img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
11
+ </p>
12
+
13
+ <p align="center">
14
+ <strong>Remote Linux Server Operations & Web SSH Suite for DeepSeek Harness (DSH)</strong><br>
15
+ <em>xterm.js Web Terminal · Visual SFTP Transfer · Port Forwarding Tunnels · Cluster Execution · 6 Agent Tools</em>
16
+ </p>
17
+
18
+ A dedicated remote Linux server operations and cluster management plugin for DeepSeek Harness (DSH) Web GUI and official desktop client: in-process persistent connection pool, Web GUI host inventory management, xterm.js terminal, visual SFTP file transfer, port forwarding tunnels, and 6 dedicated agent tools implemented on top of official NPM SDKs without modifying DSH core source code.
19
+
20
+ ## Capabilities
21
+
22
+ | Capability | Description |
23
+ | --- | --- |
24
+ | Host management | CRUD, search, connection test; collapsible grouping by environment / tags with per-group batch test; config stored in `~/.dsh/dsh-ssh.json`; supports key / password / ssh-agent auth (OpenSSH agent / Pageant), passphrase keys, ProxyJump jump hosts (multi-level) and OpenSSH `ProxyCommand` transports (bastion clients) |
25
+ | Config import | One-click parse of a standard `~/.ssh/config` (Host/HostName/User/Port/IdentityFile/IdentityAgent/ProxyJump/ProxyCommand, `Include` files, blocks without HostName); skipped blocks are listed with their reason (wildcard pattern, existing alias, Match block, invalid fields) |
26
+ | Persistent connection pool | Reuses a long-lived connection per host (opposite of the ssh-skill daemon), automatically disconnects after 30 minutes idle, auto-reconnects on disconnect (up to 3 times) |
27
+ | Command execution | exec with a timeout (default 60s), stdout/stderr separated, output truncation guard (2MB) |
28
+ | Web terminal | xterm.js + WebSocket PTY terminal, auto-sizing, real-time output |
29
+ | File transfer | SFTP upload (browser file picker, NDJSON progress stream), download (progress bar + browser save); remote directory browsing |
30
+ | Port forwarding | Local port-forward tunnel (listens on 127.0.0.1 only) to reach a remote database / intranet service; list / stop supported |
31
+ | Cluster execution | One command run concurrently across many hosts (filter by alias / environment / tag, default concurrency 8) |
32
+ | Agent tools | `ssh_list` / `ssh_exec` / `ssh_upload` / `ssh_download` / `ssh_tunnel` / `ssh_cluster`; GUI and Agent share the same host config |
33
+
34
+ The panel loads its contents on first open. Closing and reopening it preserves the selected tab, form drafts and terminal session. The tunnel list refreshes every five seconds while its tab, panel and browser page are visible; automatic reads pause when hidden, resume immediately on return, and do not overlap slow reads. Port forwarding itself continues in the Host.
35
+
36
+ ## Security model
37
+
38
+ - All `/api/dsh-ssh/*` routes are loopback-only (with same-origin checks) — the interfaces that execute commands against remote servers are not exposed to the LAN.
39
+ - Passwords / key passphrases are stored in plain text in `~/.dsh/dsh-ssh.json`, file mode 0600, directory 0700 (the same trust model as ssh-skill writing passwords into ssh-config comments).
40
+ - ssh-agent auth stores only the agent socket path (or the special value `pageant`); it never reads or stores private-key material.
41
+ - Tunnels only listen on `127.0.0.1`.
42
+ - Deleting a host or changing its connection fields (host / port / user / auth / proxyJump / proxyCommand) immediately closes that alias's pooled connection and tunnels; later operations reconnect with the new configuration and never reuse a connection authenticated with the old credentials.
43
+ - When the SSH connection behind a tunnel drops, the tunnel retires itself: the local port stops accepting, the tunnel leaves the list, and the connection that arrives during the drop is closed without traffic instead of interrupting the host process.
44
+ - A `proxyCommand` value is a shell command executed by the DSH host process with its privileges — exactly the trust `ssh(1)` gives the same line in `~/.ssh/config`. It can only come from the user's own 0600 store file: the Agent cannot create or edit hosts, and `ssh_list` reports only whether a host has one, never the command text.
45
+ - Before the Agent uses a tool, the host must first be configured in the GUI (or imported from ~/.ssh/config).
46
+ - `ssh_upload` / `ssh_download` read/write arbitrary local paths on this machine with host-process privileges (not through the bash sandbox) — same host-local-path semantics as ssh-skill, be aware of that permission surface.
47
+ - Agent transfer tools move files only between this machine and a remote SSH host; local-file reads and writes must use the local file tools (read / write / edit / bash), never the `ssh_*` tools.
48
+ - The remote output of exec / cluster is returned verbatim (not sanitized); a command like `env` may bring secrets from the remote environment back into the conversation log.
49
+
50
+ ## Install
51
+
52
+ Install the family aggregate package `@fish-under-sea/dsh-web-all` (all plugins and skins in one) or this plugin alone:
53
+
54
+ ```sh
55
+ ### From npm (recommended)
56
+ dsh plugin --profile web add @fish-under-sea/dsh-ssh-fish@latest
57
+
58
+ ### From the repository (development)
59
+ git clone https://github.com/zhu1090093659/dsh-web.git
60
+ cd dsh-web
61
+ pnpm install && pnpm -r build
62
+ dsh plugin --profile web add link:$(pwd)/packages/dsh-ssh
63
+
64
+ ```
65
+
66
+ After installing, **restart `dsh web`**: a "SSH" entry appears in the sidebar; the plugin description is injected into the Agent prompt automatically.
67
+
68
+ ## Configuration
69
+
70
+ The settings panel (plugin config) toggles `announceToAgent` (whether to announce the plugin to the Agent; off by default so system prompts stay clean) and `enabled` (master switch), and sets `terminalFontFamily` (the web terminal font; empty defers to the CSS chain: `--dsh-ssh-terminal-font` → the official `--ds-font-family-code` token → the built-in monospace stack). The terminal font is fixed in the xterm constructor, so a plain stylesheet cannot override it; to render powerline / Nerd Font glyphs, enter a Nerd Font stack here (e.g. `"SauceCodePro Nerd Font", monospace`). Changes re-apply to open terminals live, no reconnect needed.
71
+
72
+ ## Data
73
+
74
+ - Host config: `~/.dsh/dsh-ssh.json` (versioned JSON, atomic write)
75
+ - Transfer staging: `os.tmpdir()/dsh-ssh-uploads/` (0700 directory, 0600 in-flight files)
76
+
77
+ ## Development
78
+
79
+ ```sh
80
+ pnpm install --filter @fish-under-sea/dsh-ssh-fish...
81
+ pnpm --filter @fish-under-sea/dsh-ssh-fish test # unit tests: store + engine (embedded ssh2 Server + real sshd)
82
+ pnpm --filter @fish-under-sea/dsh-ssh-fish build # tsc types + tsdown dual-half artifacts
83
+ ```
84
+
85
+ ## Known limitations
86
+
87
+ - The remote target path of an upload must be an absolute path (relative paths are rejected).
88
+ - Download does not support a whole directory yet (download files individually); upload supports recursive directories (walks the local directory and transfers file by file).
89
+ - exec auto-reconnect on disconnect (up to 3 times) may re-execute non-idempotent commands — watch out for side effects on long commands.
90
+ - A ProxyJump hop is either a host alias configured in this plugin or an OpenSSH `[user@]host[:port]` address; an address hop has no stored credentials, so it reuses the target host's authentication (configure a host entry when the hop needs its own).
91
+ - `proxyCommand` and `proxyJump` cannot be combined on one host (OpenSSH resolves them by "whichever appears first in the config"; a stored entry has no order, so the plugin rejects the pair), and only the first hop of a chain may declare a ProxyCommand.
92
+ - A ProxyCommand is executed through the user's shell, so it inherits the DSH process's `PATH` and environment. On Windows the shell is killed without its process group, so a client it spawned may outlive the transport.
93
+ - The ssh_config import expands `Include` (globs, `~`, several pathnames, relative to the config directory) but not environment variables or `%` tokens, and a multi-pattern `Host a b` line still imports only its first pattern.
94
+ - Resume (broken-transfer continuation) is not implemented yet.
95
+ - The transfer of Agent tools is a host-machine local path (same semantics as ssh-skill).
96
+
97
+ ## Telemetry
98
+
99
+ The browser half sends one anonymous install heartbeat per UTC day to dsh-market.com: a random localStorage id plus this package's name, nothing else. The server stores only a salted hash of that id, never IP addresses, and exposes aggregate counts only. See [docs/telemetry.md](../../docs/telemetry.md) for the full contract.
package/README.zh.md ADDED
@@ -0,0 +1,99 @@
1
+ # dsh-ssh · DeepSeek Harness (DSH) 网页版 SSH 终端、SFTP 文件传输与集群运维插件
2
+
3
+ [English](README.md) | 中文
4
+
5
+ <p align="center">
6
+ <img src="https://img.shields.io/npm/v/@fish-under-sea/dsh-ssh-fish?style=flat-square" alt="Version">
7
+ &nbsp;
8
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.0--rc.2-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
9
+ &nbsp;
10
+ <img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
11
+ </p>
12
+
13
+ <p align="center">
14
+ <strong>DeepSeek Harness(DSH)官方 Web GUI 与桌面客户端专属远程 Linux 服务器运维套件</strong><br>
15
+ <em>xterm.js Web 终端 · 可视化 SFTP 传输 · 本地端口转发隧道 · 集群并发命令 · 6 大 Agent 工具</em>
16
+ </p>
17
+
18
+ 专为 DeepSeek Harness(DSH)Web GUI 与官方桌面客户端定制的远程 Linux 服务器运维与集群管理插件:Host 进程内的持久连接池 + Web GUI 主机管理面板 + 基于 xterm.js 的 Web 终端 + 可视化 SFTP 传输 + 6 大专用 Agent 工具,全部通过官方 NPM SDK 实现,零修改侵入 DSH 官方源码。
19
+
20
+ ## 能力
21
+
22
+ | 能力 | 说明 |
23
+ | --- | --- |
24
+ | 主机管理 | 增删改查、搜索、连接测试;支持按环境 / 标签分组折叠与组内批量测试;配置存 `~/.dsh/dsh-ssh.json`;支持密钥 / 密码 / ssh-agent 认证(OpenSSH agent / Pageant)、passphrase 密钥、ProxyJump 跳板机(多级)与 OpenSSH `ProxyCommand` 传输层(堡垒机客户端场景) |
25
+ | 配置导入 | 一键解析标准 `~/.ssh/config`(Host/HostName/User/Port/IdentityFile/IdentityAgent/ProxyJump/ProxyCommand、`Include` 文件、无 HostName 的块);被跳过的块逐条列出原因(通配符 pattern、别名已存在、Match 条件块、字段不合法) |
26
+ | 持久连接池 | 每台主机复用长连接(对应 ssh-skill 的守护进程),空闲 30 分钟自动断开,断线自动重连(最多 3 次) |
27
+ | 命令执行 | exec 带超时(默认 60s),stdout/stderr 分离,输出截断保护(2MB) |
28
+ | Web 终端 | xterm.js + WebSocket PTY 终端,自适应尺寸,实时输出 |
29
+ | 文件传输 | SFTP 上传(浏览器选文件,NDJSON 进度流)、下载(进度条 + 浏览器保存);远程目录浏览 |
30
+ | 端口转发 | 本地端口转发隧道(仅监听 127.0.0.1),访问远程数据库 / 内网服务,支持列表 / 停止 |
31
+ | 集群执行 | 一条命令并发跑多台主机(按别名 / 环境 / 标签过滤,默认并发 8) |
32
+ | Agent 工具 | `ssh_list` / `ssh_exec` / `ssh_upload` / `ssh_download` / `ssh_tunnel` / `ssh_cluster`,GUI 与 Agent 共享同一份主机配置 |
33
+
34
+ 面板在首次打开时加载内容。关闭后重新打开会保留选中的页签、表单草稿和终端会话。隧道列表仅在隧道页签、面板和浏览器页面都可见时每五秒刷新;隐藏时暂停自动查询,恢复可见时立即刷新,慢查询期间不叠加请求。端口转发本身继续在 Host 中运行。
35
+
36
+ ## 安全模型
37
+
38
+ - 所有 `/api/dsh-ssh/*` 路由仅限 loopback 访问(含同源校验)——对远程服务器执行命令的接口不会暴露给局域网。
39
+ - 密码 / 密钥口令以明文保存在 `~/.dsh/dsh-ssh.json`,文件权限 0600、目录 0700(与 ssh-skill 把密码写进 ssh-config 注释同一信任模型)。
40
+ - ssh-agent 认证仅保存 agent socket 路径(或 `pageant` 特殊值),不读取也不保存任何私钥材料。
41
+ - 隧道只监听 `127.0.0.1`。
42
+ - 删除主机或修改其连接字段(host / port / user / auth / proxyJump / proxyCommand)会立即断开该别名的池化连接与隧道,后续操作按新配置重新建连,不会复用旧凭据的已认证连接。
43
+ - 隧道背后的 SSH 连接一旦断开,隧道会自行退役:本地端口不再接受连接,隧道从列表中消失;断开期间到达的连接被直接关闭且没有流量,不会打断宿主进程。
44
+ - `proxyCommand` 是一条由 DSH 宿主进程以其自身权限执行的 shell 命令——与 `ssh(1)` 执行 `~/.ssh/config` 里同一行的信任模型一致。它只能来自用户自己的 0600 配置文件:Agent 无法创建或修改主机,`ssh_list` 只报告该主机是否配置了 ProxyCommand,不返回命令原文。
45
+ - Agent 使用工具前,主机需先在 GUI 中配置(或从 ~/.ssh/config 导入)。
46
+ - `ssh_upload` / `ssh_download` 以宿主进程权限直接读写本机任意路径(不经 bash 沙箱)——与 ssh-skill 的宿主本地路径语义一致,注意该权限面。
47
+ - Agent 传输工具只在本机与远程 SSH 主机之间移动文件;本机文件的读写一律使用本地文件工具(read / write / edit / bash),不要使用 `ssh_*` 工具。
48
+ - exec / cluster 的远程输出原样返回(不脱敏),命令如 `env` 可能把远端环境中的密钥带回对话记录。
49
+
50
+ ## 安装
51
+
52
+ 推荐直接安装全家桶聚合包 `@fish-under-sea/dsh-web-all`(一个包装齐全部功能插件与皮肤),或单独安装本插件:
53
+
54
+ ```sh
55
+ ### 从 npm 安装(推荐)
56
+ dsh plugin --profile web add @fish-under-sea/dsh-ssh-fish@latest
57
+
58
+ ### 从仓库安装(开发调试)
59
+ git clone https://github.com/zhu1090093659/dsh-web.git
60
+ cd dsh-web
61
+ pnpm install && pnpm -r build
62
+ dsh plugin --profile web add link:$(pwd)/packages/dsh-ssh
63
+
64
+ ```
65
+
66
+ 安装后**重启 `dsh web`**:侧边栏出现「SSH」入口;Agent 提示词中自动出现插件说明。
67
+
68
+ ## 配置
69
+
70
+ 设置面板(插件配置)可开关 `announceToAgent`(是否向 Agent 宣告插件;默认关闭,保持系统提示词干净)与 `enabled`(总开关),并可设置 `terminalFontFamily`(Web 终端字体,留空则按 CSS 链解析:`--dsh-ssh-terminal-font` → 官方 `--ds-font-family-code` token → 内置 monospace 栈)。终端字体写死在 xterm 构造参数里,CSS 无法直接覆盖;要渲染 powerline / Nerd Font 图标,请在此填入对应 Nerd Font 栈(如 `"SauceCodePro Nerd Font", monospace`),修改对已打开的终端即时生效,无需重连。
71
+
72
+ ## 数据
73
+
74
+ - 主机配置:`~/.dsh/dsh-ssh.json`(版本化 JSON,原子写入)
75
+ - 传输暂存:`os.tmpdir()/dsh-ssh-uploads/`(目录 0700,传输中的文件 0600)
76
+
77
+ ## 开发
78
+
79
+ ```sh
80
+ pnpm install --filter @fish-under-sea/dsh-ssh-fish...
81
+ pnpm --filter @fish-under-sea/dsh-ssh-fish test # 单测:store + 引擎(内嵌 ssh2 Server + 真实 sshd)
82
+ pnpm --filter @fish-under-sea/dsh-ssh-fish build # tsc 类型 + tsdown 双半区产物
83
+ ```
84
+
85
+ ## 已知限制
86
+
87
+ - 上传的远程目标路径必须是绝对路径(相对路径会被拒绝)。
88
+ - 下载暂不支持整个目录(逐文件下载);上传支持目录递归(walk 本地目录逐文件传)。
89
+ - exec 断线自动重连(最多 3 次)可能重复执行非幂等命令——长命令注意副作用。
90
+ - 跳板机 ProxyJump 的每一跳可以是本插件已配置的主机别名,也可以是 OpenSSH 的 `[user@]host[:port]` 地址;地址形式的跳板没有自己的凭据,复用目标主机的认证(跳板需要独立凭据时请单独配置主机)。
91
+ - 同一台主机不能同时配置 `proxyCommand` 与 `proxyJump`(OpenSSH 按「配置中先出现者生效」解析,而存储条目没有先后顺序,因此直接报错),且链式跳板中只有第一跳可以声明 ProxyCommand。
92
+ - ProxyCommand 由用户 shell 执行,因此继承 DSH 进程的 `PATH` 与环境变量。Windows 上只杀 shell、不带进程组,它拉起的客户端进程可能比传输层存活更久。
93
+ - ssh_config 导入会展开 `Include`(glob、`~`、多路径、相对配置目录),但不支持环境变量与 `%` token;`Host a b` 这类多 pattern 行仍只导入第一个 pattern。
94
+ - 断点续传(resume)暂未实现。
95
+ - Agent 工具的传输为宿主机器本地路径(与 ssh-skill 相同的语义)。
96
+
97
+ ## 数据遥测
98
+
99
+ 浏览器半区每个 UTC 日向 dsh-market.com 发送一次匿名安装心跳:仅含一个 localStorage 随机 ID 与本包名,无其他数据。服务端只存储该 ID 的加盐哈希,不存 IP,且只暴露聚合计数。完整契约见 [docs/telemetry.md](../../docs/telemetry.md)。
@@ -0,0 +1,12 @@
1
+ # dsh-ssh bundle patch: inserts the dual-face plugin row into the web
2
+ # profile roster. Applied as a profile bundle layer (the `dsh.bundle.patch`
3
+ # manifest field) over dsh-base; activate with
4
+ # `dsh plugin --profile <name> add link:~/code/dsh-web-ui/packages/dsh-ssh`.
5
+ #
6
+ # The row is a bare plugin by package name: the node half (exports ".") runs
7
+ # in the host process (SSH engine, /api/dsh-ssh routes, agent tools), and the
8
+ # `dsh.client` declaration in package.json makes the browser half
9
+ # (exports "./client", served at /plugins/<id>/client.js) load in the web GUI.
10
+ - insert:
11
+ - id: ssh
12
+ name: '@fish-under-sea/dsh-ssh-fish'
package/icon.svg ADDED
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
2
+ <path fill="#4d6bfe" fill-rule="evenodd" d="M 67.5 120 L 70.5 120 L 72.5 121 L 80.5 129 L 81.5 129 L 84.5 132 L 85.5 132 L 90.5 136 L 93.5 137 L 95.5 139 L 101.5 142 L 103.5 142 L 106.5 144 L 111.5 145 L 112.5 146 L 115.5 146 L 119.5 148 Q 122.75 147.25 123.5 149 L 127.5 149 L 128.5 150 L 133.5 150 L 134.5 151 L 140.5 151 L 141.5 152 L 150.5 152 L 151.5 153 L 160.5 153 L 161.5 154 L 171.5 154 L 172.5 155 L 178.5 155 L 179.5 156 Q 183.5 155 184.5 157 L 189.5 157 Q 190.5 159 194.5 158 L 195.5 159 L 197.5 159 L 198.5 160 L 200.5 160 L 201.5 161 L 206.5 162 L 209.5 164 L 211.5 164 L 219.5 168 L 224.5 172 L 227.5 173 L 247 191.5 L 247 192.5 L 253 199.5 L 255.5 204 L 258 201.5 L 263 193.5 L 272.5 183 L 273.5 183 L 280.5 176 L 281.5 176 L 292.5 168 L 300.5 164 L 302.5 164 L 305.5 162 L 307.5 162 L 308.5 161 L 310.5 161 L 314.5 159 L 317.5 159 L 318.5 158 Q 321.75 158.75 322.5 157 L 326.5 157 L 327.5 156 L 331.5 156 L 332.5 155 L 337.5 155 L 338.5 154 L 348.5 154 L 349.5 153 L 358.5 153 L 359.5 152 L 368.5 152 L 369.5 151 L 376.5 151 L 377.5 150 L 383.5 150 L 384.5 149 L 388.5 149 L 389.5 148 L 392.5 148 L 393.5 147 L 396.5 147 L 397.5 146 L 399.5 146 L 400.5 145 L 405.5 144 L 423.5 135 L 426.5 132 L 431.5 129 L 439.5 121 L 441.5 120 L 444.5 120 L 448 123.5 L 448 140.5 L 447 141.5 L 447 149.5 L 446 150.5 L 446 154.5 L 445 155.5 Q 445.75 158.75 444 159.5 L 444 163.5 Q 442.25 164.25 443 167.5 L 440 173.5 L 439 178.5 L 435 185.5 L 435 187.5 L 432 193.5 L 430 195.5 L 429 198.5 L 427 200.5 L 425 204.5 L 419 211.5 L 419 212.5 L 402.5 229 L 401.5 229 L 394.5 235 L 393.5 235 L 388.5 239 L 385.5 240 L 383.5 242 L 371.5 248 L 369.5 248 L 364.5 251 L 362.5 251 L 361.5 252 L 359.5 252 L 358.5 253 L 356.5 253 L 355.5 254 L 353.5 254 L 349.5 256 L 342.5 257 L 338.5 259 L 335.5 259 L 334.5 260 L 327.5 261 L 326.5 262 L 324.5 262 L 323.5 263 L 321.5 263 L 320.5 264 L 318.5 264 L 317.5 265 L 312.5 266 L 309.5 268 L 307.5 268 L 295.5 275 L 288 282.5 Q 287.5 286 285 287.5 Q 285.5 290 284 290.5 L 284 293.5 L 283 294.5 L 283 311.5 L 284 312.5 L 284 318.5 L 285 319.5 L 285 323.5 L 286 324.5 L 286 328.5 Q 288 329.5 287 333.5 L 288 334.5 L 288 337.5 L 289 338.5 L 289 341.5 L 290 342.5 L 290 345.5 L 291 346.5 L 292 353.5 L 293 354.5 L 293 356.5 L 295 360.5 L 295 363.5 L 296 364.5 L 296 367.5 L 297 368.5 L 297 370.5 L 298 371.5 L 298 373.5 L 299 374.5 L 299 376.5 L 301 380.5 L 301 386.5 L 298.5 389 L 294.5 391 Q 292 390.5 291.5 392 L 286.5 392 L 285.5 393 L 272.5 393 L 271.5 394 L 240.5 394 L 239.5 393 L 227.5 393 L 226.5 392 L 221.5 392 Q 220.75 390.25 217.5 391 L 212 387.5 L 211 385.5 L 211 381.5 L 212 380.5 Q 211.5 378 213 377.5 L 213 374.5 L 214 373.5 L 214 371.5 L 216 367.5 L 216 364.5 L 217 363.5 L 217 361.5 L 219 357.5 L 219 354.5 L 221 350.5 L 221 347.5 L 222 346.5 L 222 343.5 L 223 342.5 L 223 339.5 L 224 338.5 L 224 335.5 L 225 334.5 Q 224.25 331.25 226 330.5 L 226 326.5 L 227 325.5 Q 226 321.5 228 320.5 L 228 315.5 L 229 314.5 L 229 292.5 L 228 291.5 L 227 286.5 L 225 284.5 L 223 280.5 L 219.5 277 L 218.5 277 L 212.5 272 L 202.5 267 L 200.5 267 L 197.5 265 L 194.5 265 L 193.5 264 L 191.5 264 L 190.5 263 L 188.5 263 L 184.5 261 L 181.5 261 L 180.5 260 L 173.5 259 L 172.5 258 L 170.5 258 L 166.5 256 L 159.5 255 L 158.5 254 L 156.5 254 L 155.5 253 L 150.5 252 L 147.5 250 L 145.5 250 L 142.5 248 L 140.5 248 L 128.5 242 L 123.5 238 L 120.5 237 L 109.5 228 L 108.5 228 L 95 214.5 L 95 213.5 L 87 204.5 L 84 198.5 L 82 196.5 L 80 191.5 L 77 187.5 L 77 185.5 L 72 175.5 L 72 173.5 L 71 172.5 L 71 170.5 L 69 166.5 L 69 163.5 L 68 162.5 Q 68.75 159.25 67 158.5 L 67 154.5 L 66 153.5 L 66 148.5 L 65 147.5 L 65 139.5 L 64 138.5 L 64 124.5 L 67.5 120 Z"/>
3
+ </svg>