dsh-remote 1.2.0 → 1.2.1

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.en.md CHANGED
@@ -12,7 +12,7 @@ Maintained by [@flymysql](https://github.com/flymysql) · [Homepage](https://fly
12
12
 
13
13
  ![dsh-remote — remote projects, complete context](https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workspace-overview.png)
14
14
 
15
- Turn SSH hosts into everyday development workspaces in [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): manage projects across hosts, browse and edit remote files, search names and contents, use terminals and inspect Git diffs. Agents read and write files, run commands, build and test in their assigned remote workspace. Multiple workspaces can run independently in parallel.
15
+ Turn SSH hosts into everyday development workspaces in [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): manage projects across hosts, browse and edit remote files, search names and contents, use terminals, inspect Git diffs and open local/reverse port tunnels. Agents read and write files, run commands, build and test in their assigned remote workspace. Multiple workspaces can run independently in parallel.
16
16
 
17
17
  Use the normal layout or choose the optional **three-column IDE layout** to view remote files, the editor and the native Agent conversation side by side. Switching layouts retains tasks and unsaved edits.
18
18
 
@@ -60,6 +60,14 @@ The terminal starts in the session's remote directory. A pixel fish welcomes you
60
60
 
61
61
  <img src="https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-terminal.png" alt="Native remote terminal with pixel fish and actual SSH command output" width="1000"/>
62
62
 
63
+ ### Port forwarding (SSH tunnels)
64
+
65
+ Open the listener on the side that initiates the connection: a listener here is a local forward (`ssh -L`); one on the remote is a reverse forward (`ssh -R`). Run several at once, and tick auto reconnect per row to restore only the forwards that were running, scoped to their machine. Enabling it for a reverse forward first warns that the remote will listen again.
66
+
67
+ Upgrading from an older version: auto-reconnect entries that predate `lastActive` are paused and marked "Re-confirm" in the row; tick them again to opt back in (reverse forwards also need the remote-listening warning acknowledged).
68
+
69
+ <img src="docs/shots/port-forwards.png" alt="Port forwarding panel with local/reverse directions, per-row auto reconnect and the add form" width="900"/>
70
+
63
71
  ### Edit and build with the agent
64
72
 
65
73
  Tool cards show applied changes, actual exit codes and build output, with compiler diagnostics linking to source. Saving detects remote conflicts, preserves CRLF and protects newer input typed during the save.
@@ -74,7 +82,7 @@ Tool cards show applied changes, actual exit codes and build output, with compil
74
82
 
75
83
  ## Documentation and community
76
84
 
77
- [Full tool and configuration reference](https://github.com/flymysql/dsh-remote/blob/main/docs/reference.en.md) · [Troubleshooting](https://github.com/flymysql/dsh-remote/blob/main/docs/troubleshooting.md) · [Upgrade guide](https://github.com/flymysql/dsh-remote/blob/main/docs/migration-1.0.md) · [Changelog](https://github.com/flymysql/dsh-remote/blob/main/CHANGELOG.md)
85
+ [Full tool and configuration reference](https://github.com/flymysql/dsh-remote/blob/main/docs/reference.en.md) · [Troubleshooting](https://github.com/flymysql/dsh-remote/blob/main/docs/troubleshooting.md) · [Self-update recovery](https://github.com/flymysql/dsh-remote/blob/main/docs/self-heal.md) · [Upgrade guide](https://github.com/flymysql/dsh-remote/blob/main/docs/migration-1.0.md) · [Changelog](https://github.com/flymysql/dsh-remote/blob/main/CHANGELOG.md)
78
86
 
79
87
  [Homepage](https://flymysql.github.io/dsh-remote/) · [Discussions](https://github.com/flymysql/dsh-remote/discussions) · [Report an issue](https://github.com/flymysql/dsh-remote/issues) · [Contributing](https://github.com/flymysql/dsh-remote/blob/main/CONTRIBUTING.md) · [Contributors and credits](#contributors-and-credits)
80
88
 
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  ![dsh-remote —— 远程项目,完整上下文](https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workspace-overview.png)
14
14
 
15
- 在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 中,把 SSH 主机变成日常开发工作区:管理多主机项目,浏览和编辑远程文件、递归搜索文件与内容、使用终端并查看 Git 差异;让 Agent 在所属远程工作区中读写文件、执行命令、构建和测试。多个工作区可独立并行。
15
+ 在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 中,把 SSH 主机变成日常开发工作区:管理多主机项目,浏览和编辑远程文件、递归搜索文件与内容、使用终端、查看 Git 差异、建立本地/反向端口隧道;让 Agent 在所属远程工作区中读写文件、执行命令、构建和测试。多个工作区可独立并行。
16
16
 
17
17
  可按习惯使用普通布局,或切换 **IDE 三栏布局**,并排查看远程文件、编辑器与原生 Agent 会话;切换时保留任务和未保存编辑。
18
18
 
@@ -60,6 +60,14 @@ dsh plugin --profile web add dsh-remote
60
60
 
61
61
  <img src="https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-terminal.png" alt="DSH 远程终端:像素鱼欢迎图与实际 SSH 命令输出" width="1000"/>
62
62
 
63
+ ### 端口转发(SSH 隧道)
64
+
65
+ 谁要发起访问,就在谁那边开监听口:监听口开在本机是本地转发(`ssh -L`),开在远端是远程转发(`ssh -R`)。可同时运行多条;每行能直接勾选「自动重连」——只恢复上次运行中的转发,且按机器隔离,反向转发首次勾选会提示远端监听风险。
66
+
67
+ 从旧版本升级:旧版没有 `lastActive` 的「自动重连」配置会暂停,行上显示「需重新确认」;重新勾选后才会参与自动恢复(反向转发需重新确认远端监听)。
68
+
69
+ <img src="docs/shots/port-forwards.png" alt="端口转发面板:本地/反向方向、自动重连勾选框与添加转发表单" width="900"/>
70
+
63
71
  ### 与 Agent 一起修改和构建
64
72
 
65
73
  工具卡展示已应用改动、实际退出码和构建输出,编译诊断可跳转源码。编辑器保存会检测远端冲突、保留 CRLF,并保护保存期间继续输入的内容。
@@ -74,7 +82,7 @@ dsh plugin --profile web add dsh-remote
74
82
 
75
83
  ## 文档与社区
76
84
 
77
- [完整工具与配置参考](https://github.com/flymysql/dsh-remote/blob/main/docs/reference.zh.md) · [排障](https://github.com/flymysql/dsh-remote/blob/main/docs/troubleshooting.md) · [升级指南](https://github.com/flymysql/dsh-remote/blob/main/docs/migration-1.0.md) · [更新记录](https://github.com/flymysql/dsh-remote/blob/main/CHANGELOG.md)
85
+ [完整工具与配置参考](https://github.com/flymysql/dsh-remote/blob/main/docs/reference.zh.md) · [排障](https://github.com/flymysql/dsh-remote/blob/main/docs/troubleshooting.md) · [自更新修复](https://github.com/flymysql/dsh-remote/blob/main/docs/self-heal.md) · [升级指南](https://github.com/flymysql/dsh-remote/blob/main/docs/migration-1.0.md) · [更新记录](https://github.com/flymysql/dsh-remote/blob/main/CHANGELOG.md)
78
86
 
79
87
  [主页](https://flymysql.github.io/dsh-remote/) · [讨论区](https://github.com/flymysql/dsh-remote/discussions) · [反馈问题](https://github.com/flymysql/dsh-remote/issues) · [贡献指南](https://github.com/flymysql/dsh-remote/blob/main/CONTRIBUTING.md) · [贡献者与致谢](#贡献者与致谢)
80
88
 
package/lib/binding.js CHANGED
@@ -124,6 +124,31 @@ export function readSessionHeaderCwd(file) {
124
124
  }
125
125
  }
126
126
 
127
+ /** Read session logs written by any DSH release: `session.<format>.jsonl[.zst|.gz]`.
128
+ * The format segment (`v4`, `v3`, …) changes between releases, so a fixed name
129
+ * list silently stopped finding the cwd of every newer session. */
130
+ const SESSION_LOG_RE = /^session(\.[A-Za-z0-9]+)*\.jsonl(\.zst|\.zstd|\.gz)?$/
131
+
132
+ /** Newest session log in a session directory, or '' when there is none. */
133
+ function sessionLogFile(sessDir) {
134
+ try {
135
+ const names = readdirSync(sessDir).filter((n) => SESSION_LOG_RE.test(n))
136
+ if (!names.length) return ''
137
+ // Highest format version first, compressed before raw; only the header line
138
+ // matters, so the first readable file is enough.
139
+ const rank = (n) => {
140
+ const version = /\.v(\d+)\./.exec(n)
141
+ return [version ? Number(version[1]) : 0, /\.(zst|zstd|gz)$/.test(n) ? 1 : 0]
142
+ }
143
+ names.sort((a, b) => {
144
+ const [av, ac] = rank(a)
145
+ const [bv, bc] = rank(b)
146
+ return bv - av || bc - ac || a.localeCompare(b)
147
+ })
148
+ return names.map((n) => path.join(sessDir, n)).find((p) => existsSync(p)) || ''
149
+ } catch { return '' }
150
+ }
151
+
127
152
  /**
128
153
  * Resolve a session's workspace cwd from the live sessions service, then from
129
154
  * durable session logs under `$DSH_HOME/sessions`.
@@ -147,8 +172,7 @@ export function lookupSessionCwd(sessionId, { sessions, dshHome } = {}) {
147
172
  if (!statSync(projPath, { throwIfNoEntry: false })?.isDirectory?.()) continue
148
173
  const sessDir = path.join(projPath, targetDir)
149
174
  if (!statSync(sessDir, { throwIfNoEntry: false })?.isDirectory?.()) continue
150
- const logFile = ['session.jsonl.zstd', 'session.jsonl', 'session.jsonl.gz']
151
- .map((n) => path.join(sessDir, n)).find((p) => existsSync(p))
175
+ const logFile = sessionLogFile(sessDir)
152
176
  if (!logFile) continue
153
177
  const cwd = readSessionHeaderCwd(logFile)
154
178
  if (cwd) return cwd
package/lib/boot.js CHANGED
@@ -1,34 +1,7 @@
1
- // dsh-remote — package entry point (package.json "main" / exports["."]).
2
- //
3
- // A thin shell around the real plugin body (lib/index.js). Its only job is to
4
- // give the startup self-repair somewhere to live: ES module imports HOIST, so
5
- // code placed inside index.js runs strictly after every static import of it
6
- // has already been resolved — there is no room inside index.js to react to a
7
- // missing sibling file. Dynamic import() is the only place such a guard can
8
- // sit, hence this indirection.
9
- //
10
- // What happens here (see lib/self-heal.js for the policy):
11
- // import('./index.js') → on a missing-own-file crash (the half-updated
12
- // 0.8.92 scenario, issue #126) the CURRENT version's tarball is re-laid from
13
- // npm and the import retried once. Healthy installs pay zero overhead: one
14
- // extra dynamic import of the same file the host would have loaded anyway.
15
- //
16
- // ★ TWO INVARIANTS protect this file:
17
- // 1. Stay minimal and self-contained — only import lib/self-heal.js (which
18
- // only imports lib/update.js + node builtins). Anything richer could be
19
- // the file that is missing.
20
- // 2. Re-export index.js's public surface EXACTLY. The cordis loader, the
21
- // settings UI and tests consume these names; test/self-heal-boot.test.js
22
- // pins the key set so index.js cannot gain an export this shell forgets
23
- // to forward.
24
-
25
- import { importWithSelfHeal } from './self-heal.js'
26
-
27
- const { module: main, repaired } = await importWithSelfHeal(() => import('./index.js'))
28
-
29
- if (repaired) {
30
- console.warn('[dsh-remote] startup self-repair succeeded — the incomplete update has been fully re-applied and this boot is healthy')
31
- }
1
+ // Package-root entry. Forward the caller's URL query through the shared
2
+ // self-heal guard so cache-busted consumers keep isolated module state.
3
+ const indexUrl = new URL('./index.js' + new URL(import.meta.url).search, import.meta.url).href
4
+ const main = await import(indexUrl)
32
5
 
33
6
  export const name = main.name
34
7
  export const DEFAULT_UPDATE_MODE = main.DEFAULT_UPDATE_MODE