@linxin666/dsh-ssh 0.1.3 → 0.1.6

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/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.1.3",
4
+ "version": "0.1.6",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": "^22.19.0 || >=24.0.0"
@@ -92,25 +92,37 @@ export function mountSidebarEntry(controller: PanelController): () => void {
92
92
  let placed = false
93
93
 
94
94
  const tryPlace = (): void => {
95
- if (placed) return
96
95
  if (root !== undefined && !root.isConnected) {
97
- // The shell re-created the sidebar pane; re-query from scratch.
96
+ // The shell rebuilt the sidebar pane (whole-tree teardown); the root
97
+ // observer is gone with the old tree, so detach it and re-query from
98
+ // scratch. The new pane is later noticed by the body-level watcher.
98
99
  rootObserver.disconnect()
99
100
  root = undefined
101
+ placed = false
102
+ }
103
+ if (placed) {
104
+ // Cheap short-circuit: entry still lives in a mountable subtree.
105
+ if (document.body.contains(entry)) return
106
+ // Entry was torn down together with the old tree; reset and re-place.
107
+ rootObserver.disconnect()
108
+ root = undefined
109
+ placed = false
100
110
  }
101
111
  root ??= sidebarRoot()
102
112
  if (root === undefined) return
103
113
  placed = placeEntry(root, entry)
104
114
  if (placed) {
105
115
  rootObserver.observe(root, { childList: true, subtree: true })
106
- // Placement done; the root observer alone keeps the entry healed.
107
- // Disconnect the body-wide watcher so unrelated app mutations (e.g.
108
- // chat streaming) no longer churn every plugin's self-heal loop.
109
- waitObserver.disconnect()
110
116
  }
111
117
  }
112
118
 
113
- // The shell renders after boot settlement; watch for its arrival.
119
+ // Body-level watcher retained as the "whole rebuild" fallback: when the shell
120
+ // tears down the whole sidebar pane, the root observer is gone with it and
121
+ // only this body observation can notice the new pane mounting. It is no
122
+ // longer disconnected after placement; the placed-and-still-mounted case
123
+ // short-circuits through the cheap document.body.contains(entry) check, so
124
+ // unrelated app mutations (e.g. chat streaming) cost one contains check
125
+ // instead of churning the full re-query.
114
126
  const waitObserver = new MutationObserver(() => { tryPlace() })
115
127
  waitObserver.observe(document.body, { childList: true, subtree: true })
116
128