ssh-mcp 2.0.2 → 2.0.3
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/build/ssh/connection.js +19 -6
- package/package.json +1 -1
package/build/ssh/connection.js
CHANGED
|
@@ -28,12 +28,25 @@ export class SSHConnection {
|
|
|
28
28
|
this.sessions = new SessionManager({
|
|
29
29
|
// Live read: the profile object can be replaced after construction.
|
|
30
30
|
profile: () => this.profile,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
// ensureConnected inside the callback, not just before the retry: these
|
|
32
|
+
// run under openWithRetry, and Dropbear drops the whole connection under
|
|
33
|
+
// channel churn rather than merely refusing the channel. openSession does
|
|
34
|
+
// check the link first, but the link can die between that check and the
|
|
35
|
+
// channel opening — and then every retry reached getClient() on a dead
|
|
36
|
+
// client and threw the same "SSH connection not established", so the retry
|
|
37
|
+
// re-ran a corpse three times. SftpClient already did it this way.
|
|
38
|
+
openShell: async () => {
|
|
39
|
+
await this.ensureConnected();
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
this.getClient().shell({ term: 'xterm-256color', cols: 200, rows: 50 }, (err, stream) => (err ? reject(err) : resolve(stream)));
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
openExec: async (command) => {
|
|
45
|
+
await this.ensureConnected();
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
this.getClient().exec(this.applyWorkdir(command), (err, stream) => (err ? reject(err) : resolve(stream)));
|
|
48
|
+
});
|
|
49
|
+
},
|
|
37
50
|
onChannelOpened: () => { this.activeChannels++; },
|
|
38
51
|
onChannelClosed: () => { this.activeChannels--; },
|
|
39
52
|
});
|
package/package.json
CHANGED