dsh-ssh-manage 0.3.8 → 0.3.9
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 +4 -4
- package/README.md +4 -4
- package/index.js +14 -25
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
`dsh-ssh-manage` is a Web plugin for [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness). It turns the hosts in `~/.ssh/config` into manageable objects in the DSH sidebar:
|
|
24
24
|
|
|
25
25
|
- **Host management** — scan the config, groups, tags, favorites, notes, latency and host inspection; SSH aliases are globally unique, so use the repeatable Display name for same names across groups;
|
|
26
|
-
- **DSH Agent integration** —
|
|
26
|
+
- **DSH Agent integration** — a compact host catalog (alias/group/display name) is injected into the DSH system prompt to keep token use low; full details come from list_hosts on demand, and the Agent uses `ssh_manager` directly for exec, batch commands, inspection and SFTP;
|
|
27
27
|
- **Interactive terminal** — ssh2 allocates a PTY, xterm.js renders it, with colors, arrow keys, full-screen programs such as `vim`/`top`, and window resizing;
|
|
28
28
|
- **Backup and migration** — export/import hosts, groups, tags, notes, favorites and passwords from Settings; exports are re-encrypted with a passphrase (scrypt + AES-256-GCM) and imports merge by alias;
|
|
29
29
|
- **Day-to-day operations** — batch commands, SFTP browse/mkdir/rename/delete/upload/download, connection tests;
|
|
@@ -98,16 +98,16 @@ Creating a host requires alias, hostname and password. The password is not writt
|
|
|
98
98
|
|
|
99
99
|
### From npm (recommended)
|
|
100
100
|
|
|
101
|
-
npm package: [`dsh-ssh-manage`](https://www.npmjs.com/package/dsh-ssh-manage) (current version `0.3.
|
|
101
|
+
npm package: [`dsh-ssh-manage`](https://www.npmjs.com/package/dsh-ssh-manage) (current version `0.3.9`).
|
|
102
102
|
|
|
103
103
|
```text
|
|
104
|
-
plugin_manager action=install_bundle target=dsh-ssh-manage@0.3.
|
|
104
|
+
plugin_manager action=install_bundle target=dsh-ssh-manage@0.3.9
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
Or with the DSH CLI:
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
|
-
dsh plugin add dsh-ssh-manage@0.3.
|
|
110
|
+
dsh plugin add dsh-ssh-manage@0.3.9
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
After installation, refresh the Web page; the sidebar shows an "SSH Hosts" entry with id `dsh-ssh-manage`.
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
`dsh-ssh-manage` 是 [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) 的 Web 插件。它把 `~/.ssh/config` 里的主机变成 DSH 侧边栏里可管理、可连接、可运维的对象:
|
|
24
24
|
|
|
25
25
|
- **主机管理**:扫描配置、分组、标签、收藏、备注、连接延迟、主机巡检;SSH 别名全局唯一,不同分组如需同名请使用可重复的“显示名称”;
|
|
26
|
-
- **DSH Agent
|
|
26
|
+
- **DSH Agent 集成**:向 DSH 系统提示注入精简主机目录(别名/分组/显示名),地址等详情由 `list_hosts` 按需获取以控制 token;Agent 可直接用 `ssh_manager` 执行命令、批量命令、巡检和 SFTP 操作;
|
|
27
27
|
- **交互式终端**:ssh2 分配 PTY,xterm.js 渲染,支持彩色输出、方向键、`vim`/`top` 等全屏程序和窗口自适应;
|
|
28
28
|
- **备份迁移**:设置页可导出/导入主机、分组、标签、备注、收藏和密码;导出文件用自定义口令二次加密(scrypt + AES-256-GCM),导入按别名合并;
|
|
29
29
|
- **日常运维**:批量命令、SFTP 目录浏览 / 新建 / 重命名 / 删除 / 上传 / 下载、测试连接;
|
|
@@ -100,16 +100,16 @@
|
|
|
100
100
|
|
|
101
101
|
### 从 npm 安装(推荐)
|
|
102
102
|
|
|
103
|
-
npm 包:[`dsh-ssh-manage`](https://www.npmjs.com/package/dsh-ssh-manage)(当前版本 `0.3.
|
|
103
|
+
npm 包:[`dsh-ssh-manage`](https://www.npmjs.com/package/dsh-ssh-manage)(当前版本 `0.3.9`)。
|
|
104
104
|
|
|
105
105
|
```text
|
|
106
|
-
plugin_manager action=install_bundle target=dsh-ssh-manage@0.3.
|
|
106
|
+
plugin_manager action=install_bundle target=dsh-ssh-manage@0.3.9
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
或使用 DSH CLI:
|
|
110
110
|
|
|
111
111
|
```bash
|
|
112
|
-
dsh plugin add dsh-ssh-manage@0.3.
|
|
112
|
+
dsh plugin add dsh-ssh-manage@0.3.9
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
安装后刷新 Web 页面,左侧栏会出现「SSH 主机」入口,入口 id 为 `dsh-ssh-manage`。
|
package/index.js
CHANGED
|
@@ -81,21 +81,13 @@ function errorMessage(error) {
|
|
|
81
81
|
let sshHostCatalogText = ''
|
|
82
82
|
let sshHostCatalogRefresh = null
|
|
83
83
|
|
|
84
|
-
function sshCatalogLine(host, metadata
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
`alias=${host.host}`,
|
|
92
|
-
`target=${user}${address}`,
|
|
93
|
-
`group=${group}`,
|
|
94
|
-
]
|
|
95
|
-
if (label && label !== host.host) parts.push(`display=${label}`)
|
|
96
|
-
if (tags.length) parts.push(`tags=${tags.slice(0, 4).join(',')}`)
|
|
97
|
-
parts.push(`password=${passwordSet.has(host.host) ? 'stored' : 'missing'}`)
|
|
98
|
-
return `- ${parts.join(' | ')}`
|
|
84
|
+
function sshCatalogLine(host, metadata) {
|
|
85
|
+
const group = String(metadata?.group || '').replace(/[\r\n]+/g, ' ').trim()
|
|
86
|
+
const label = String(metadata?.label || '').replace(/[\r\n"']+/g, ' ').trim()
|
|
87
|
+
let line = `- ${host.host}`
|
|
88
|
+
if (group) line += ` [${group}]`
|
|
89
|
+
if (label && label !== host.host) line += ` "${label.slice(0, 60)}"`
|
|
90
|
+
return line
|
|
99
91
|
}
|
|
100
92
|
|
|
101
93
|
/** Refresh the host catalog injected into the DSH system prompt. */
|
|
@@ -103,20 +95,17 @@ export async function refreshSshHostCatalog(paths) {
|
|
|
103
95
|
if (sshHostCatalogRefresh) return sshHostCatalogRefresh
|
|
104
96
|
sshHostCatalogRefresh = (async () => {
|
|
105
97
|
try {
|
|
106
|
-
const [{ hosts }, metadata
|
|
98
|
+
const [{ hosts }, metadata] = await Promise.all([
|
|
107
99
|
listSshHosts(paths),
|
|
108
100
|
loadMetadata(paths).catch(() => ({ entries: {} })),
|
|
109
|
-
listPasswordAliases(paths).catch(() => []),
|
|
110
101
|
])
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
if (hosts.length > 40) lines.push(`- ... ${hosts.length - 40} more hosts; call list_hosts for the full list`)
|
|
102
|
+
const lines = hosts.slice(0, 40).map((host) => sshCatalogLine(host, metadata.entries[host.host]))
|
|
103
|
+
if (hosts.length > 40) lines.push(`- ... ${hosts.length - 40} more; call list_hosts`)
|
|
114
104
|
sshHostCatalogText = [
|
|
115
|
-
'SSH hosts
|
|
116
|
-
'
|
|
117
|
-
'
|
|
118
|
-
|
|
119
|
-
].join('\n').slice(0, 6000)
|
|
105
|
+
'SSH hosts available through the dsh-ssh-manage ssh_manager tool. When the user asks to inspect, run commands on, upload to or download from one of these servers, call ssh_manager with the exact alias.',
|
|
106
|
+
'Call action=list_hosts for user/address/port/group/password status. Use exec {host, command}, batch_exec {hosts, command}, inspect_host/test_connection and sftp_* for operations. Passwords are never returned.',
|
|
107
|
+
lines.length ? lines.join('\n') : '- No hosts configured yet; add them in the dsh-ssh-manage sidebar panel.',
|
|
108
|
+
].join('\n').slice(0, 3000)
|
|
120
109
|
} catch {
|
|
121
110
|
sshHostCatalogText = 'SSH host catalog is temporarily unavailable; call ssh_manager action=list_hosts to read it.'
|
|
122
111
|
} finally {
|