@akms/mcp-ssh 0.1.5 → 0.1.7

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/lib/index.cjs CHANGED
@@ -34,7 +34,7 @@ var SESSION_SWEEP_INTERVAL_MS = 6e4;
34
34
  var CWD_MARKER = "__AKMS_SSH_CWD__";
35
35
  var MAX_DIRECTORY_ENTRIES = 1e3;
36
36
  var SERVER_NAME = "akms-mcp-ssh";
37
- var SERVER_VERSION = "0.1.5";
37
+ var SERVER_VERSION = "0.1.7";
38
38
 
39
39
  // src/_defs/command-rules.ts
40
40
  var CRITICAL_PATH_PATTERN = new RegExp(
@@ -497,6 +497,10 @@ var LEVEL_WEIGHTS = {
497
497
  error: 4
498
498
  };
499
499
  var SECRET_META_KEYS = ["password", "passphrase", "privatekey", "privatekeypath", "secret", "token"];
500
+ var stderrBroken = false;
501
+ process.stderr.on("error", () => {
502
+ stderrBroken = true;
503
+ });
500
504
  function resolveThreshold() {
501
505
  const configured = process.env[LOG_LEVEL_ENV];
502
506
  if (configured == null) {
@@ -520,6 +524,9 @@ function maskMeta(meta) {
520
524
  return masked;
521
525
  }
522
526
  function write(level, message, meta) {
527
+ if (stderrBroken == true) {
528
+ return;
529
+ }
523
530
  const threshold = resolveThreshold();
524
531
  if (threshold === "silent") {
525
532
  return;
@@ -533,8 +540,12 @@ function write(level, message, meta) {
533
540
  if (Object.keys(masked).length > 0) {
534
541
  line += ` ${JSON.stringify(masked)}`;
535
542
  }
536
- process.stderr.write(`${line}
543
+ try {
544
+ process.stderr.write(`${line}
537
545
  `);
546
+ } catch {
547
+ stderrBroken = true;
548
+ }
538
549
  }
539
550
  function createLogger(boundMeta) {
540
551
  return {
@@ -1618,7 +1629,7 @@ var SshConnection = class {
1618
1629
  * @throws {Error} If the connection was closed, authentication fails, the host is
1619
1630
  * unreachable, the handshake times out, or the carrier cannot be opened.
1620
1631
  */
1621
- async connect() {
1632
+ async connect(onProgress) {
1622
1633
  if (this.disposed == true) {
1623
1634
  throw new Error(`ssh connection for '${this.profile.name}' has been closed; open a new session`);
1624
1635
  }
@@ -1640,6 +1651,9 @@ var SshConnection = class {
1640
1651
  this.observedFingerprint = fingerprint;
1641
1652
  });
1642
1653
  this.connecting = (async () => {
1654
+ if (this.profile.jump != null || this.profile.proxyCommand != null) {
1655
+ onProgress?.("transport");
1656
+ }
1643
1657
  const transport = await openTransport(this.profile, (fingerprint) => {
1644
1658
  this.observedJumpFingerprint = fingerprint;
1645
1659
  });
@@ -1650,6 +1664,7 @@ var SshConnection = class {
1650
1664
  if (transport != null) {
1651
1665
  connectConfig.sock = transport.sock;
1652
1666
  }
1667
+ onProgress?.("host");
1653
1668
  await new Promise((resolve, reject) => {
1654
1669
  const client = new Client();
1655
1670
  this.pendingClient = client;