@linxin666/dsh-ssh 0.3.19 → 0.3.21
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.i18n.yaml +2 -2
- package/README.md +10 -4
- package/README.zh.md +10 -4
- package/lib/client.js +252 -38
- package/lib/client.js.map +1 -1
- package/lib/index.js +504 -52
- package/lib/types/client/body-mutations.d.ts +45 -0
- package/lib/types/client/locales.d.ts +9 -1
- package/lib/types/client/panel/TunnelsTab.d.ts +4 -2
- package/lib/types/client/panel-mount-core.d.ts +1 -1
- package/lib/types/client/sidebar-entry-core.d.ts +0 -15
- package/lib/types/engine/connection-pool.d.ts +20 -0
- package/lib/types/engine/proxy-command.d.ts +36 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/protocol.d.ts +24 -2
- package/lib/types/ssh-config.d.ts +34 -0
- package/lib/types/store.d.ts +11 -3
- package/lib/types/tools.d.ts +24 -0
- package/package.json +14 -14
- package/src/client/body-mutations.ts +133 -0
- package/src/client/locales.ts +18 -2
- package/src/client/panel/HostFormDialog.tsx +15 -0
- package/src/client/panel/HostsTab.tsx +37 -2
- package/src/client/panel/SshPanel.tsx +6 -2
- package/src/client/panel/TunnelsTab.tsx +50 -10
- package/src/client/panel/panel.module.css +27 -0
- package/src/client/panel-mount-core.ts +21 -13
- package/src/client/sidebar-entry-core.ts +10 -7
- package/src/engine/connection-pool.ts +122 -10
- package/src/engine/proxy-command.ts +248 -0
- package/src/index.ts +1 -1
- package/src/protocol.ts +26 -2
- package/src/routes.ts +1 -1
- package/src/ssh-config.ts +153 -0
- package/src/store.ts +64 -40
- package/src/tools.ts +35 -5
package/src/tools.ts
CHANGED
|
@@ -7,15 +7,43 @@
|
|
|
7
7
|
import { defineTool } from '@deepseek-ai/dsh-tools'
|
|
8
8
|
import type { ContentBlock } from '@deepseek-ai/dsh-llm'
|
|
9
9
|
import type { SshEngine } from './engine.ts'
|
|
10
|
-
import type { ClusterResult, ExecResult, SshHostSummary, TunnelInfo } from './protocol.ts'
|
|
10
|
+
import type { ClusterResult, ExecResult, SshAuthKind, SshHostSummary, TunnelInfo } from './protocol.ts'
|
|
11
11
|
|
|
12
12
|
/** One text content block (the only render shape these tools emit). */
|
|
13
13
|
function text(value: string): ContentBlock[] {
|
|
14
14
|
return [{ type: 'text', text: value }]
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* One host row for the agent surface. The ProxyCommand STRING is deliberately
|
|
19
|
+
* projected to a boolean: the command may embed credentials for a bastion
|
|
20
|
+
* client, and the model only needs to know that the host goes through one.
|
|
21
|
+
*/
|
|
22
|
+
export interface AgentHostRow {
|
|
23
|
+
alias: string
|
|
24
|
+
host: string
|
|
25
|
+
port: number
|
|
26
|
+
user: string
|
|
27
|
+
auth: SshAuthKind
|
|
28
|
+
keyReady: boolean
|
|
29
|
+
proxyJump: string[]
|
|
30
|
+
proxyCommandConfigured: boolean
|
|
31
|
+
description?: string
|
|
32
|
+
environment?: string
|
|
33
|
+
tags: string[]
|
|
34
|
+
location?: string
|
|
35
|
+
createdAt: number
|
|
36
|
+
updatedAt: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Project one summary onto the agent-facing row shape. */
|
|
40
|
+
export function toAgentHostRow(host: SshHostSummary): AgentHostRow {
|
|
41
|
+
const { proxyCommand, ...rest } = host
|
|
42
|
+
return { ...rest, proxyCommandConfigured: proxyCommand !== undefined }
|
|
43
|
+
}
|
|
44
|
+
|
|
17
45
|
/** Host table render shared by list surfaces. */
|
|
18
|
-
function renderHosts(hosts:
|
|
46
|
+
function renderHosts(hosts: AgentHostRow[]): string {
|
|
19
47
|
if (hosts.length === 0) return 'no hosts configured'
|
|
20
48
|
const rows = hosts.map(host => [
|
|
21
49
|
host.alias,
|
|
@@ -23,11 +51,12 @@ function renderHosts(hosts: SshHostSummary[]): string {
|
|
|
23
51
|
String(host.port),
|
|
24
52
|
host.user,
|
|
25
53
|
host.auth,
|
|
54
|
+
host.proxyJump.length > 0 ? 'jump:' + host.proxyJump.join(',') : host.proxyCommandConfigured ? 'proxy-command' : '-',
|
|
26
55
|
host.environment ?? '-',
|
|
27
56
|
(host.tags.length > 0 ? host.tags.join(',') : '-'),
|
|
28
57
|
host.description ?? '',
|
|
29
58
|
].join(' | '))
|
|
30
|
-
return ['alias | host | port | user | auth | environment | tags | description', '--- | --- | --- | --- | --- | --- | --- | ---', ...rows].join('\n')
|
|
59
|
+
return ['alias | host | port | user | auth | proxy | environment | tags | description', '--- | --- | --- | --- | --- | --- | --- | --- | ---', ...rows].join('\n')
|
|
31
60
|
}
|
|
32
61
|
|
|
33
62
|
/** Render one exec result (mirrors the bash-tool exit-code convention). */
|
|
@@ -86,6 +115,7 @@ export function sshListTool(engine: SshEngine) {
|
|
|
86
115
|
auth: { type: 'string', enum: ['key', 'password', 'agent'], required: true },
|
|
87
116
|
keyReady: { type: 'boolean', required: true },
|
|
88
117
|
proxyJump: { type: 'array', items: { type: 'string' }, required: true },
|
|
118
|
+
proxyCommandConfigured: { type: 'boolean', required: true },
|
|
89
119
|
description: { type: 'string' },
|
|
90
120
|
environment: { type: 'string' },
|
|
91
121
|
tags: { type: 'array', items: { type: 'string' }, required: true },
|
|
@@ -97,10 +127,10 @@ export function sshListTool(engine: SshEngine) {
|
|
|
97
127
|
},
|
|
98
128
|
},
|
|
99
129
|
},
|
|
100
|
-
render: (_args, value: { hosts?:
|
|
130
|
+
render: (_args, value: { hosts?: AgentHostRow[] }) => text(renderHosts(value.hosts ?? [])),
|
|
101
131
|
},
|
|
102
132
|
async execute(args) {
|
|
103
|
-
return { hosts: engine.list(args.query) }
|
|
133
|
+
return { hosts: engine.list(args.query).map(toAgentHostRow) }
|
|
104
134
|
},
|
|
105
135
|
})
|
|
106
136
|
}
|