@linxin666/dsh-ssh 0.4.17 → 0.4.19
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 +4 -4
- package/lib/client.js.map +1 -1
- package/lib/index.js +8 -8
- package/package.json +17 -17
- package/src/client/api.ts +3 -3
- package/src/engine/connection-pool.ts +1 -1
- package/src/routes.ts +11 -11
package/lib/index.js
CHANGED
|
@@ -997,7 +997,7 @@ async function connectChain(engine, entry, onKeyboardInteractive) {
|
|
|
997
997
|
try {
|
|
998
998
|
hopClient = await connectClient(buildConnectConfig(hop, hopSock, engine.opts), onKeyboardInteractive);
|
|
999
999
|
} catch (error) {
|
|
1000
|
-
throw new Error("proxyJump hop '" + spec + "' (" + hop.user + "@" + hop.host + ":" + hop.port + "): " + (error instanceof Error ? error.message : String(error)));
|
|
1000
|
+
throw new Error("proxyJump hop '" + spec + "' (" + hop.user + "@" + hop.host + ":" + hop.port + "): " + (error instanceof Error ? error.message : String(error)), { cause: error });
|
|
1001
1001
|
}
|
|
1002
1002
|
hops.push(hopClient);
|
|
1003
1003
|
const next = index + 1 < chain.length ? resolveHop(engine, entry, chain[index + 1]) : void 0;
|
|
@@ -2536,6 +2536,13 @@ function makeRoutes(deps) {
|
|
|
2536
2536
|
const tmp = join(staging, `upload-${randomBytes(6).toString("hex")}`);
|
|
2537
2537
|
const sink = createWriteStream(tmp, { mode: 384 });
|
|
2538
2538
|
let settled = false;
|
|
2539
|
+
const cleanup = () => {
|
|
2540
|
+
unlink(tmp).catch(() => void 0).finally(() => {
|
|
2541
|
+
try {
|
|
2542
|
+
res.end();
|
|
2543
|
+
} catch {}
|
|
2544
|
+
});
|
|
2545
|
+
};
|
|
2539
2546
|
const fail = (error) => {
|
|
2540
2547
|
if (settled) return;
|
|
2541
2548
|
settled = true;
|
|
@@ -2544,13 +2551,6 @@ function makeRoutes(deps) {
|
|
|
2544
2551
|
ok: false,
|
|
2545
2552
|
error: error instanceof Error ? error.message : String(error)
|
|
2546
2553
|
});
|
|
2547
|
-
const cleanup = () => {
|
|
2548
|
-
unlink(tmp).catch(() => void 0).finally(() => {
|
|
2549
|
-
try {
|
|
2550
|
-
res.end();
|
|
2551
|
-
} catch {}
|
|
2552
|
-
});
|
|
2553
|
-
};
|
|
2554
2554
|
if (sink.destroyed) cleanup();
|
|
2555
2555
|
else {
|
|
2556
2556
|
sink.once("close", cleanup);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-ssh",
|
|
3
3
|
"description": "Remote SSH operations for the dsh web GUI: host config store (~/.dsh/dsh-ssh.json, import from ~/.ssh/config), a persistent ssh2 connection pool with jump-host support, exec / PTY web terminal / SFTP transfer / local port-forward tunnels / cluster execution, plus agent tools (ssh_list, ssh_exec, ssh_upload, ssh_download, ssh_tunnel, ssh_cluster). Hot-pluggable — mounted via ~/.dsh/cordis.patch.yml + a profile node_modules symlink, no dsh source changes.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.19",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dsh": {
|
|
27
27
|
"engines": {
|
|
28
|
-
"dsh": ">=0.2.2-rc.
|
|
28
|
+
"dsh": ">=0.2.2-rc.3"
|
|
29
29
|
},
|
|
30
30
|
"bundle": {
|
|
31
31
|
"patch": "./cordis.patch.yml"
|
|
@@ -48,26 +48,26 @@
|
|
|
48
48
|
"ws": "^8.18.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@deepseek-ai/dsh": ">=0.2.2-rc.
|
|
51
|
+
"@deepseek-ai/dsh": ">=0.2.2-rc.3",
|
|
52
52
|
"react": "^18.2.0",
|
|
53
53
|
"react-dom": "^18.2.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@deepseek-ai/cordis": "^4.1.0",
|
|
57
|
-
"@deepseek-ai/dsh-client-connection": "^0.2.2-rc.
|
|
58
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.2-rc.
|
|
59
|
-
"@deepseek-ai/dsh-client-ui-layout": "^0.2.2-rc.
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.
|
|
61
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.
|
|
62
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "^0.2.2-rc.
|
|
63
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.
|
|
64
|
-
"@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.
|
|
65
|
-
"@deepseek-ai/dsh-llm": "^0.2.2-rc.
|
|
66
|
-
"@deepseek-ai/dsh-scope": "^0.2.2-rc.
|
|
67
|
-
"@deepseek-ai/dsh-settings": "^0.2.2-rc.
|
|
68
|
-
"@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.
|
|
69
|
-
"@deepseek-ai/dsh-timeout": "^0.2.2-rc.
|
|
70
|
-
"@deepseek-ai/dsh-tools": "^0.2.2-rc.
|
|
57
|
+
"@deepseek-ai/dsh-client-connection": "^0.2.2-rc.3",
|
|
58
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.2-rc.3",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-layout": "^0.2.2-rc.3",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.3",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.3",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.2.2-rc.3",
|
|
63
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.3",
|
|
64
|
+
"@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.3",
|
|
65
|
+
"@deepseek-ai/dsh-llm": "^0.2.2-rc.3",
|
|
66
|
+
"@deepseek-ai/dsh-scope": "^0.2.2-rc.3",
|
|
67
|
+
"@deepseek-ai/dsh-settings": "^0.2.2-rc.3",
|
|
68
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.3",
|
|
69
|
+
"@deepseek-ai/dsh-timeout": "^0.2.2-rc.3",
|
|
70
|
+
"@deepseek-ai/dsh-tools": "^0.2.2-rc.3",
|
|
71
71
|
"@types/node": "^22.20.0",
|
|
72
72
|
"@types/react": "~18.3.1",
|
|
73
73
|
"@types/react-dom": "^18.3.5",
|
package/src/client/api.ts
CHANGED
|
@@ -119,7 +119,7 @@ export function terminalSocketUrl(
|
|
|
119
119
|
search: string,
|
|
120
120
|
streamBaseUrl?: string | undefined,
|
|
121
121
|
): string | undefined {
|
|
122
|
-
if (WEB_PAGE_PROTOCOLS.
|
|
122
|
+
if (WEB_PAGE_PROTOCOLS.has(location.protocol)) {
|
|
123
123
|
const scheme = location.protocol === 'https:' ? 'wss' : 'ws'
|
|
124
124
|
return scheme + '://' + location.host + SSH_API.terminal + search
|
|
125
125
|
}
|
|
@@ -173,14 +173,14 @@ function transportStreamBaseUrl(
|
|
|
173
173
|
* an application on this machine, which is the same classification the remote
|
|
174
174
|
* channel and the update seat use (`isWebPageProtocol` / `isApplicationDeliveredPage`).
|
|
175
175
|
*/
|
|
176
|
-
const WEB_PAGE_PROTOCOLS:
|
|
176
|
+
const WEB_PAGE_PROTOCOLS: ReadonlySet<string> = new Set([
|
|
177
177
|
'http:',
|
|
178
178
|
'https:',
|
|
179
179
|
'blob:',
|
|
180
180
|
'data:',
|
|
181
181
|
'about:',
|
|
182
182
|
'filesystem:',
|
|
183
|
-
]
|
|
183
|
+
])
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
186
|
* A terminal connection that never opened: it reports one failure once the
|
|
@@ -386,7 +386,7 @@ export async function connectChain(
|
|
|
386
386
|
// Name the hop: an address hop (or a typo'd alias) must stay
|
|
387
387
|
// diagnosable from the error alone.
|
|
388
388
|
throw new Error('proxyJump hop \'' + spec + '\' (' + hop.user + '@' + hop.host + ':' + hop.port + '): '
|
|
389
|
-
+ (error instanceof Error ? error.message : String(error)))
|
|
389
|
+
+ (error instanceof Error ? error.message : String(error)), { cause: error })
|
|
390
390
|
}
|
|
391
391
|
hops.push(hopClient)
|
|
392
392
|
const next = index + 1 < chain.length ? resolveHop(engine, entry, chain[index + 1]) : undefined
|
package/src/routes.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
|
13
13
|
import { basename, join } from 'node:path'
|
|
14
14
|
import { tmpdir } from 'node:os'
|
|
15
15
|
import { randomBytes } from 'node:crypto'
|
|
16
|
-
import {
|
|
16
|
+
import { WebSocketServer } from 'ws'
|
|
17
17
|
import type { WebRoute, WebUpgradeRoute } from '@deepseek-ai/dsh-host-webserver'
|
|
18
18
|
import type { SshEngine } from './engine.ts'
|
|
19
19
|
import { TerminalSessionRegistry } from './engine/terminal-sessions.ts'
|
|
@@ -335,22 +335,22 @@ const maxUploadBytes = deps.maxUploadBytes ?? MAX_UPLOAD_BYTES
|
|
|
335
335
|
const tmp = join(staging, `upload-${randomBytes(6).toString('hex')}`)
|
|
336
336
|
const sink = createWriteStream(tmp, { mode: 0o600 })
|
|
337
337
|
let settled = false
|
|
338
|
+
// End the response only after the tmp file is gone, and unlink only
|
|
339
|
+
// after the sink is fully closed: destroying a WriteStream whose
|
|
340
|
+
// fs.open is still pending lets the open RE-CREATE the file after
|
|
341
|
+
// an early unlink, leaving staging populated (this raced the
|
|
342
|
+
// response end and made the byte-cap test flaky).
|
|
343
|
+
const cleanup = (): void => {
|
|
344
|
+
void unlink(tmp).catch(() => undefined).finally(() => {
|
|
345
|
+
try { res.end() } catch { /* closed */ }
|
|
346
|
+
})
|
|
347
|
+
}
|
|
338
348
|
// Every terminal path (sink error, client abort, response loss) must
|
|
339
349
|
// emit a result frame, end the response, and remove the tmp file.
|
|
340
350
|
const fail = (error: unknown): void => {
|
|
341
351
|
if (settled) return
|
|
342
352
|
settled = true
|
|
343
353
|
emit({ type: 'result', ok: false, error: error instanceof Error ? error.message : String(error) })
|
|
344
|
-
// End the response only after the tmp file is gone, and unlink only
|
|
345
|
-
// after the sink is fully closed: destroying a WriteStream whose
|
|
346
|
-
// fs.open is still pending lets the open RE-CREATE the file after
|
|
347
|
-
// an early unlink, leaving staging populated (this raced the
|
|
348
|
-
// response end and made the byte-cap test flaky).
|
|
349
|
-
const cleanup = (): void => {
|
|
350
|
-
void unlink(tmp).catch(() => undefined).finally(() => {
|
|
351
|
-
try { res.end() } catch { /* closed */ }
|
|
352
|
-
})
|
|
353
|
-
}
|
|
354
354
|
if (sink.destroyed) {
|
|
355
355
|
cleanup()
|
|
356
356
|
} else {
|