dsh-linked-workspace 0.9.0 → 0.11.0

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/ssh.js CHANGED
@@ -805,6 +805,7 @@ export class RemoteHost {
805
805
  #generation = 0;
806
806
  #logger;
807
807
  #dataDir;
808
+ #onLost = null;
808
809
 
809
810
  /**
810
811
  * @param {{
@@ -813,10 +814,11 @@ export class RemoteHost {
813
814
  * connectTimeoutMs?: number,
814
815
  * logger?: (level: 'info'|'warn'|'error', message: string) => void,
815
816
  * dataDir?: string,
817
+ * onLost?: (info: { reason: string, authority: string }) => void,
816
818
  * }} options
817
819
  */
818
820
  constructor(options = {}) {
819
- const { host, knownHostsFile, connectTimeoutMs, logger, dataDir } = options || {};
821
+ const { host, knownHostsFile, connectTimeoutMs, logger, dataDir, onLost } = options || {};
820
822
  if (!isPlainObject(host) || !asString(host.host).trim()) {
821
823
  throw new SshError('INTERNAL', 'RemoteHost requires a host record with a non-empty "host" field');
822
824
  }
@@ -836,6 +838,7 @@ export class RemoteHost {
836
838
  this.connectTimeoutMs = Number.isFinite(timeout) && timeout > 0 ? timeout : DEFAULT_CONNECT_TIMEOUT_MS;
837
839
  this.#logger = typeof logger === 'function' ? logger : null;
838
840
  this.#dataDir = typeof dataDir === 'string' && dataDir ? dataDir : null;
841
+ this.#onLost = typeof onLost === 'function' ? onLost : null;
839
842
  }
840
843
 
841
844
  /** "host:port" */
@@ -934,7 +937,7 @@ export class RemoteHost {
934
937
  return;
935
938
  }
936
939
  this.#log('warn', `Connection error on ${this.authority}: ${err.message}`);
937
- this.#onClientLost(client);
940
+ this.#onClientLost(client, err.message);
938
941
  });
939
942
  client.on('close', () => {
940
943
  if (!settled) {
@@ -942,7 +945,7 @@ export class RemoteHost {
942
945
  return;
943
946
  }
944
947
  this.#log('info', `Connection to ${this.authority} closed`);
945
- this.#onClientLost(client);
948
+ this.#onClientLost(client, 'connection closed');
946
949
  });
947
950
 
948
951
  try {
@@ -963,8 +966,11 @@ export class RemoteHost {
963
966
  return this;
964
967
  }
965
968
 
966
- #onClientLost(client) {
969
+ #onClientLost(client, reason) {
967
970
  if (this.#client !== client) return;
971
+ // Only a connection that had already reached "ready" counts as lost; a
972
+ // failure during the initial connect is reported by connect() itself.
973
+ const wasReady = this.#ready;
968
974
  this.#client = null;
969
975
  this.#ready = false;
970
976
  this.#sftp = null;
@@ -975,6 +981,16 @@ export class RemoteHost {
975
981
  } catch {
976
982
  /* ignore */
977
983
  }
984
+ if (wasReady) this.#notifyLost(reason);
985
+ }
986
+
987
+ #notifyLost(reason) {
988
+ if (!this.#onLost) return;
989
+ try {
990
+ this.#onLost({ reason: asString(reason) || 'connection lost', authority: this.authority });
991
+ } catch {
992
+ /* a broken listener must never break the transport */
993
+ }
978
994
  }
979
995
 
980
996
  async #teardownConnection() {
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
- "title": "Remote Workspaces & Links",
4
- "description": "Remote directories over SSH and local ⇄ remote linked workspaces: theme-aware split editor, file-type icons, and an agent tool that edits remote files directly."
3
+ "title": "Linked & Remote Workspaces",
4
+ "description": "Local ⇄ remote linked workspaces and remote workspaces that run inside the SSH host: theme-aware split editor, file-type icons, and an agent tool that edits remote files directly."
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
- "title": "远程目录与联动工作区",
4
- "description": "把 SSH 连接变成远程目录,或把本地目录与远端目录联动成工作区:主题化分栏编辑器、文件类型图标,会话中的模型工具可直接读写远端文件。"
3
+ "title": "联动与远程工作区",
4
+ "description": "把本地目录与远端目录联动成工作区,或让会话直接运行在远端目录:主题化分栏编辑器、文件类型图标,会话中的模型工具可直接读写远端文件。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-linked-workspace",
3
- "version": "0.9.0",
4
- "description": "Linked local ⇄ remote workspaces and SSH-backed remote directories for DeepSeek Harness: theme-aware split editor, file-type icons, and an agent tool that edits remote files directly.",
3
+ "version": "0.11.0",
4
+ "description": "Linked local ⇄ remote workspaces and remote workspaces for DeepSeek Harness: theme-aware split editor, file-type icons, and agent tools that edit remote files directly.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "icon": "./icon.svg",
@@ -54,8 +54,7 @@
54
54
  "client": {
55
55
  "platform": "web",
56
56
  "inject": [
57
- "@deepseek-ai/dsh-client-locale",
58
- "dsh-better-sidebar"
57
+ "@deepseek-ai/dsh-client-locale"
59
58
  ]
60
59
  }
61
60
  },