@linxin666/dsh-ssh 0.4.20 → 0.4.22
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 +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +261 -108
- package/lib/client.js.map +1 -1
- package/lib/index.js +648 -243
- package/lib/types/engine/cluster.d.ts +7 -2
- package/lib/types/engine/connection-pool.d.ts +11 -2
- package/lib/types/engine/sftp.d.ts +5 -0
- package/lib/types/engine/terminal-sessions.d.ts +5 -3
- package/lib/types/store.d.ts +0 -1
- package/package.json +20 -20
- package/src/client/api.ts +106 -52
- package/src/client/panel/HostFormDialog.tsx +5 -3
- package/src/client/panel/HostsTab.tsx +41 -16
- package/src/client/panel/TerminalTab.tsx +14 -9
- package/src/client/panel/TunnelsTab.tsx +24 -7
- package/src/client/panel/controller.ts +76 -11
- package/src/engine/cluster.ts +45 -13
- package/src/engine/connection-pool.ts +141 -15
- package/src/engine/proxy-command.ts +27 -10
- package/src/engine/sftp.ts +69 -35
- package/src/engine/terminal-sessions.ts +110 -35
- package/src/engine/tunnel.ts +20 -2
- package/src/engine.ts +4 -0
- package/src/index.ts +50 -42
- package/src/routes.ts +51 -13
- package/src/store.ts +227 -123
- package/src/tools.ts +3 -5
package/src/tools.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
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 { hasClusterSelector } from './engine/cluster.ts'
|
|
10
11
|
import type { ClusterResult, ExecResult, SshAuthKind, SshHostSummary, TunnelInfo } from './protocol.ts'
|
|
11
12
|
|
|
12
13
|
/** One text content block (the only render shape these tools emit). */
|
|
@@ -336,7 +337,7 @@ export function sshTunnelTool(engine: SshEngine) {
|
|
|
336
337
|
remoteHost: args.remoteHost,
|
|
337
338
|
localPort: args.localPort,
|
|
338
339
|
})
|
|
339
|
-
return { ok:
|
|
340
|
+
return { ok: tunnel.state !== 'failed', tunnel }
|
|
340
341
|
} catch (error) {
|
|
341
342
|
return { ok: false, tunnel: { id: '', alias: args.alias, localPort: 0, remoteHost: args.remoteHost ?? '127.0.0.1', remotePort: args.remotePort, state: 'failed' as const, error: error instanceof Error ? error.message : String(error), startedAt: Date.now() } }
|
|
342
343
|
}
|
|
@@ -398,10 +399,7 @@ export function sshClusterTool(engine: SshEngine) {
|
|
|
398
399
|
render: (_args, value: { results?: ClusterResult[] }) => text(renderCluster(value.results ?? [])),
|
|
399
400
|
},
|
|
400
401
|
async execute(args, exec) {
|
|
401
|
-
|
|
402
|
-
(typeof args.environment === 'string' && args.environment.trim() !== '') ||
|
|
403
|
-
(Array.isArray(args.tags) && args.tags.some((tag) => typeof tag === 'string' && tag.trim() !== ''))
|
|
404
|
-
if (!hasSelector) throw new Error('ssh_cluster requires aliases, environment, or tags to limit the target set')
|
|
402
|
+
if (!hasClusterSelector(args)) throw new Error('ssh_cluster requires aliases, environment, or tags to limit the target set')
|
|
405
403
|
// Cancellation reaches every host's in-flight command.
|
|
406
404
|
return { results: await engine.cluster({ ...args, signal: exec.signal }) }
|
|
407
405
|
},
|