dsh-remote 1.1.2 → 1.2.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/README.en.md +8 -2
- package/README.md +8 -2
- package/lib/client.js +196 -41
- package/lib/index.js +50 -8
- package/lib/local-workspace.js +103 -0
- package/lib/remote-git.js +6 -4
- package/lib/routes-fs.js +26 -22
- package/lib/telemetry.js +64 -25
- package/package.json +3 -3
package/README.en.md
CHANGED
|
@@ -12,9 +12,9 @@ Maintained by [@flymysql](https://github.com/flymysql) · [Homepage](https://fly
|
|
|
12
12
|
|
|
13
13
|

|
|
14
14
|
|
|
15
|
-
Turn SSH hosts into everyday development workspaces in [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): browse remote files,
|
|
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.
|
|
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
|
|
|
19
19
|
<img src="https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-ide.png" alt="DSH remote IDE with file tree, native code editor and agent conversation" width="1200"/>
|
|
20
20
|
|
|
@@ -34,6 +34,12 @@ After installation or an upgrade, restart DSH Web and refresh the page. Check au
|
|
|
34
34
|
|
|
35
35
|
<img src="https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workspace-picker-browse.png" alt="Remote folder picker with fixed path and confirmation controls and a large directory list" width="720"/>
|
|
36
36
|
|
|
37
|
+
## Local workspaces too
|
|
38
|
+
|
|
39
|
+
Open a normal local project and choose **IDE mode** or **Workspace files** to use the same file tree, highlighted editor, recursive search, Git diffs and local terminal. No SSH setup is required. Agents keep using the host’s native file and command tools; local and remote projects can run in parallel.
|
|
40
|
+
|
|
41
|
+
<img src="https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-local.png" alt="Local workspace with file search, highlighted editing and a native Agent conversation after an actual local build" width="1200"/>
|
|
42
|
+
|
|
37
43
|
## Everyday development
|
|
38
44
|
|
|
39
45
|
### Search remote names and contents
|
package/README.md
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|

|
|
14
14
|
|
|
15
|
-
在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 中,把 SSH
|
|
15
|
+
在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 中,把 SSH 主机变成日常开发工作区:管理多主机项目,浏览和编辑远程文件、递归搜索文件与内容、使用终端并查看 Git 差异;让 Agent 在所属远程工作区中读写文件、执行命令、构建和测试。多个工作区可独立并行。
|
|
16
16
|
|
|
17
|
-
**IDE
|
|
17
|
+
可按习惯使用普通布局,或切换 **IDE 三栏布局**,并排查看远程文件、编辑器与原生 Agent 会话;切换时保留任务和未保存编辑。
|
|
18
18
|
|
|
19
19
|
<img src="https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-ide.png" alt="DSH 远程工作区 IDE 模式:远程文件树、代码编辑器和原生 Agent 会话三栏" width="1200"/>
|
|
20
20
|
|
|
@@ -34,6 +34,12 @@ dsh plugin --profile web add dsh-remote
|
|
|
34
34
|
|
|
35
35
|
<img src="https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workspace-picker-browse.png" alt="选择远程目录:固定路径与确认栏,目录列表占据弹窗主要区域" width="720"/>
|
|
36
36
|
|
|
37
|
+
## 本地工作区也能用
|
|
38
|
+
|
|
39
|
+
打开普通本地项目后,点击 **IDE 模式** 或 **工作区文件**,即可使用同一套文件树、高亮编辑、递归搜索、Git 差异与本地终端。无需配置 SSH;Agent 继续使用宿主原生文件和命令工具,多个本地、远程项目可并行工作。
|
|
40
|
+
|
|
41
|
+
<img src="https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-local.png" alt="本地工作区:文件搜索、高亮编辑和原生 Agent 会话,Agent 已实际完成本地构建" width="1200"/>
|
|
42
|
+
|
|
37
43
|
## 日常开发
|
|
38
44
|
|
|
39
45
|
### 搜索远端文件与内容
|
package/lib/client.js
CHANGED
|
@@ -27,7 +27,7 @@ window.__ModuleLoader__.load({
|
|
|
27
27
|
|
|
28
28
|
const React = require('react')
|
|
29
29
|
const name = 'dsh-remote'
|
|
30
|
-
const CLIENT_VERSION = '1.
|
|
30
|
+
const CLIENT_VERSION = '1.2.0'
|
|
31
31
|
|
|
32
32
|
// ── optional host primitives ────────────────────────────────────────────
|
|
33
33
|
// Issue #74: a remote session's .md link must open over SFTP, NOT via the
|
|
@@ -166,6 +166,42 @@ window.__ModuleLoader__.load({
|
|
|
166
166
|
'ide.guideLayoutHint': '拖动分隔线调整栏宽;窄屏可切换文件、编辑器和会话。',
|
|
167
167
|
'ide.documentation': '使用指南',
|
|
168
168
|
'ide.tools': '会话工具', 'ide.toolsHint': '展开或收起会话附加工具与连接信息',
|
|
169
|
+
"local.explorer.tabTitle": "本地文件",
|
|
170
|
+
"local.workbench.openTerminal": "打开本地终端",
|
|
171
|
+
"local.workbench.terminalUnavailable": "本地终端尚不可用,请检查宿主终端插件。",
|
|
172
|
+
"local.workbench.filter": "搜索本地工作区",
|
|
173
|
+
"local.workbench.remote": "本地工作区",
|
|
174
|
+
"local.workbench.copyPath": "复制本地路径",
|
|
175
|
+
"local.workbench.saved": "已保存到本地",
|
|
176
|
+
"local.workbench.loadingFile": "正在读取本地文件…",
|
|
177
|
+
"local.file.readFail": "本地读取失败:{msg}",
|
|
178
|
+
"local.file.listFail": "本地目录读取失败:{msg}",
|
|
179
|
+
"local.file.conflictHelp": "本地文件已变化,草稿已保留。请重新读取并比较后合并修改。",
|
|
180
|
+
"local.file.discardReload": "舍弃草稿并重新读取",
|
|
181
|
+
"local.file.incompletePreview": "当前文件预览不完整,请在终端编辑完整文件。",
|
|
182
|
+
"local.explorer.connection.loading": "正在读取本地目录…",
|
|
183
|
+
"local.explorer.connection.interrupted": "本地访问失败 · 已保留文件列表",
|
|
184
|
+
"local.explorer.connection.ready": "本地目录已就绪",
|
|
185
|
+
"local.ide.welcomeTitle": "本地开发工作区",
|
|
186
|
+
"local.ide.guideFilesHint": "在左侧展开目录,或搜索项目文件、目录和内容。",
|
|
187
|
+
"local.ide.guideEditHint": "文件打开即可编辑。使用 Ctrl / ⌘ + S 保存到本地项目。",
|
|
188
|
+
"local.ide.guideAgentHint": "Agent 继续使用宿主原生文件与命令工具,在当前本地项目中工作。",
|
|
189
|
+
"local.ide.chooseFile": "从左侧选择项目文件,在这里编辑。",
|
|
190
|
+
"local.file.saveToRemote": "保存到本地",
|
|
191
|
+
"local.file.binary": "二进制文件({size}),请使用本机应用打开。",
|
|
192
|
+
"local.file.truncated": "… 内容已截断,请在本机应用中查看完整文件。",
|
|
193
|
+
"local.file.conflict": "本地文件已变化,请重新读取",
|
|
194
|
+
"local.changes.title": "本地 Git 改动",
|
|
195
|
+
"local.changes.failed": "无法读取本地 Git 状态",
|
|
196
|
+
"local.changes.noGit": "本机未安装 Git,安装后点击刷新。",
|
|
197
|
+
"local.changes.unavailable": "当前无法查看本地 Git 状态。",
|
|
198
|
+
"local.changes.readOnly": "查看本地仓库,不自动提交或更改暂存区。",
|
|
199
|
+
"local.changes.refreshing": "正在刷新本地状态…",
|
|
200
|
+
"local.changes.loading": "正在读取本地 Git 状态…",
|
|
201
|
+
"local.changes.diff": "本地文件差异",
|
|
202
|
+
"local.changes.openFile": "打开本地文件",
|
|
203
|
+
"workspace.files": "工作区文件",
|
|
204
|
+
"workspace.git": "Git 改动",
|
|
169
205
|
'ide.enter': 'IDE 模式', 'ide.exit': '返回普通模式', 'ide.files': '文件',
|
|
170
206
|
'ide.editor': '编辑器', 'ide.chat': '会话', 'ide.openEditor': '打开编辑区',
|
|
171
207
|
'ide.chooseFile': '从左侧选择远程文件,在这里编辑。',
|
|
@@ -726,6 +762,42 @@ window.__ModuleLoader__.load({
|
|
|
726
762
|
'ide.guideLayoutHint': 'Drag separators to resize columns. Switch panes on narrow screens.',
|
|
727
763
|
'ide.documentation': 'User guide',
|
|
728
764
|
'ide.tools': 'Chat tools', 'ide.toolsHint': 'Show or hide extra conversation tools and connection details',
|
|
765
|
+
"local.explorer.tabTitle": "Local files",
|
|
766
|
+
"local.workbench.openTerminal": "Open local terminal",
|
|
767
|
+
"local.workbench.terminalUnavailable": "Local terminal unavailable. Check the host terminal plugin.",
|
|
768
|
+
"local.workbench.filter": "Search local workspace",
|
|
769
|
+
"local.workbench.remote": "Local workspace",
|
|
770
|
+
"local.workbench.copyPath": "Copy local path",
|
|
771
|
+
"local.workbench.saved": "Saved locally",
|
|
772
|
+
"local.workbench.loadingFile": "Reading local file…",
|
|
773
|
+
"local.file.readFail": "Local read failed: {msg}",
|
|
774
|
+
"local.file.listFail": "Local listing failed: {msg}",
|
|
775
|
+
"local.file.conflictHelp": "Local file changed. Your draft is retained; reload and compare before merging.",
|
|
776
|
+
"local.file.discardReload": "Discard draft and reload",
|
|
777
|
+
"local.file.incompletePreview": "Incomplete preview; edit the complete file in the terminal.",
|
|
778
|
+
"local.explorer.connection.loading": "Reading local directory…",
|
|
779
|
+
"local.explorer.connection.interrupted": "Local access failed · file list retained",
|
|
780
|
+
"local.explorer.connection.ready": "Local directory ready",
|
|
781
|
+
"local.ide.welcomeTitle": "Local development workspace",
|
|
782
|
+
"local.ide.guideFilesHint": "Expand folders on the left, or search project files, directories and contents.",
|
|
783
|
+
"local.ide.guideEditHint": "Files open ready to edit. Use Ctrl / ⌘ + S to save to the local project.",
|
|
784
|
+
"local.ide.guideAgentHint": "The Agent uses the host’s native file and command tools in this local project.",
|
|
785
|
+
"local.ide.chooseFile": "Select a project file on the left to edit here.",
|
|
786
|
+
"local.file.saveToRemote": "Save locally",
|
|
787
|
+
"local.file.binary": "Binary file ({size}); open it with a local application.",
|
|
788
|
+
"local.file.truncated": "… Preview truncated; open the complete file with a local application.",
|
|
789
|
+
"local.file.conflict": "Local file changed; reload before saving",
|
|
790
|
+
"local.changes.title": "Local Git changes",
|
|
791
|
+
"local.changes.failed": "Could not read local Git status",
|
|
792
|
+
"local.changes.noGit": "Git is unavailable on this host. Install it and refresh.",
|
|
793
|
+
"local.changes.unavailable": "Local Git status is unavailable.",
|
|
794
|
+
"local.changes.readOnly": "Inspect the local repository without changing commits or the index.",
|
|
795
|
+
"local.changes.refreshing": "Refreshing local status…",
|
|
796
|
+
"local.changes.loading": "Reading local Git status…",
|
|
797
|
+
"local.changes.diff": "Local file diff",
|
|
798
|
+
"local.changes.openFile": "Open local file",
|
|
799
|
+
"workspace.files": "Workspace files",
|
|
800
|
+
"workspace.git": "Git changes",
|
|
729
801
|
'ide.enter': 'IDE mode', 'ide.exit': 'Return to standard mode', 'ide.files': 'Files',
|
|
730
802
|
'ide.editor': 'Editor', 'ide.chat': 'Chat', 'ide.openEditor': 'Open editor area',
|
|
731
803
|
'ide.chooseFile': 'Choose a remote file on the left to edit it here.',
|
|
@@ -1300,13 +1372,35 @@ window.__ModuleLoader__.load({
|
|
|
1300
1372
|
// The official Electron shell serves the shared API over its private
|
|
1301
1373
|
// dsh-app carrier. Legacy browser hosts keep their existing route prefix.
|
|
1302
1374
|
// Choose before sending: never retry a mutating request on another route.
|
|
1375
|
+
//
|
|
1376
|
+
// A browser host may mount the harness UNDER A PATH PREFIX (the fnOS
|
|
1377
|
+
// console serves it at /app/<app>/dsh/, and any prefix-stripping reverse
|
|
1378
|
+
// proxy does the same). The routes are registered at the server ROOT, so a
|
|
1379
|
+
// ROOT-ABSOLUTE '/dsh-remote/...' request would leave the mount and hit
|
|
1380
|
+
// the gateway's own SPA — a 404 with an empty body, and the remote
|
|
1381
|
+
// workspace panel then shows no hosts at all.
|
|
1382
|
+
//
|
|
1383
|
+
// The page's <base href="./"> makes every relative resource resolve
|
|
1384
|
+
// against the mount DIRECTORY, so the route must resolve the same way:
|
|
1385
|
+
// drop the leading slash and let the base carry the prefix. Resolving
|
|
1386
|
+
// against the base's own directory ('.' against the base URL) is exactly
|
|
1387
|
+
// what the browser does for the plugin bundle URL, so the API and the
|
|
1388
|
+
// bundle can never disagree about where the mount lives.
|
|
1303
1389
|
function apiPath(path) {
|
|
1304
|
-
|
|
1305
|
-
|
|
1390
|
+
if (window.location && window.location.protocol === 'dsh-app:') return '/api' + path
|
|
1391
|
+
const base = typeof document !== 'undefined' ? document.baseURI : ''
|
|
1392
|
+
if (!base) return path
|
|
1393
|
+
try {
|
|
1394
|
+
const baseUrl = new URL(base)
|
|
1395
|
+
if (baseUrl.protocol !== 'http:' && baseUrl.protocol !== 'https:') return path
|
|
1396
|
+
return new URL('.', baseUrl).pathname + path.replace(/^\/+/, '')
|
|
1397
|
+
} catch {
|
|
1398
|
+
return path
|
|
1399
|
+
}
|
|
1306
1400
|
}
|
|
1307
1401
|
|
|
1308
1402
|
function sessionQuery(sessionId) {
|
|
1309
|
-
return sessionId ? 'sessionId=' + encodeURIComponent(sessionId) : ''
|
|
1403
|
+
return sessionId ? 'sessionId=' + encodeURIComponent(sessionId) + (localWorkspaceSession(sessionId) ? '&workspace=local' : '') : ''
|
|
1310
1404
|
}
|
|
1311
1405
|
function withSessionQuery(path, sessionId) {
|
|
1312
1406
|
const q = sessionQuery(sessionId)
|
|
@@ -1315,7 +1409,7 @@ window.__ModuleLoader__.load({
|
|
|
1315
1409
|
}
|
|
1316
1410
|
function withSessionBody(body, sessionId) {
|
|
1317
1411
|
if (!sessionId) return body
|
|
1318
|
-
return Object.assign({}, body || {}, { sessionId })
|
|
1412
|
+
return Object.assign({}, body || {}, { sessionId }, localWorkspaceSession(sessionId) ? { workspace: 'local' } : {})
|
|
1319
1413
|
}
|
|
1320
1414
|
|
|
1321
1415
|
async function api(method, path, body, signal) {
|
|
@@ -3750,7 +3844,30 @@ window.__ModuleLoader__.load({
|
|
|
3750
3844
|
return api('POST', EXPLORER_AUTO_OPEN_ROUTE, { enabled: on }).catch(() => null)
|
|
3751
3845
|
}
|
|
3752
3846
|
|
|
3847
|
+
// A loaded registry plus the session's own cwd proves local vs remote.
|
|
3848
|
+
// Registry failure never turns an unrecognised mirror into a local project.
|
|
3849
|
+
function localWorkspaceSession(sessionId) {
|
|
3850
|
+
const cwd = sessionCwdFor(sessionId)
|
|
3851
|
+
return !!(cwd && MIRRORS.loaded && !MIRRORS.error && !mirrorForCwd(cwd, MIRRORS.list))
|
|
3852
|
+
}
|
|
3853
|
+
function workspaceText(key, sessionId, params) {
|
|
3854
|
+
return tr(localWorkspaceSession(sessionId) && L.en['local.' + key] ? 'local.' + key : key, params)
|
|
3855
|
+
}
|
|
3856
|
+
function workspaceSummary(sessionId) {
|
|
3857
|
+
const cwd = sessionCwdFor(sessionId)
|
|
3858
|
+
const remote = mirrorForCwd(cwd, MIRRORS.list)
|
|
3859
|
+
if (remote) return remote
|
|
3860
|
+
return localWorkspaceSession(sessionId) ? { local: true, remotePath: cwd, name: workspaceText('workbench.remote', sessionId) } : null
|
|
3861
|
+
}
|
|
3862
|
+
function workspaceMemoryKey(sessionId) {
|
|
3863
|
+
return localWorkspaceSession(sessionId) ? 'local:' + sessionCwdFor(sessionId) + ':' + sessionId : String(sessionId || '')
|
|
3864
|
+
}
|
|
3865
|
+
function fetchWorkspaceContext(sessionId) {
|
|
3866
|
+
return api('GET', '/dsh-remote/workspace-context?sessionId=' + encodeURIComponent(sessionId))
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3753
3869
|
function fetchRemoteStatus(sessionId) {
|
|
3870
|
+
if (localWorkspaceSession(sessionId)) return fetchWorkspaceContext(sessionId).then(value => ({ ...value, local: true, connected: true, workspace: value.root })).catch(() => null)
|
|
3754
3871
|
return api('GET', withSessionQuery('/dsh-remote/status', sessionId)).catch(() => null)
|
|
3755
3872
|
}
|
|
3756
3873
|
|
|
@@ -4033,16 +4150,16 @@ window.__ModuleLoader__.load({
|
|
|
4033
4150
|
}
|
|
4034
4151
|
|
|
4035
4152
|
function readRemoteFile(path, maxBytes, sessionId) {
|
|
4036
|
-
return api('POST', '/dsh-remote/read', withSessionBody({ path, maxBytes }, sessionId)).catch((e) => {
|
|
4037
|
-
const error = new Error(
|
|
4153
|
+
return ensureMirrors().then(() => api('POST', '/dsh-remote/read', withSessionBody({ path, maxBytes }, sessionId))).catch((e) => {
|
|
4154
|
+
const error = new Error(workspaceText('file.readFail', sessionId, { msg: ((e && e.message) || e) }))
|
|
4038
4155
|
error.code = e?.code; error.localCopy = e?.localCopy
|
|
4039
4156
|
throw error
|
|
4040
4157
|
})
|
|
4041
4158
|
}
|
|
4042
4159
|
|
|
4043
4160
|
function listRemoteDir(path, sessionId) {
|
|
4044
|
-
return api('GET', withSessionQuery('/dsh-remote/ls?path=' + encodeURIComponent(path || ''), sessionId)).catch((e) => {
|
|
4045
|
-
throw new Error(
|
|
4161
|
+
return ensureMirrors().then(() => api('GET', withSessionQuery('/dsh-remote/ls?path=' + encodeURIComponent(path || ''), sessionId))).catch((e) => {
|
|
4162
|
+
throw new Error(workspaceText('file.listFail', sessionId, { msg: ((e && e.message) || e) }))
|
|
4046
4163
|
})
|
|
4047
4164
|
}
|
|
4048
4165
|
|
|
@@ -4223,7 +4340,7 @@ window.__ModuleLoader__.load({
|
|
|
4223
4340
|
// tab, which is where the resolved root becomes known.)
|
|
4224
4341
|
const sharedKey = sharedExpanded.join('\u0000')
|
|
4225
4342
|
React.useEffect(() => {
|
|
4226
|
-
if (!evictShared) return
|
|
4343
|
+
if (!evictShared || localWorkspaceSession(props.scope?.sessionId)) return
|
|
4227
4344
|
const stray = strayRemoteSharedPaths('', sharedKey ? sharedKey.split('\u0000') : [])
|
|
4228
4345
|
for (const p of stray) evictShared(p)
|
|
4229
4346
|
}, [sharedKey, evictShared])
|
|
@@ -4234,7 +4351,7 @@ window.__ModuleLoader__.load({
|
|
|
4234
4351
|
return React.createElement(RemoteExplorerTab, {
|
|
4235
4352
|
...owned,
|
|
4236
4353
|
evictStray: (root) => {
|
|
4237
|
-
if (!evictShared || !sharedExpanded.length) return []
|
|
4354
|
+
if (!evictShared || !sharedExpanded.length || localWorkspaceSession(props.scope?.sessionId)) return []
|
|
4238
4355
|
const stray = strayRemoteSharedPaths(root, sharedExpanded)
|
|
4239
4356
|
for (const p of stray) evictShared(p)
|
|
4240
4357
|
return stray
|
|
@@ -4267,12 +4384,17 @@ window.__ModuleLoader__.load({
|
|
|
4267
4384
|
try {
|
|
4268
4385
|
const right = SIDEBAR_RIGHT
|
|
4269
4386
|
const terminals = WEB_TERMINALS
|
|
4270
|
-
if (!right || !terminals || typeof terminals.launchShells !== 'function') throw new Error(
|
|
4387
|
+
if (!right || !terminals || typeof terminals.launchShells !== 'function') throw new Error(workspaceText('workbench.terminalUnavailable', sessionId))
|
|
4271
4388
|
const choices = await terminals.launchShells(sessionId, controller.signal)
|
|
4272
4389
|
if (controller.signal.aborted) return
|
|
4273
4390
|
if (right.mounted && typeof right.mounted.getSnapshot === 'function' && right.mounted.getSnapshot() !== sessionId) return
|
|
4274
|
-
const
|
|
4275
|
-
|
|
4391
|
+
const shells = choices.shells || []
|
|
4392
|
+
const isRemote = s => s.name === 'remote ssh' || /(^|[\\/])remote ssh(?:\.cmd)?$/i.test(s.path || '')
|
|
4393
|
+
const local = localWorkspaceSession(sessionId)
|
|
4394
|
+
const shell = local
|
|
4395
|
+
? shells.find(s => !isRemote(s) && (s.path === choices.selectedShell || s.name === choices.selectedShell)) || shells.find(s => !isRemote(s))
|
|
4396
|
+
: shells.find(isRemote)
|
|
4397
|
+
if (!shell) throw new Error(workspaceText('workbench.terminalUnavailable', sessionId))
|
|
4276
4398
|
right.openTab('terminal', { params: { shellPath: shell.path } })
|
|
4277
4399
|
} catch (e) { if (!controller.signal.aborted) setError(String(e.message || e)) }
|
|
4278
4400
|
finally { if (lifetime.current === controller) { lifetime.current = null; setPending(false) } }
|
|
@@ -4385,8 +4507,9 @@ window.__ModuleLoader__.load({
|
|
|
4385
4507
|
}
|
|
4386
4508
|
|
|
4387
4509
|
function RemoteExplorerTab(props) {
|
|
4510
|
+
const tr = (key, params) => workspaceText(key, props.scope?.sessionId, params)
|
|
4388
4511
|
const [status, setStatus] = React.useState(null)
|
|
4389
|
-
const [root, setRoot] = React.useState('') //
|
|
4512
|
+
const [root, setRoot] = React.useState('') // execution-world project root for this session
|
|
4390
4513
|
const [data, setData] = React.useState({}) // dir -> { entries | error | loading }
|
|
4391
4514
|
const dataRef = React.useRef(data)
|
|
4392
4515
|
const [err, setErr] = React.useState('')
|
|
@@ -4431,7 +4554,7 @@ window.__ModuleLoader__.load({
|
|
|
4431
4554
|
setData(dataRef.current)
|
|
4432
4555
|
}
|
|
4433
4556
|
|
|
4434
|
-
const viewKey =
|
|
4557
|
+
const viewKey = workspaceMemoryKey(sessionId) + '\0' + String(scopeCwd || '')
|
|
4435
4558
|
const viewRef = React.useRef({ key: viewKey, requests: new Map() })
|
|
4436
4559
|
if (viewRef.current.key !== viewKey) {
|
|
4437
4560
|
viewRef.current = { key: viewKey, requests: new Map() }
|
|
@@ -4457,7 +4580,7 @@ window.__ModuleLoader__.load({
|
|
|
4457
4580
|
const request = {}
|
|
4458
4581
|
view.requests.set(dir, request)
|
|
4459
4582
|
const current = () => viewRef.current === view && view.requests.get(dir) === request
|
|
4460
|
-
storeLevel(dir, { ...existing, loading: true })
|
|
4583
|
+
if (!opts?.quiet || !existing?.entries) storeLevel(dir, { ...existing, loading: true })
|
|
4461
4584
|
return listRemoteDir(dir, sessionId)
|
|
4462
4585
|
.then((res) => {
|
|
4463
4586
|
if (!current()) return
|
|
@@ -4520,7 +4643,10 @@ window.__ModuleLoader__.load({
|
|
|
4520
4643
|
|
|
4521
4644
|
}
|
|
4522
4645
|
}
|
|
4523
|
-
const resolveRoot = () => {
|
|
4646
|
+
const resolveRoot = async () => {
|
|
4647
|
+
if (opts?.force) await refreshMirrors()
|
|
4648
|
+
else await ensureMirrors()
|
|
4649
|
+
if (localWorkspaceSession(sessionId)) return fetchWorkspaceContext(sessionId).then(value => value.root || '')
|
|
4524
4650
|
if (scopeCwd) {
|
|
4525
4651
|
return api('GET', '/dsh-remote/resolve-mirror?local=' + encodeURIComponent(scopeCwd))
|
|
4526
4652
|
.then((r) => (r && r.remotePath) || '')
|
|
@@ -4589,7 +4715,7 @@ window.__ModuleLoader__.load({
|
|
|
4589
4715
|
return d
|
|
4590
4716
|
}
|
|
4591
4717
|
box.appendChild(mkItem(menu.isDir ? tr('explorer.menuExpand') : tr('explorer.menuOpen'), false, () => runMenuAction('open', menu)))
|
|
4592
|
-
box.appendChild(mkItem(tr('explorer.menuDownload'), false, () => runMenuAction('download', menu)))
|
|
4718
|
+
if (!localWorkspaceSession(sessionId)) box.appendChild(mkItem(tr('explorer.menuDownload'), false, () => runMenuAction('download', menu)))
|
|
4593
4719
|
box.appendChild(mkItem(tr('explorer.menuCopyRel'), false, () => runMenuAction('copy-rel', menu)))
|
|
4594
4720
|
box.appendChild(mkItem(tr('explorer.menuCopyAbs'), false, () => runMenuAction('copy-abs', menu)))
|
|
4595
4721
|
box.appendChild(mkItem(tr('explorer.menuRename'), false, () => runMenuAction('rename', menu)))
|
|
@@ -4810,6 +4936,10 @@ window.__ModuleLoader__.load({
|
|
|
4810
4936
|
const view = viewRef.current
|
|
4811
4937
|
const timer = setInterval(() => {
|
|
4812
4938
|
fetchRemoteStatus(sessionId).then((next) => { if (next && viewRef.current === view) setStatus(next) })
|
|
4939
|
+
if (localWorkspaceSession(sessionId)) {
|
|
4940
|
+
loadDir(root, { force: true, quiet: true })
|
|
4941
|
+
for (const dir of expandedRef.current) if (dir !== root) loadDir(dir, { force: true, quiet: true })
|
|
4942
|
+
}
|
|
4813
4943
|
}, 5000)
|
|
4814
4944
|
return () => clearInterval(timer)
|
|
4815
4945
|
}, [root, sessionId, props.visible])
|
|
@@ -4881,7 +5011,7 @@ window.__ModuleLoader__.load({
|
|
|
4881
5011
|
getAnchorRect: () => ({ left: menu.x, top: menu.y, right: menu.x, bottom: menu.y, width: 0, height: 0 }),
|
|
4882
5012
|
items: [
|
|
4883
5013
|
{ id: 'open', label: menu.isDir ? tr('explorer.menuExpand') : tr('explorer.menuOpen') },
|
|
4884
|
-
{ id: 'download', label: tr('explorer.menuDownload') },
|
|
5014
|
+
...(!localWorkspaceSession(sessionId) ? [{ id: 'download', label: tr('explorer.menuDownload') }] : []),
|
|
4885
5015
|
{ id: 'copy-rel', label: tr('explorer.menuCopyRel') },
|
|
4886
5016
|
{ id: 'copy-abs', label: tr('explorer.menuCopyAbs') },
|
|
4887
5017
|
{ id: 'rename', label: tr('explorer.menuRename') },
|
|
@@ -5174,10 +5304,11 @@ window.__ModuleLoader__.load({
|
|
|
5174
5304
|
const remoteDrafts = new Map()
|
|
5175
5305
|
const pendingFileSaves = new Map()
|
|
5176
5306
|
function RemoteFileTab(props) {
|
|
5307
|
+
const tr = (key, params) => workspaceText(key, props.scope?.sessionId, params)
|
|
5177
5308
|
const { tab, scope } = props
|
|
5178
5309
|
const path = tab.path || ''
|
|
5179
5310
|
const fileSessionId = scope && scope.sessionId
|
|
5180
|
-
const [data, setData] = React.useState(() => fileViewMemory.get(
|
|
5311
|
+
const [data, setData] = React.useState(() => fileViewMemory.get(workspaceMemoryKey(fileSessionId) + '\0' + path)?.data || null)
|
|
5181
5312
|
const [err, setErr] = React.useState('')
|
|
5182
5313
|
const [loading, setLoading] = React.useState(true)
|
|
5183
5314
|
const [localCopy, setLocalCopy] = React.useState(null)
|
|
@@ -5188,7 +5319,7 @@ window.__ModuleLoader__.load({
|
|
|
5188
5319
|
const [edit, setEdit] = React.useState(false)
|
|
5189
5320
|
const [draft, setDraft] = React.useState('')
|
|
5190
5321
|
const [saving, setSaving] = React.useState(false)
|
|
5191
|
-
const draftKey =
|
|
5322
|
+
const draftKey = workspaceMemoryKey(fileSessionId) + '\0' + path
|
|
5192
5323
|
const draftRecord = remoteDrafts.get(draftKey)
|
|
5193
5324
|
const fileViewRef = React.useRef(draftKey)
|
|
5194
5325
|
fileViewRef.current = draftKey
|
|
@@ -5527,7 +5658,7 @@ window.__ModuleLoader__.load({
|
|
|
5527
5658
|
try {
|
|
5528
5659
|
disposers.push(bs.registerTab({
|
|
5529
5660
|
id: SIDEBAR_EXPLORER_ID,
|
|
5530
|
-
title: () => tr('
|
|
5661
|
+
title: () => tr('workspace.files'),
|
|
5531
5662
|
icon: (size) => React.createElement('span', { style: { fontSize: (size || 14), lineHeight: 1 } }, '🌐'),
|
|
5532
5663
|
order: 55,
|
|
5533
5664
|
single: true,
|
|
@@ -5699,6 +5830,28 @@ window.__ModuleLoader__.load({
|
|
|
5699
5830
|
if (/^[A-Za-z]:/.test(relBody) || /^\//.test(relBody)) return toRemote(relBody)
|
|
5700
5831
|
return remoteRoot + remoteSep + toRemote(relBody)
|
|
5701
5832
|
}
|
|
5833
|
+
function localPathForCoreAddress(parsed, cwd) {
|
|
5834
|
+
if (!localWorkspaceSession(parsed.sessionId)) return null
|
|
5835
|
+
const root = String(cwd || '').replace(/[\\/]+$/, '') || '/'
|
|
5836
|
+
const win = /^(?:[a-z]:|\\\\)/i.test(root)
|
|
5837
|
+
const value = String(parsed.path || '')
|
|
5838
|
+
const absolute = /^(?:[a-z]:[\\/]|[\\/])/i.test(value) ? value : joinRemote(root, value)
|
|
5839
|
+
const canonical = text => {
|
|
5840
|
+
const parts = []
|
|
5841
|
+
for (const part of (win ? text.replace(/\\/g, '/') : text).split('/')) {
|
|
5842
|
+
if (part === '.') continue
|
|
5843
|
+
if (part === '..') { if (parts.length > 1) parts.pop() }
|
|
5844
|
+
else parts.push(part)
|
|
5845
|
+
}
|
|
5846
|
+
const result = parts.join('/').replace(/\/$/, '') || '/'
|
|
5847
|
+
return win ? result.toLowerCase() : result
|
|
5848
|
+
}
|
|
5849
|
+
const base = canonical(root), target = canonical(absolute)
|
|
5850
|
+
return target === base || target.startsWith(base === '/' ? '/' : base + '/') ? absolute : null
|
|
5851
|
+
}
|
|
5852
|
+
function workspacePathForCoreAddress(parsed, cwd) {
|
|
5853
|
+
return remotePathForCoreAddress(parsed, cwd) || (remoteIdeState.enabled ? localPathForCoreAddress(parsed, cwd) : null)
|
|
5854
|
+
}
|
|
5702
5855
|
function NativeExplorer(props) {
|
|
5703
5856
|
const info = props.useTabInfo()
|
|
5704
5857
|
const [expanded, setExpanded] = React.useState(() => explorerMemory.get(props.sessionId)?.expanded || [])
|
|
@@ -5735,7 +5888,7 @@ window.__ModuleLoader__.load({
|
|
|
5735
5888
|
// Resolve from the current navigation on every render. Keeping only an
|
|
5736
5889
|
// initial path in state made same-tab navigation continue reading the old file.
|
|
5737
5890
|
const [, invalidate] = React.useState(0)
|
|
5738
|
-
const remotePath = parsed ?
|
|
5891
|
+
const remotePath = parsed ? workspacePathForCoreAddress(parsed, sessionCwdFor(sessionId)) : null
|
|
5739
5892
|
React.useEffect(() => {
|
|
5740
5893
|
const changed = () => invalidate((version) => version + 1)
|
|
5741
5894
|
mirrorWatchers.add(changed)
|
|
@@ -5784,8 +5937,9 @@ window.__ModuleLoader__.load({
|
|
|
5784
5937
|
} catch { return '' }
|
|
5785
5938
|
}
|
|
5786
5939
|
// The shipped workspace-files command opens kind "files". Route that
|
|
5787
|
-
// intent before navigation, using the captured session's binding
|
|
5788
|
-
//
|
|
5940
|
+
// intent before navigation, using the captured session's binding. Proven
|
|
5941
|
+
// local projects now share this explorer; unknown roots and other kinds
|
|
5942
|
+
// retain the host's original routing.
|
|
5789
5943
|
function routeWorkspaceFiles(sidebar) {
|
|
5790
5944
|
const originals = new Map(), pending = new Map()
|
|
5791
5945
|
let disposed = false
|
|
@@ -5805,7 +5959,7 @@ window.__ModuleLoader__.load({
|
|
|
5805
5959
|
if (sessionIndex == null && sidebar.mounted?.getSnapshot?.() !== sessionId) return
|
|
5806
5960
|
const remote = mirrorForCwd(sessionCwdFor(sessionId), MIRRORS.list)
|
|
5807
5961
|
const next = args.slice()
|
|
5808
|
-
next[kindIndex] = remote ? NATIVE_EXPLORER : kind
|
|
5962
|
+
next[kindIndex] = remote || localWorkspaceSession(sessionId) ? NATIVE_EXPLORER : kind
|
|
5809
5963
|
return Reflect.apply(original, owner, next)
|
|
5810
5964
|
}
|
|
5811
5965
|
if (MIRRORS.loaded) return open()
|
|
@@ -5867,8 +6021,8 @@ window.__ModuleLoader__.load({
|
|
|
5867
6021
|
if (previous) { try { previous() } catch { /* already released */ } }
|
|
5868
6022
|
disposeExplorer = tabs.register({
|
|
5869
6023
|
id: NATIVE_EXPLORER, kind: NATIVE_EXPLORER,
|
|
5870
|
-
title: () => tr('
|
|
5871
|
-
...(withGuide ? { guide: [{ order: 55, title: () => tr('
|
|
6024
|
+
title: () => tr('workspace.files'),
|
|
6025
|
+
...(withGuide ? { guide: [{ order: 55, title: () => tr('workspace.files') }] } : {}),
|
|
5872
6026
|
})
|
|
5873
6027
|
guideListed = withGuide
|
|
5874
6028
|
}
|
|
@@ -5896,7 +6050,7 @@ window.__ModuleLoader__.load({
|
|
|
5896
6050
|
}, 'dsh-remote.start-card-owner')
|
|
5897
6051
|
})
|
|
5898
6052
|
inner.effect(() => tabs.register({ id: NATIVE_WELCOME, kind: NATIVE_WELCOME, title: () => tr('ide.welcome') }), 'dsh-remote.native-welcome-type')
|
|
5899
|
-
inner.effect(() => tabs.register({ id: NATIVE_CHANGES, kind: NATIVE_CHANGES, title: () => tr('
|
|
6053
|
+
inner.effect(() => tabs.register({ id: NATIVE_CHANGES, kind: NATIVE_CHANGES, title: () => tr('workspace.git') }), 'dsh-remote.native-changes-type')
|
|
5900
6054
|
inner.effect(() => tabs.register({
|
|
5901
6055
|
id: NATIVE_FILE, kind: NATIVE_FILE, keepMounted: true,
|
|
5902
6056
|
patterns: ['dsh-resource://dsh-remote/**'],
|
|
@@ -5908,10 +6062,9 @@ window.__ModuleLoader__.load({
|
|
|
5908
6062
|
// `dsh-resource://file/**` in the `fallback` band and reads locally.
|
|
5909
6063
|
// better-sidebar also registers an extension-band editor, so the more
|
|
5910
6064
|
// specific session/** pattern below must win the pattern-length tie-break.
|
|
5911
|
-
// `canOpen`
|
|
5912
|
-
//
|
|
5913
|
-
//
|
|
5914
|
-
// built-in preview and behave exactly as they did before.
|
|
6065
|
+
// `canOpen` guards execution-world selection. Proven remote links use
|
|
6066
|
+
// SFTP; in IDE mode, project-scoped local links share this editor. Other
|
|
6067
|
+
// local links and cold/unknown contexts retain the native host viewer.
|
|
5915
6068
|
//
|
|
5916
6069
|
// Registration is wrapped because the address-claiming half of this
|
|
5917
6070
|
// contract (`patterns` + `canOpen`) is not something every DSH line
|
|
@@ -5938,12 +6091,12 @@ window.__ModuleLoader__.load({
|
|
|
5938
6091
|
// file that was never synced dies with ENOENT and shows nothing at
|
|
5939
6092
|
// all. This editor opens the file over SFTP and RENDERS it via the
|
|
5940
6093
|
// host's MarkdownText (source only when the primitive is missing),
|
|
5941
|
-
// so claiming is no longer a downgrade. Local
|
|
5942
|
-
//
|
|
6094
|
+
// so claiming is no longer a downgrade. Local project links also
|
|
6095
|
+
// share the editor when IDE mode is enabled, proven below.
|
|
5943
6096
|
const cwd = sessionCwdFor(parsed.sessionId)
|
|
5944
6097
|
// `MIRRORS.loaded` is checked so a cold start NEVER steals a local
|
|
5945
|
-
// link:
|
|
5946
|
-
//
|
|
6098
|
+
// link: only a successfully loaded registry can distinguish a
|
|
6099
|
+
// local project from a mirror.
|
|
5947
6100
|
if (!cwd || !MIRRORS.loaded) return false
|
|
5948
6101
|
// Ask the SAME resolver the body uses, not merely whether the cwd
|
|
5949
6102
|
// is a mirror. A remote session can cite a LOCAL absolute path
|
|
@@ -5951,7 +6104,7 @@ window.__ModuleLoader__.load({
|
|
|
5951
6104
|
// the old check claimed it here, then NativeRemoteLink rejected it
|
|
5952
6105
|
// and showed file.linkUnresolved. Refusing it here hands the address
|
|
5953
6106
|
// back to the built-in LOCAL editor, which is the correct owner.
|
|
5954
|
-
return !!
|
|
6107
|
+
return !!workspacePathForCoreAddress(parsed, cwd)
|
|
5955
6108
|
},
|
|
5956
6109
|
title: (address) => {
|
|
5957
6110
|
const parsed = parseCoreFileAddress(address)
|
|
@@ -5999,6 +6152,7 @@ window.__ModuleLoader__.load({
|
|
|
5999
6152
|
}
|
|
6000
6153
|
|
|
6001
6154
|
function RemoteGitTab(props) {
|
|
6155
|
+
const tr = (key, params) => workspaceText(key, props.sessionId, params)
|
|
6002
6156
|
const key = String(props.sessionId || '')
|
|
6003
6157
|
const initial = gitViewMemory.get(key)
|
|
6004
6158
|
const [git, setGit] = React.useState({ key, data: null, error: '', busy: false, revision: 0 })
|
|
@@ -6331,7 +6485,7 @@ window.__ModuleLoader__.load({
|
|
|
6331
6485
|
function RemoteIdeToggle(props) {
|
|
6332
6486
|
const mirror = useSessionMirror(props.sessionId, props.useSessions)
|
|
6333
6487
|
const state = useRemoteIdeState()
|
|
6334
|
-
if (!mirror) return null
|
|
6488
|
+
if (!mirror && !localWorkspaceSession(props.sessionId)) return null
|
|
6335
6489
|
const supported = !!remoteIdeController?.mounted?.getSnapshot && typeof remoteIdeController.openResourceIn === 'function'
|
|
6336
6490
|
return React.createElement('button', {
|
|
6337
6491
|
type: 'button', 'data-rw-ide-toggle': '', 'aria-pressed': state.enabled,
|
|
@@ -6424,6 +6578,7 @@ window.__ModuleLoader__.load({
|
|
|
6424
6578
|
}
|
|
6425
6579
|
}
|
|
6426
6580
|
function RemoteIdeWelcome() {
|
|
6581
|
+
const tr = (key, params) => workspaceText(key, remoteIdeController?.mounted?.getSnapshot?.(), params)
|
|
6427
6582
|
return React.createElement('article', { 'data-rw-ide-welcome': '', style: { boxSizing: 'border-box', width: '100%', minHeight: '100%', padding: 'clamp(24px,5vw,64px)', color: T.label, overflowWrap: 'anywhere' } },
|
|
6428
6583
|
React.createElement('div', { style: { maxWidth: 560, margin: 'auto' } },
|
|
6429
6584
|
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 10, color: T.muted, fontSize: 12, marginBottom: 14 } }, React.createElement(WorkbenchIcon, { name: 'remote', size: 24 }), 'dsh / remote'),
|
|
@@ -6462,7 +6617,7 @@ window.__ModuleLoader__.load({
|
|
|
6462
6617
|
const dragCleanup = React.useRef(null)
|
|
6463
6618
|
const controller = remoteIdeController
|
|
6464
6619
|
const sizes = remoteIdeWidths(width, state)
|
|
6465
|
-
const mirror = sessionId ?
|
|
6620
|
+
const mirror = sessionId ? workspaceSummary(sessionId) : null
|
|
6466
6621
|
const active = !!(state.enabled && sessionId && mirror && controller)
|
|
6467
6622
|
React.useEffect(() => {
|
|
6468
6623
|
const update = () => {
|
package/lib/index.js
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
// Plugin Config MUST be a schemastery schema (zod rejects the undefined row config).
|
|
21
21
|
import { WorkspaceSearches, createSearchRoutes } from './workspace-search.js'
|
|
22
22
|
import { createGitRoutes } from './remote-git.js'
|
|
23
|
+
import { createLocalWorkspacePool } from './local-workspace.js'
|
|
23
24
|
import { LOCAL_MUTATION_TOOLS, remoteLocalMutationDecision } from './local-mutation.js'
|
|
24
25
|
import { fileChange, changeOutput, presentFileChange } from './file-changes.js'
|
|
25
26
|
import { captureRemoteFile, atomicRemoteWrite } from './remote-write.js'
|
|
@@ -61,7 +62,7 @@ import { formatAuditLine, readAuditLines } from './audit.js'
|
|
|
61
62
|
import { openLocalFolder } from './open-folder.js'
|
|
62
63
|
|
|
63
64
|
import { selfDir, diskVersion, LOADED_VERSION, gtVersion, fetchLatestVersion, applyUpdate, persistUpdateMode, readUpdateMode, reloadSelf, scheduleSelfReload, lastSelfReload, isInstalledCopy, writeFileAtomic } from './update.js'
|
|
64
|
-
import {
|
|
65
|
+
import { startHeartbeat, pseudonym, heartbeatUrl, hasPersistedId, installIdPath, telemetryAllowed } from './telemetry.js'
|
|
65
66
|
import { loadMachines as _loadMachines, saveMachines as _saveMachines, sanitizeMachine as _sanitizeMachine, applyMachine as _applyMachine, machineId as _machineId, normalizeMachineGroup, filterMachinesByGroup, resolveProbeCredentials } from './registry.js'
|
|
66
67
|
import { registerHttpTransports } from './http-transport.js'
|
|
67
68
|
import { createHostApi } from './host-api.js'
|
|
@@ -488,10 +489,12 @@ export async function apply(ctx, config) {
|
|
|
488
489
|
|
|
489
490
|
// ── 安装心跳(日活统计)─────────────────────────────────────────────────
|
|
490
491
|
// 旁路:不 await、不阻塞加载、失败静默(见 lib/telemetry.js 的隐私与失败策略)。
|
|
491
|
-
//
|
|
492
|
-
//
|
|
492
|
+
// 默认开启;profile 配置 `telemetry: false` 或已持久化的用户选择可以关闭。
|
|
493
|
+
// 周期检查重新读取生效值,用户关闭后不继续发送。上报的是本插件专属 HMAC
|
|
493
494
|
// 伪名,原始安装 id 与任何机器信息都不离开本机。
|
|
494
|
-
|
|
495
|
+
ctx.effect(() => startHeartbeat(dshBase(), LOADED_VERSION, {
|
|
496
|
+
allowed: () => telemetryAllowed(dshBase(), config.telemetry),
|
|
497
|
+
}), 'dsh-remote.heartbeat')
|
|
495
498
|
|
|
496
499
|
// ── terminal credential bridge (saved passwords for the `remote ssh` shell) ─
|
|
497
500
|
// The generated terminal launcher spawns the OS ssh, which cannot receive the
|
|
@@ -1702,7 +1705,9 @@ export async function apply(ctx, config) {
|
|
|
1702
1705
|
* a local (non-mirror) session is refused rather than falling back to the
|
|
1703
1706
|
* active machine. Requests with no hint keep the picker/settings active pool.
|
|
1704
1707
|
*/
|
|
1705
|
-
const
|
|
1708
|
+
const localWorkspacePools = new Map()
|
|
1709
|
+
ctx.effect(() => () => localWorkspacePools.clear(), 'dsh-remote.local-workspaces')
|
|
1710
|
+
const resolveRequestBinding = async (req, body = {}, { allowLocal = false } = {}) => {
|
|
1706
1711
|
const hint = requestSessionHint(req, body)
|
|
1707
1712
|
let cwd = hint.local
|
|
1708
1713
|
if (hint.sessionId) {
|
|
@@ -1727,6 +1732,15 @@ export async function apply(ctx, config) {
|
|
|
1727
1732
|
local: false,
|
|
1728
1733
|
}
|
|
1729
1734
|
}
|
|
1735
|
+
if (allowLocal && hint.sessionId) {
|
|
1736
|
+
const root = path.resolve(cwd)
|
|
1737
|
+
let localPool = localWorkspacePools.get(root)
|
|
1738
|
+
if (!localPool) {
|
|
1739
|
+
localPool = await createLocalWorkspacePool(root)
|
|
1740
|
+
localWorkspacePools.set(root, localPool)
|
|
1741
|
+
}
|
|
1742
|
+
return { pool: localPool, ws: root, host: '', username: '', port: 0, mirrorDir: null, bound: true, local: true }
|
|
1743
|
+
}
|
|
1730
1744
|
const err = new Error(
|
|
1731
1745
|
'this session is LOCAL — its workspace is not a remote mirror, so there is no remote host to act on. '
|
|
1732
1746
|
+ 'Refusing rather than falling back to the active machine.',
|
|
@@ -1769,6 +1783,23 @@ export async function apply(ctx, config) {
|
|
|
1769
1783
|
}
|
|
1770
1784
|
}
|
|
1771
1785
|
|
|
1786
|
+
// Local workspace UI access is explicit and session-bound. Unmarked legacy
|
|
1787
|
+
// requests and all rw_* tools keep refusing local sessions, as before.
|
|
1788
|
+
const resolveWorkbenchBinding = async (req, body = {}) => {
|
|
1789
|
+
const q = new URL(req.url || '/', 'http://localhost').searchParams
|
|
1790
|
+
const local = q.get('workspace') === 'local' || body.workspace === 'local'
|
|
1791
|
+
const binding = await resolveRequestBinding(req, body, { allowLocal: local })
|
|
1792
|
+
if (local && !binding.local) throw Object.assign(new Error('Workspace execution context changed; reload before retrying'), { httpStatus: 409 })
|
|
1793
|
+
const route = new URL(req.url || '/', 'http://localhost').pathname
|
|
1794
|
+
if (binding.local && ['/dsh-remote/ls', '/dsh-remote/read', '/dsh-remote/write', '/dsh-remote/fs'].includes(route)) {
|
|
1795
|
+
for (const field of ['path', 'dest']) {
|
|
1796
|
+
const target = body[field] || q.get(field)
|
|
1797
|
+
if (target) await binding.pool.checkPath(String(target), { mutation: route === '/dsh-remote/write' || route === '/dsh-remote/fs' })
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
return binding
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1772
1803
|
// ── session-bound remote binding (the authoritative tool path) ─────────────
|
|
1773
1804
|
|
|
1774
1805
|
/**
|
|
@@ -4214,6 +4245,17 @@ export async function apply(ctx, config) {
|
|
|
4214
4245
|
|
|
4215
4246
|
// ── route helpers ─────────────────────────────────────────────────────────
|
|
4216
4247
|
const routes = [
|
|
4248
|
+
{
|
|
4249
|
+
kind: 'exact', path: '/dsh-remote/workspace-context',
|
|
4250
|
+
handler: async (req, res) => {
|
|
4251
|
+
if (req.method !== 'GET') return sendJson(res, 405, { ok: false, error: 'method not allowed' })
|
|
4252
|
+
try {
|
|
4253
|
+
if (!requestSessionHint(req).sessionId) return sendJson(res, 400, { ok: false, error: 'sessionId is required' })
|
|
4254
|
+
const b = await resolveRequestBinding(req, {}, { allowLocal: true })
|
|
4255
|
+
return sendJson(res, 200, { ok: true, kind: b.local ? 'local' : 'remote', root: b.ws, host: b.host, username: b.username, port: b.port, connected: b.local || !!b.pool.client })
|
|
4256
|
+
} catch (error) { return sendJson(res, error.httpStatus || 500, { ok: false, error: error.message || String(error) }) }
|
|
4257
|
+
},
|
|
4258
|
+
},
|
|
4217
4259
|
{
|
|
4218
4260
|
kind: 'exact',
|
|
4219
4261
|
path: '/dsh-remote/status',
|
|
@@ -4370,10 +4412,10 @@ export async function apply(ctx, config) {
|
|
|
4370
4412
|
aliasOf, activeMachine, startAutoPush, applyRequestedMachine, registerMirroredWorkspace, localPickCapability,
|
|
4371
4413
|
pickLocalNative, listLocalDrives, probeMachineRecord, setCurrent, knownHostsFile, prepareMirrorTarget, machineForId: (id) => machines.find((m) => m.id === id),
|
|
4372
4414
|
}),
|
|
4373
|
-
...createSearchRoutes({ searches: workspaceSearches, sendJson, readBody, resolveRequestBinding, isIgnoredFor: searchIgnoreMatcher }),
|
|
4374
|
-
...createGitRoutes({ sendJson, resolveRequestBinding, decodeBuf, config }),
|
|
4415
|
+
...createSearchRoutes({ searches: workspaceSearches, sendJson, readBody, resolveRequestBinding: resolveWorkbenchBinding, isIgnoredFor: searchIgnoreMatcher }),
|
|
4416
|
+
...createGitRoutes({ sendJson, resolveRequestBinding: resolveWorkbenchBinding, decodeBuf, config }),
|
|
4375
4417
|
...createFsRoutes({
|
|
4376
|
-
sendJson, readBody, resolveRequestBinding, decodeBuf, encodeText, audit, config, mirrorDirFor,
|
|
4418
|
+
sendJson, readBody, resolveRequestBinding: resolveWorkbenchBinding, decodeBuf, encodeText, audit, config, mirrorDirFor,
|
|
4377
4419
|
onRemoteMutation: () => { if (remoteSkills) remoteSkills.invalidate() },
|
|
4378
4420
|
}),
|
|
4379
4421
|
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Local execution-world adapter for the shared workspace UI. Never used by rw_*
|
|
2
|
+
// Agent tools. Every filesystem operation is rooted in a server-resolved session
|
|
3
|
+
// directory; neither an active SSH machine nor a client-supplied root is used.
|
|
4
|
+
import fs from 'node:fs/promises'
|
|
5
|
+
import path from 'node:path'
|
|
6
|
+
import { spawn } from 'node:child_process'
|
|
7
|
+
|
|
8
|
+
export const sameLocalPath = (a, b, grammar = path) => grammar.relative(a, b) === ''
|
|
9
|
+
const denied = () => Object.assign(new Error('Path is outside this local workspace (including symlink targets)'), { httpStatus: 403, code: 'LOCAL_WORKSPACE_PATH' })
|
|
10
|
+
const inside = (root, target) => { const rel = path.relative(root, target); return !path.isAbsolute(rel) && rel !== '..' && !rel.startsWith('..' + path.sep) }
|
|
11
|
+
const attrs = stat => ({
|
|
12
|
+
size: stat.size, mtime: stat.mtimeMs / 1000, mode: stat.mode,
|
|
13
|
+
isDirectory: () => stat.isDirectory(), isFile: () => stat.isFile(), isSymbolicLink: () => stat.isSymbolicLink(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export async function createLocalWorkspacePool(directory) {
|
|
17
|
+
const root = path.resolve(directory), canonical = await fs.realpath(root)
|
|
18
|
+
if (!(await fs.stat(canonical)).isDirectory()) throw Object.assign(new Error('Local workspace directory is unavailable'), { httpStatus: 404 })
|
|
19
|
+
const resolve = async (input, { mutation = false } = {}) => {
|
|
20
|
+
if (typeof input !== 'string' || !input || input.includes('\0') || !path.isAbsolute(input)) throw denied()
|
|
21
|
+
const target = path.resolve(input)
|
|
22
|
+
if (!inside(root, target) && !inside(canonical, target)) throw denied()
|
|
23
|
+
if (mutation && (sameLocalPath(root, target) || sameLocalPath(canonical, target))) throw denied()
|
|
24
|
+
// Missing children may be created, but their nearest existing ancestor must
|
|
25
|
+
// still be inside the canonical project. No symlink escape on read or save.
|
|
26
|
+
let ancestor = target
|
|
27
|
+
for (;;) {
|
|
28
|
+
try { if (!inside(canonical, await fs.realpath(ancestor))) throw denied(); break }
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (error.code !== 'ENOENT') throw error
|
|
31
|
+
const parent = path.dirname(ancestor)
|
|
32
|
+
if (parent === ancestor) throw denied()
|
|
33
|
+
// A dangling symlink must not be treated as an ordinary missing child.
|
|
34
|
+
try { if ((await fs.lstat(ancestor)).isSymbolicLink()) throw denied() } catch (e) { if (e.code !== 'ENOENT') throw e }
|
|
35
|
+
ancestor = parent
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return target
|
|
39
|
+
}
|
|
40
|
+
const regularFile = async p => {
|
|
41
|
+
const target = await resolve(p)
|
|
42
|
+
if (!(await fs.stat(target)).isFile()) throw Object.assign(new Error('Only regular local files can be previewed'), { httpStatus: 415 })
|
|
43
|
+
return target
|
|
44
|
+
}
|
|
45
|
+
const sftp = {
|
|
46
|
+
async stat(p) { return attrs(await fs.stat(await resolve(p))) },
|
|
47
|
+
async lstat(p) { return attrs(await fs.lstat(await resolve(p))) },
|
|
48
|
+
async realpath(p) { return fs.realpath(await resolve(p)) },
|
|
49
|
+
async readdir(p) {
|
|
50
|
+
const dir = await resolve(p), names = await fs.readdir(dir)
|
|
51
|
+
return Promise.all(names.map(async filename => ({ filename, attrs: attrs(await fs.lstat(path.join(dir, filename))) })))
|
|
52
|
+
},
|
|
53
|
+
async readFile(p) { return fs.readFile(await regularFile(p)) },
|
|
54
|
+
async readPartial(p, offset, length) {
|
|
55
|
+
if (!Number.isSafeInteger(offset) || offset < 0 || !Number.isSafeInteger(length) || length < 0 || length > 4 * 1024 * 1024) throw new Error('Invalid bounded read')
|
|
56
|
+
const file = await fs.open(await regularFile(p), 'r')
|
|
57
|
+
try { const buffer = Buffer.alloc(length); const { bytesRead } = await file.read(buffer, 0, length, offset); return buffer.subarray(0, bytesRead) }
|
|
58
|
+
finally { await file.close() }
|
|
59
|
+
},
|
|
60
|
+
async mkdir(p) { return fs.mkdir(await resolve(p, { mutation: true })) },
|
|
61
|
+
async rmdir(p) { return fs.rmdir(await resolve(p, { mutation: true })) },
|
|
62
|
+
async unlink(p) { return fs.unlink(await resolve(p, { mutation: true })) },
|
|
63
|
+
async writeFile(p, bytes, options) { return fs.writeFile(await resolve(p, { mutation: true }), bytes, options) },
|
|
64
|
+
async setstat(p, data) { if (data.mode != null) await fs.chmod(await resolve(p, { mutation: true }), data.mode) },
|
|
65
|
+
async rename(from, to) {
|
|
66
|
+
const source = await resolve(from, { mutation: true }), dest = await resolve(to, { mutation: true })
|
|
67
|
+
const stat = await fs.lstat(source)
|
|
68
|
+
if (stat.isFile()) { await fs.link(source, dest); await fs.unlink(source); return }
|
|
69
|
+
try { await fs.lstat(dest); throw Object.assign(new Error('Destination already exists'), { code: 'EEXIST' }) }
|
|
70
|
+
catch (error) { if (error.code !== 'ENOENT') throw error }
|
|
71
|
+
return fs.rename(source, dest)
|
|
72
|
+
},
|
|
73
|
+
async renameOverwrite(from, to) { return fs.rename(await resolve(from, { mutation: true }), await resolve(to, { mutation: true })) },
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
checkPath: resolve,
|
|
77
|
+
async mkdirTree(p) { return fs.mkdir(await resolve(p, { mutation: true }), { recursive: true }) },
|
|
78
|
+
async removeTree(p) { return fs.rm(await resolve(p, { mutation: true }), { recursive: true }) },
|
|
79
|
+
config: { local: true }, platform: process.platform === 'win32' ? 'windows' : 'posix', local: true,
|
|
80
|
+
async detect() {}, async sftp() { return sftp },
|
|
81
|
+
// Git receives an argv array, never a POSIX command string on Windows.
|
|
82
|
+
execFile(file, args, { signal, timeoutMs = 15000, onData } = {}) {
|
|
83
|
+
if (file !== 'git') throw new Error('Only read-only Git inspection is available through this adapter')
|
|
84
|
+
return new Promise(resolveResult => {
|
|
85
|
+
let stdout = '', stderr = '', timedOut = false, settled = false
|
|
86
|
+
const env = { ...process.env }
|
|
87
|
+
for (const key of ['GIT_DIR', 'GIT_WORK_TREE', 'GIT_INDEX_FILE', 'GIT_COMMON_DIR', 'GIT_OBJECT_DIRECTORY', 'GIT_ALTERNATE_OBJECT_DIRECTORIES', 'GIT_NAMESPACE', 'GIT_PREFIX']) delete env[key]
|
|
88
|
+
const child = spawn(file, args, { cwd: root, env, shell: false, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] })
|
|
89
|
+
const append = (channel, chunk) => { const text = chunk.toString(); if (channel === 'stdout') stdout = (stdout + text).slice(0, 256 * 1024); else stderr = (stderr + text).slice(0, 256 * 1024); onData?.(channel, text) }
|
|
90
|
+
child.stdout.setEncoding('utf8'); child.stderr.setEncoding('utf8')
|
|
91
|
+
child.stdout.on('data', data => append('stdout', data)); child.stderr.on('data', data => append('stderr', data))
|
|
92
|
+
const stop = () => child.kill()
|
|
93
|
+
const timer = setTimeout(() => { timedOut = true; stop() }, timeoutMs)
|
|
94
|
+
const done = (code, error) => {
|
|
95
|
+
if (settled) return; settled = true; clearTimeout(timer); signal?.removeEventListener('abort', stop)
|
|
96
|
+
resolveResult({ code: code ?? 1, stdout, stderr: error ? String(error.message || error) : stderr, ...(timedOut ? { signal: 'TIMEOUT' } : {}) })
|
|
97
|
+
}
|
|
98
|
+
child.on('error', error => done(error.code === 'ENOENT' ? 127 : 1, error)); child.on('close', code => done(code))
|
|
99
|
+
if (signal?.aborted) stop(); else signal?.addEventListener('abort', stop, { once: true })
|
|
100
|
+
})
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
}
|
package/lib/remote-git.js
CHANGED
|
@@ -37,15 +37,16 @@ async function runGit(pool, cwd, args, signal, limit = LIMIT) {
|
|
|
37
37
|
signal?.addEventListener('abort', abort, { once: true })
|
|
38
38
|
let output = [], size = 0, tapped = false, truncated = false
|
|
39
39
|
try {
|
|
40
|
-
const
|
|
41
|
-
const
|
|
40
|
+
const argv = [ '--no-pager', '--no-optional-locks', '-c', 'core.fsmonitor=false', '-c', 'core.quotePath=false', '-c', 'color.ui=false', '-C', gitPath(cwd), ...args]
|
|
41
|
+
const options = { timeoutMs: 15000, signal: cancel.signal, onData(channel, chunk) {
|
|
42
42
|
if (channel !== 'stdout') return
|
|
43
43
|
tapped = true
|
|
44
44
|
const bytes = Buffer.from(chunk)
|
|
45
45
|
if (size < limit) output.push(bytes.subarray(0, limit - size))
|
|
46
46
|
size += bytes.length
|
|
47
47
|
if (size > limit) { truncated = true; cancel.abort() }
|
|
48
|
-
} }
|
|
48
|
+
} }
|
|
49
|
+
const result = pool.local ? await pool.execFile('git', argv, options) : await pool.exec(['git', ...argv].map(shq).join(' '), options)
|
|
49
50
|
const stdout = tapped ? Buffer.concat(output).toString('utf8') : String(result.stdout || '').slice(0, limit)
|
|
50
51
|
return { ...result, stdout, truncated: truncated || !tapped && String(result.stdout || '').length > limit }
|
|
51
52
|
} finally { signal?.removeEventListener('abort', abort) }
|
|
@@ -57,7 +58,7 @@ export async function inspectRemoteGit(binding, { action = 'status', path: relat
|
|
|
57
58
|
if (!['status', 'diff'].includes(action)) throw Object.assign(new Error('action must be status or diff'), { httpStatus: 400 })
|
|
58
59
|
if (action === 'diff' && !safeRelative(relative)) throw Object.assign(new Error('A repository-relative Git file path is required'), { httpStatus: 400 })
|
|
59
60
|
await pool.detect()
|
|
60
|
-
if (pool.platform === 'windows' && !pool.gitBashPath) return { ok: true, available: false, reason: 'unsupported-shell' }
|
|
61
|
+
if (!pool.local && pool.platform === 'windows' && !pool.gitBashPath) return { ok: true, available: false, reason: 'unsupported-shell' }
|
|
61
62
|
const top = await runGit(pool, ws, ['rev-parse', '--show-toplevel', '--show-prefix'], signal, 8192)
|
|
62
63
|
if (top.code !== 0) {
|
|
63
64
|
if (top.code === 127 || /not recognized|command not found/i.test(top.stderr || '')) return { ok: true, available: false, reason: 'git-unavailable' }
|
|
@@ -71,6 +72,7 @@ export async function inspectRemoteGit(binding, { action = 'status', path: relat
|
|
|
71
72
|
// Git canonicalizes symlinked workspace roots. Keep filtering in that same
|
|
72
73
|
// world, but return navigation paths under the user's original workspace.
|
|
73
74
|
const gitWorkspace = prefix ? joinRemotePath(repo, prefix) : repo
|
|
75
|
+
if (pool.local) await pool.checkPath(gitWorkspace)
|
|
74
76
|
const navigationPath = target => {
|
|
75
77
|
const within = relPathUnder(gitWorkspace, target)
|
|
76
78
|
return within === null ? null : within ? joinRemotePath(ws, within) : ws
|
package/lib/routes-fs.js
CHANGED
|
@@ -38,19 +38,19 @@ export function createFsRoutes({
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
const checkExpectedRevision = (body, snapshot) => {
|
|
41
|
+
const checkExpectedRevision = (body, snapshot, local = false) => {
|
|
42
42
|
if (body.expectedRevision != null) {
|
|
43
43
|
if (typeof body.expectedRevision !== 'string' || !/^[a-f0-9]{64}$/.test(body.expectedRevision)) {
|
|
44
44
|
throw Object.assign(new Error('expectedRevision must be a SHA-256 revision returned by a complete file preview'), { httpStatus: 400 })
|
|
45
45
|
}
|
|
46
46
|
if (!snapshot.stat || !snapshot.bytes || remoteRevision(snapshot.bytes) !== body.expectedRevision) {
|
|
47
|
-
throw Object.assign(new Error('远端文件已变化,已放弃保存。请重新读取并比较后重试。'), { httpStatus: 409, code: 'REMOTE_FILE_CONFLICT' })
|
|
47
|
+
throw Object.assign(new Error(local ? '本地文件已变化,已放弃保存。请重新读取并比较后重试。' : '远端文件已变化,已放弃保存。请重新读取并比较后重试。'), { httpStatus: 409, code: 'REMOTE_FILE_CONFLICT' })
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
if (body.expectedMtime != null) {
|
|
51
51
|
if (!Number.isFinite(Number(body.expectedMtime))) throw Object.assign(new Error('expectedMtime must be a finite timestamp'), { httpStatus: 400 })
|
|
52
52
|
if (!snapshot.stat || snapshot.stat.mtime !== Number(body.expectedMtime)) {
|
|
53
|
-
throw Object.assign(new Error('远端文件已变化,已放弃保存。请重新读取并比较后重试。'), { httpStatus: 409, code: 'REMOTE_FILE_CONFLICT' })
|
|
53
|
+
throw Object.assign(new Error(local ? '本地文件已变化,已放弃保存。请重新读取并比较后重试。' : '远端文件已变化,已放弃保存。请重新读取并比较后重试。'), { httpStatus: 409, code: 'REMOTE_FILE_CONFLICT' })
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -73,7 +73,7 @@ export function createFsRoutes({
|
|
|
73
73
|
try { body = JSON.parse((await readBody(req)) || '{}') } catch { body = {} }
|
|
74
74
|
}
|
|
75
75
|
const hint = requestSessionHint(req, body)
|
|
76
|
-
const b = await bindOrReply(req, res, hint)
|
|
76
|
+
const b = await bindOrReply(req, res, { ...body, ...hint })
|
|
77
77
|
if (!b) return
|
|
78
78
|
// Identity echo (external-switch defense): name the machine this
|
|
79
79
|
// listing is answered for, straight from the pool's target — the
|
|
@@ -93,7 +93,7 @@ export function createFsRoutes({
|
|
|
93
93
|
: (body.path ? String(body.path) : (b.ws || ''))
|
|
94
94
|
const canon = normalizeRemotePath(raw)
|
|
95
95
|
const win = b.pool.platform === 'windows'
|
|
96
|
-
if (canon === '/' || raw === '' || raw === '/') {
|
|
96
|
+
if (!b.local && (canon === '/' || raw === '' || raw === '/')) {
|
|
97
97
|
if (win || b.pool.platform !== 'posix') {
|
|
98
98
|
const drives = await listRemoteDrives(b.pool)
|
|
99
99
|
if (drives.length) return sendJson(res, 200, { path: '', platform: 'windows', items: drives, bound: b.bound, machine })
|
|
@@ -115,7 +115,7 @@ export function createFsRoutes({
|
|
|
115
115
|
machine,
|
|
116
116
|
})
|
|
117
117
|
} catch (err) {
|
|
118
|
-
return sendJson(res, 500, { error: String((err && err.message) || err) })
|
|
118
|
+
return sendJson(res, err.httpStatus || 500, { error: String((err && err.message) || err) })
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
},
|
|
@@ -156,6 +156,7 @@ export function createFsRoutes({
|
|
|
156
156
|
return sendJson(res, 200, preview)
|
|
157
157
|
} catch (err) {
|
|
158
158
|
if (missingRemoteFile(err)) {
|
|
159
|
+
if (b.local) return sendJson(res, 404, { ok: false, source: 'local', path: target, code: 'LOCAL_FILE_NOT_FOUND', error: '本地项目中不存在此文件。' })
|
|
159
160
|
const localCopy = await localCopyInfo(b, target)
|
|
160
161
|
return sendJson(res, 404, { ok: false, source: 'remote', path: target,
|
|
161
162
|
code: localCopy ? 'REMOTE_FILE_MISSING_LOCAL_COPY' : 'REMOTE_FILE_NOT_FOUND',
|
|
@@ -163,7 +164,7 @@ export function createFsRoutes({
|
|
|
163
164
|
...(localCopy ? { localCopy } : {}),
|
|
164
165
|
})
|
|
165
166
|
}
|
|
166
|
-
return sendJson(res, 500, { ok: false, error: 'read failed: ' + ((err && err.message) || err) })
|
|
167
|
+
return sendJson(res, err.httpStatus || 500, { ok: false, error: 'read failed: ' + ((err && err.message) || err) })
|
|
167
168
|
}
|
|
168
169
|
} catch (err) {
|
|
169
170
|
return sendJson(res, 500, { ok: false, error: String((err && err.message) || err) })
|
|
@@ -183,12 +184,12 @@ export function createFsRoutes({
|
|
|
183
184
|
if (!b) return
|
|
184
185
|
const sftp = await b.pool.sftp()
|
|
185
186
|
const before = await captureRemoteFile(sftp, p, { read: body.expectedRevision != null, maxReadBytes: 2 * 1024 * 1024 })
|
|
186
|
-
checkExpectedRevision(body, before)
|
|
187
|
+
checkExpectedRevision(body, before, b.local)
|
|
187
188
|
const buf = encodeText(String(body.content ?? ''), body.encoding || config.encoding)
|
|
188
189
|
if (!before.stat) await mkdirRemoteDirs(sftp, remoteDirname(p))
|
|
189
190
|
await atomicRemoteWrite(sftp, before, buf)
|
|
190
|
-
audit('write', `write ${p}`, 0, b)
|
|
191
|
-
onRemoteMutation()
|
|
191
|
+
if (!b.local) audit('write', `write ${p}`, 0, b)
|
|
192
|
+
if (!b.local) onRemoteMutation()
|
|
192
193
|
const st2 = await sftp.stat(p).catch(() => null)
|
|
193
194
|
return sendJson(res, 200, { ok: true, bytes: buf.byteLength, mtime: st2 ? st2.mtime : Math.floor(Date.now() / 1000), revision: remoteRevision(buf) })
|
|
194
195
|
} catch (err) {
|
|
@@ -206,13 +207,15 @@ export function createFsRoutes({
|
|
|
206
207
|
const op = String(body.op || '')
|
|
207
208
|
const b = await bindOrReply(req, res, body)
|
|
208
209
|
if (!b) return
|
|
210
|
+
if (b.local && op === 'download') return sendJson(res, 400, { ok: false, error: 'Local files are already on this host; no mirror download is needed' })
|
|
209
211
|
const sftp = await b.pool.sftp()
|
|
210
212
|
if (op === 'mkdir') {
|
|
211
213
|
const p = normalizeRemotePath(String(body.path || ''))
|
|
212
214
|
if (!p || p === '/') return sendJson(res, 400, { ok: false, error: 'path required' })
|
|
213
|
-
await
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
if (b.local) await b.pool.mkdirTree(p)
|
|
216
|
+
else await mkdirRemoteDirs(sftp, p)
|
|
217
|
+
if (!b.local) audit('mkdir', `mkdir ${p}`, 0, b)
|
|
218
|
+
if (!b.local) onRemoteMutation()
|
|
216
219
|
return sendJson(res, 200, { ok: true })
|
|
217
220
|
}
|
|
218
221
|
if (op === 'rename') {
|
|
@@ -220,8 +223,8 @@ export function createFsRoutes({
|
|
|
220
223
|
const d = normalizeRemotePath(String(body.dest || ''))
|
|
221
224
|
if (!p || !d) return sendJson(res, 400, { ok: false, error: 'path and dest required' })
|
|
222
225
|
await sftp.rename(p, d)
|
|
223
|
-
audit('move', `move ${p} → ${d}`, 0, b)
|
|
224
|
-
onRemoteMutation()
|
|
226
|
+
if (!b.local) audit('move', `move ${p} → ${d}`, 0, b)
|
|
227
|
+
if (!b.local) onRemoteMutation()
|
|
225
228
|
return sendJson(res, 200, { ok: true })
|
|
226
229
|
}
|
|
227
230
|
if (op === 'remove') {
|
|
@@ -230,12 +233,13 @@ export function createFsRoutes({
|
|
|
230
233
|
const st = await sftp.stat(p).catch(() => null)
|
|
231
234
|
if (!st) return sendJson(res, 404, { ok: false, error: 'not found' })
|
|
232
235
|
if (st.isDirectory && st.isDirectory()) {
|
|
233
|
-
await
|
|
236
|
+
if (b.local) await b.pool.removeTree(p)
|
|
237
|
+
else await removeRemoteTree(sftp, p)
|
|
234
238
|
} else {
|
|
235
239
|
await sftp.unlink(p)
|
|
236
240
|
}
|
|
237
|
-
audit('remove', `remove ${p}`, 0, b)
|
|
238
|
-
onRemoteMutation()
|
|
241
|
+
if (!b.local) audit('remove', `remove ${p}`, 0, b)
|
|
242
|
+
if (!b.local) onRemoteMutation()
|
|
239
243
|
return sendJson(res, 200, { ok: true })
|
|
240
244
|
}
|
|
241
245
|
if (op === 'write' || op === 'append') {
|
|
@@ -245,13 +249,13 @@ export function createFsRoutes({
|
|
|
245
249
|
read: op === 'append' || body.expectedRevision != null,
|
|
246
250
|
maxReadBytes: config.maxFileBytes > 0 ? Math.min(config.maxFileBytes, 2 * 1024 * 1024) : 2 * 1024 * 1024,
|
|
247
251
|
})
|
|
248
|
-
checkExpectedRevision(body, before)
|
|
252
|
+
checkExpectedRevision(body, before, b.local)
|
|
249
253
|
const content = op === 'append' && before.bytes ? decodeBuf(before.bytes, body.encoding || config.encoding) : ''
|
|
250
254
|
const buf = encodeText(content + String(body.content ?? ''), body.encoding || config.encoding)
|
|
251
255
|
if (op === 'write' && !before.stat) await mkdirRemoteDirs(sftp, remoteDirname(p))
|
|
252
256
|
await atomicRemoteWrite(sftp, before, buf)
|
|
253
|
-
audit(op, `${op} ${p}`, 0, b)
|
|
254
|
-
onRemoteMutation()
|
|
257
|
+
if (!b.local) audit(op, `${op} ${p}`, 0, b)
|
|
258
|
+
if (!b.local) onRemoteMutation()
|
|
255
259
|
return sendJson(res, 200, { ok: true, bytes: buf.byteLength, revision: remoteRevision(buf) })
|
|
256
260
|
}
|
|
257
261
|
if (op === 'download') {
|
|
@@ -270,7 +274,7 @@ export function createFsRoutes({
|
|
|
270
274
|
assertDownloadHasNoSymlinks(base, local)
|
|
271
275
|
mkdirSync(path.dirname(local), { recursive: true })
|
|
272
276
|
await sftp.fastGet(p, local)
|
|
273
|
-
audit('download', `download ${p}`, 0, b)
|
|
277
|
+
if (!b.local) audit('download', `download ${p}`, 0, b)
|
|
274
278
|
return sendJson(res, 200, { ok: true, bytes: st.size, local })
|
|
275
279
|
}
|
|
276
280
|
return sendJson(res, 400, { ok: false, error: 'unknown op' })
|
package/lib/telemetry.js
CHANGED
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
import { createHmac, randomUUID } from 'node:crypto'
|
|
23
23
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
24
24
|
import path from 'node:path'
|
|
25
|
+
import { setTimeout as delay } from 'node:timers/promises'
|
|
25
26
|
|
|
26
|
-
/** 上报端点(
|
|
27
|
+
/** 上报端点(Cloudflare Worker)。改域名只需改这一行。
|
|
27
28
|
* 可用 `DSH_REMOTE_HEARTBEAT_URL` 覆盖——存在的理由不是"让用户改"
|
|
28
29
|
* (默认行为不该需要配置),而是:① 测试必须能把它重定向掉,
|
|
29
30
|
* 否则跑一次 npm test 就会往生产统计里灌假装机(发生过);
|
|
@@ -48,8 +49,8 @@ const TIMEOUT_MS = 15000
|
|
|
48
49
|
/** 启动后延迟多久再发:避开启动高峰(插件树/路由/服务都在抢事件循环)。
|
|
49
50
|
* 仍不 await——延迟是为了让心跳真的成功,不是为了让用户等待。 */
|
|
50
51
|
const STARTUP_DELAY_MS = 3000
|
|
51
|
-
/**
|
|
52
|
-
const
|
|
52
|
+
/** 每 15 分钟检查是否跨日或需要重试;成功后当天不再发送。 */
|
|
53
|
+
const CHECK_INTERVAL_MS = 15 * 60 * 1000
|
|
53
54
|
|
|
54
55
|
/** 安装身份的进程内缓存,**按身份文件路径分键**。
|
|
55
56
|
* ★ 不能只用一个全局变量:同一进程内出现第二个 DSH_HOME(隔离沙箱、
|
|
@@ -88,8 +89,11 @@ export function pseudonym(home) {
|
|
|
88
89
|
return createHmac('sha256', SALT).update(installId(home)).digest('hex').slice(0, 32)
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
/**
|
|
92
|
-
|
|
92
|
+
/** 与服务端一致,按北京时间分日;隔离不同 DSH_HOME 的节流和并发状态。 */
|
|
93
|
+
const reports = new Map()
|
|
94
|
+
function heartbeatDay() {
|
|
95
|
+
return new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString().slice(0, 10)
|
|
96
|
+
}
|
|
93
97
|
|
|
94
98
|
/** 是否处于测试进程。
|
|
95
99
|
*
|
|
@@ -119,21 +123,20 @@ export function inTestProcess() {
|
|
|
119
123
|
* 且**不导出给业务代码**(导出名带下划线前缀,见文件末尾)。
|
|
120
124
|
*/
|
|
121
125
|
async function deliver(home, version, options = {}) {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
const key = path.resolve(home)
|
|
127
|
+
const previous = reports.get(key)
|
|
128
|
+
if (previous?.pending || previous?.day === heartbeatDay()) return false
|
|
129
|
+
const allowed = () => !options.signal?.aborted && (!options.allowed || options.allowed())
|
|
130
|
+
const state = { pending: true }
|
|
131
|
+
reports.set(key, state)
|
|
128
132
|
try {
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
})
|
|
133
|
+
if (!allowed()) return false
|
|
134
|
+
const delayMs = options.delayMs === undefined ? STARTUP_DELAY_MS : Math.max(0, options.delayMs)
|
|
135
|
+
// 短启动延迟保活,卸载时可取消;周期检查本身不保持进程存活。
|
|
136
|
+
if (delayMs) await delay(delayMs, undefined, { signal: options.signal })
|
|
137
|
+
// 延迟期间用户可能已关闭统计或卸载插件,外呼前重新检查。
|
|
138
|
+
if (!allowed()) return false
|
|
139
|
+
const day = heartbeatDay()
|
|
137
140
|
const body = JSON.stringify({
|
|
138
141
|
idHash: pseudonym(home),
|
|
139
142
|
version: String(version || '0.0.0'),
|
|
@@ -144,21 +147,25 @@ async function deliver(home, version, options = {}) {
|
|
|
144
147
|
const controller = new AbortController()
|
|
145
148
|
const timer = setTimeout(() => controller.abort(), TIMEOUT_MS)
|
|
146
149
|
try {
|
|
147
|
-
await fetch(heartbeatUrl(), {
|
|
150
|
+
const response = await fetch(heartbeatUrl(), {
|
|
148
151
|
method: 'POST',
|
|
149
152
|
headers: { 'content-type': 'application/json' },
|
|
150
153
|
body,
|
|
151
|
-
signal: controller.signal,
|
|
154
|
+
signal: options.signal ? AbortSignal.any([controller.signal, options.signal]) : controller.signal,
|
|
152
155
|
})
|
|
156
|
+
if (!response.ok) return false
|
|
157
|
+
state.day = day
|
|
153
158
|
} finally {
|
|
154
159
|
clearTimeout(timer)
|
|
155
160
|
}
|
|
156
161
|
return true
|
|
157
162
|
} catch {
|
|
158
163
|
// 网络不可达 / 端点变更 / 被拦截:一律忽略。
|
|
159
|
-
// 允许下次重试:回滚节流,避免一次失败就把身份静默六个小时。
|
|
160
|
-
lastSentAt = 0
|
|
161
164
|
return false
|
|
165
|
+
} finally {
|
|
166
|
+
state.pending = false
|
|
167
|
+
// 只有服务端确认成功才占用当天额度;失败由周期检查低频重试。
|
|
168
|
+
if (!state.day && reports.get(key) === state) reports.delete(key)
|
|
162
169
|
}
|
|
163
170
|
}
|
|
164
171
|
|
|
@@ -169,7 +176,7 @@ async function deliver(home, version, options = {}) {
|
|
|
169
176
|
* @param version - 运行中的插件版本(用 LOADED_VERSION,即真正在跑的代码版本)。
|
|
170
177
|
* @param options.delayMs - 发送前延迟(默认 {@link STARTUP_DELAY_MS});
|
|
171
178
|
* 避开启动高峰。测试可传 0。
|
|
172
|
-
* @returns
|
|
179
|
+
* @returns 是否收到成功响应(仅用于测试与自检)。
|
|
173
180
|
*/
|
|
174
181
|
export async function sendHeartbeat(home, version, options = {}) {
|
|
175
182
|
// 测试进程一律不外呼:统计数据的可信度比"测试里能验证外呼"重要得多。
|
|
@@ -177,9 +184,38 @@ export async function sendHeartbeat(home, version, options = {}) {
|
|
|
177
184
|
return deliver(home, version, options)
|
|
178
185
|
}
|
|
179
186
|
|
|
187
|
+
/** 注册启动和运行期间的安装心跳;返回卸载清理函数。后台运行也属于本口径。 */
|
|
188
|
+
function heartbeatLoop(home, version, { allowed = () => true, send = sendHeartbeat } = {}) {
|
|
189
|
+
const controller = new AbortController()
|
|
190
|
+
let stopped = false
|
|
191
|
+
const tick = async (startup = false) => {
|
|
192
|
+
try {
|
|
193
|
+
if (stopped || !allowed()) return
|
|
194
|
+
await send(home, version, {
|
|
195
|
+
delayMs: startup ? STARTUP_DELAY_MS : 0,
|
|
196
|
+
allowed: () => !stopped && allowed(),
|
|
197
|
+
signal: controller.signal,
|
|
198
|
+
})
|
|
199
|
+
} catch { /* 旁路故障永不影响宿主,也不产生未处理的 rejection。 */ }
|
|
200
|
+
}
|
|
201
|
+
void tick(true)
|
|
202
|
+
const timer = setInterval(() => { void tick() }, CHECK_INTERVAL_MS)
|
|
203
|
+
timer.unref?.()
|
|
204
|
+
return () => {
|
|
205
|
+
stopped = true
|
|
206
|
+
clearInterval(timer)
|
|
207
|
+
controller.abort()
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export function startHeartbeat(home, version, options) {
|
|
212
|
+
if (inTestProcess()) return () => {}
|
|
213
|
+
return heartbeatLoop(home, version, options)
|
|
214
|
+
}
|
|
215
|
+
|
|
180
216
|
/** 清空节流与缓存(仅测试用)。 */
|
|
181
217
|
export function _resetForTest() {
|
|
182
|
-
|
|
218
|
+
reports.clear()
|
|
183
219
|
idCache.clear()
|
|
184
220
|
}
|
|
185
221
|
|
|
@@ -245,3 +281,6 @@ export function installIdPath(home) {
|
|
|
245
281
|
* 而不是来自这个函数——它只是把守卫那道门打开给测试用。
|
|
246
282
|
*/
|
|
247
283
|
export const _deliverForTest = deliver
|
|
284
|
+
|
|
285
|
+
// 测试注入发送函数,验证生命周期时不访问生产端点。
|
|
286
|
+
export const _startHeartbeatLoopForTest = heartbeatLoop
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-remote",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "SSH remote workspaces for DeepSeek Harness: parallel projects across hosts, remote file browsing and editing, recursive search, terminals, Git diffs, and workspace-bound Agent tools to edit, build and test remotely. Optional IDE layout.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "flymysql <flyphp@outlook.com>",
|
|
7
7
|
"homepage": "https://flymysql.github.io/dsh-remote/",
|
|
@@ -102,6 +102,6 @@
|
|
|
102
102
|
"test:coverage": "node scripts/coverage-union.mjs",
|
|
103
103
|
"test:coverage:gate": "node scripts/coverage-union.mjs --gate 70 --file-gate 60"
|
|
104
104
|
},
|
|
105
|
-
"readme": "[English](https://github.com/flymysql/dsh-remote/blob/main/README.en.md) · **中文**\n\n# dsh-remote\n\n[](https://www.npmjs.com/package/dsh-remote)\n[](https://www.npmjs.com/package/dsh-remote)\n[](https://www.npmjs.com/package/dsh-remote)\n[](https://github.com/flymysql/dsh-remote/blob/main/LICENSE)\n[](https://github.com/topics/dsh-plugin)\n\n由 [@flymysql](https://github.com/flymysql) 维护 · [主页](https://flymysql.github.io/dsh-remote/) · [用量统计](https://flymysql.github.io/dsh-remote/stats/) · [博客](https://gitpull.cn) · [讨论区](https://github.com/flymysql/dsh-remote/discussions) · [Issue](https://github.com/flymysql/dsh-remote/issues) · [English](https://github.com/flymysql/dsh-remote/blob/main/README.en.md)\n\n\n\n在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 中,把 SSH
|
|
105
|
+
"readme": "[English](https://github.com/flymysql/dsh-remote/blob/main/README.en.md) · **中文**\n\n# dsh-remote\n\n[](https://www.npmjs.com/package/dsh-remote)\n[](https://www.npmjs.com/package/dsh-remote)\n[](https://www.npmjs.com/package/dsh-remote)\n[](https://github.com/flymysql/dsh-remote/blob/main/LICENSE)\n[](https://github.com/topics/dsh-plugin)\n\n由 [@flymysql](https://github.com/flymysql) 维护 · [主页](https://flymysql.github.io/dsh-remote/) · [用量统计](https://flymysql.github.io/dsh-remote/stats/) · [博客](https://gitpull.cn) · [讨论区](https://github.com/flymysql/dsh-remote/discussions) · [Issue](https://github.com/flymysql/dsh-remote/issues) · [English](https://github.com/flymysql/dsh-remote/blob/main/README.en.md)\n\n\n\n在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 中,把 SSH 主机变成日常开发工作区:管理多主机项目,浏览和编辑远程文件、递归搜索文件与内容、使用终端并查看 Git 差异;让 Agent 在所属远程工作区中读写文件、执行命令、构建和测试。多个工作区可独立并行。\n\n可按习惯使用普通布局,或切换 **IDE 三栏布局**,并排查看远程文件、编辑器与原生 Agent 会话;切换时保留任务和未保存编辑。\n\n<img src=\"https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-ide.png\" alt=\"DSH 远程工作区 IDE 模式:远程文件树、代码编辑器和原生 Agent 会话三栏\" width=\"1200\"/>\n\n## 安装\n\n```bash\ndsh plugin --profile web add dsh-remote\n```\n\n安装或升级后,重启 DSH Web 并刷新页面。自动更新状态在设置 → 远程工作区 → 插件偏好中查看。\n\n## 3 步开始\n\n1. **配置主机**:设置 → 远程工作区,编辑 SSH 配置或保存主机凭据;打开设置会自动检查连通性,无需手动“连接”。\n2. **创建工作区**:添加工作区 → 远程,选择主机与目录。每个工作区独立绑定主机,设置页不选目录或“当前远程机”。\n3. **开始开发**:打开工作区文件或切换 IDE 模式,文件打开即可编辑并显示语法高亮,在远端搜索、运行命令并与 Agent 协作。\n\n<img src=\"https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workspace-picker-browse.png\" alt=\"选择远程目录:固定路径与确认栏,目录列表占据弹窗主要区域\" width=\"720\"/>\n\n## 本地工作区也能用\n\n打开普通本地项目后,点击 **IDE 模式** 或 **工作区文件**,即可使用同一套文件树、高亮编辑、递归搜索、Git 差异与本地终端。无需配置 SSH;Agent 继续使用宿主原生文件和命令工具,多个本地、远程项目可并行工作。\n\n<img src=\"https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-local.png\" alt=\"本地工作区:文件搜索、高亮编辑和原生 Agent 会话,Agent 已实际完成本地构建\" width=\"1200\"/>\n\n## 日常开发\n\n### 搜索远端文件与内容\n\n文件、目录和内容递归搜索,无需先展开目录或同步镜像。默认界面只显示搜索范围与进度摘要;按需展开搜索选项、扫描详情,支持大小写、忽略项、停止与重试。点击结果进入目录或文件对应行。\n\n<img src=\"https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-search-results.png\" alt=\"简洁远程搜索:名称搜索结果包含嵌套目录与文件\" width=\"675\"/>\n\n### 查看远端 Git 改动\n\n分别查看工作区和已暂存 diff,筛选文件,点击改动行定位源码。面板只读,不提交或修改暂存区。\n\n<img src=\"https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-git.png\" alt=\"远端 Git 工作区与已暂存改动、文件列表和源码 diff\" width=\"675\"/>\n\n### 在远端运行终端\n\n终端进入当前会话的远程目录;像素鱼欢迎图后接真实 SSH shell。已保存凭据可自动应答,支持多终端并行。\n\n<img src=\"https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-terminal.png\" alt=\"DSH 远程终端:像素鱼欢迎图与实际 SSH 命令输出\" width=\"1000\"/>\n\n### 与 Agent 一起修改和构建\n\n工具卡展示已应用改动、实际退出码和构建输出,编译诊断可跳转源码。编辑器保存会检测远端冲突、保留 CRLF,并保护保存期间继续输入的内容。\n\n<img src=\"https://raw.githubusercontent.com/flymysql/dsh-remote/main/docs/shots/workbench-applied-diff.png\" alt=\"Agent 远程编辑成功后的已应用 diff、路径与增删行数\" width=\"485\"/>\n\n## 兼容与边界\n\n- 主要面向 **DSH Web 0.2.x**;0.2.2 需要 **Node.js ≥24.9**。旧版宿主回退、Desktop/TUI 与 Agent diff 差异见[兼容说明](https://github.com/flymysql/dsh-remote/blob/main/docs/reference.zh.md#dsh-版本兼容性)。\n- 文件栏直接访问远端;镜像按需同步。草稿在当前页面内存,崩溃或强制退出仍可能丢失。\n- 不提供远端语言服务、扩展宿主或调试器。Agent 使用配置的 SSH 身份执行命令,请只配置可信主机。\n\n## 文档与社区\n\n[完整工具与配置参考](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)\n\n[主页](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) · [贡献者与致谢](#贡献者与致谢)\n\n由 [@flymysql](https://github.com/flymysql) 与社区共同维护 · [MIT](https://github.com/flymysql/dsh-remote/blob/main/LICENSE)\n\n### 贡献者与致谢\n\n感谢每一位让这个项目更好的朋友(头像可点进主页;按提交数排序,机器人不计):\n\n<p align=\"left\">\n <a href=\"https://github.com/flymysql\"><img src=\"https://avatars.githubusercontent.com/u/37113068?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@flymysql\" title=\"@flymysql\" /></a>\n <a href=\"https://github.com/baiseraku\"><img src=\"https://avatars.githubusercontent.com/u/139727690?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@baiseraku\" title=\"@baiseraku\" /></a>\n <a href=\"https://github.com/glzhangzhi\"><img src=\"https://avatars.githubusercontent.com/u/36995275?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@glzhangzhi\" title=\"@glzhangzhi\" /></a>\n <a href=\"https://github.com/hjwsm1989\"><img src=\"https://avatars.githubusercontent.com/u/1067541?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@hjwsm1989\" title=\"@hjwsm1989\" /></a>\n <a href=\"https://github.com/j10ha0\"><img src=\"https://avatars.githubusercontent.com/u/72346906?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@j10ha0\" title=\"@j10ha0\" /></a>\n <a href=\"https://github.com/FoolishWiser\"><img src=\"https://avatars.githubusercontent.com/u/104308087?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@FoolishWiser\" title=\"@FoolishWiser\" /></a>\n <a href=\"https://github.com/kakaa-nju\"><img src=\"https://avatars.githubusercontent.com/u/79886619?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@kakaa-nju\" title=\"@kakaa-nju\" /></a>\n <a href=\"https://github.com/4FMTWRV\"><img src=\"https://avatars.githubusercontent.com/u/190457700?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@4FMTWRV\" title=\"@4FMTWRV\" /></a>\n <a href=\"https://github.com/dahaipeng\"><img src=\"https://avatars.githubusercontent.com/u/25660610?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@dahaipeng\" title=\"@dahaipeng\" /></a>\n <a href=\"https://github.com/davidlin2k\"><img src=\"https://avatars.githubusercontent.com/u/17074619?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@davidlin2k\" title=\"@davidlin2k\" /></a>\n <a href=\"https://github.com/FlintyLemming\"><img src=\"https://avatars.githubusercontent.com/u/19165511?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@FlintyLemming\" title=\"@FlintyLemming\" /></a>\n <a href=\"https://github.com/GDWhisper\"><img src=\"https://avatars.githubusercontent.com/u/129148123?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@GDWhisper\" title=\"@GDWhisper\" /></a>\n <a href=\"https://github.com/YiHui-Liu\"><img src=\"https://avatars.githubusercontent.com/u/30190271?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@YiHui-Liu\" title=\"@YiHui-Liu\" /></a>\n <a href=\"https://github.com/Minggle\"><img src=\"https://avatars.githubusercontent.com/u/35053182?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@Minggle\" title=\"@Minggle\" /></a>\n <a href=\"https://github.com/nekomona\"><img src=\"https://avatars.githubusercontent.com/u/25474483?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@nekomona\" title=\"@nekomona\" /></a>\n <a href=\"https://github.com/shis23\"><img src=\"https://avatars.githubusercontent.com/u/189869650?s=80&v=4\" width=\"40\" height=\"40\" alt=\"@shis23\" title=\"@shis23\" /></a>\n</p>\n\n<details>\n<summary>贡献记录与早期贡献者</summary>\n\n近期的亮点贡献(欢迎随时加入这个名单):\n\n| 贡献者 | 做了什么 |\n| --- | --- |\n| [@baiseraku](https://github.com/baiseraku) | 整个 dsh-tui 适配层([#92](https://github.com/flymysql/dsh-remote/pull/92))+ 底栏机器名修正([#98](https://github.com/flymysql/dsh-remote/pull/98)) |\n| [@hjwsm1989](https://github.com/hjwsm1989) | 远程 .md 渲染连环两道:memo 守卫([#102](https://github.com/flymysql/dsh-remote/pull/102))+ labels 契约([#107](https://github.com/flymysql/dsh-remote/pull/107)) |\n| [@shis23](https://github.com/shis23) | rw_sync 路径映射纠偏 + SFTP 超时韧性([#105](https://github.com/flymysql/dsh-remote/pull/105)) |\n| [@davidlin2k](https://github.com/davidlin2k) | 无凭据机器走用户自有 ssh([#100](https://github.com/flymysql/dsh-remote/pull/100)) |\n| [@GDWhisper](https://github.com/GDWhisper) | 目录补全逐字符重连修复([#42](https://github.com/flymysql/dsh-remote/pull/42),issue #41) |\n| [@glzhangzhi](https://github.com/glzhangzhi) | 多远端会话的连接池隔离(issue #25 的主体修复) |\n\n早期已合并 PR 的贡献者(考古名单):\n\n\n\n[@dahaipeng](https://github.com/dahaipeng) (#31) ·\n[@YiHui-Liu](https://github.com/YiHui-Liu) (#28) ·\n[@nekomona](https://github.com/nekomona) (#24) ·\n[@zhz1667](https://github.com/zhz1667) (#43) ·\n[FoolishWiser](https://github.com/FoolishWiser) (#17) ·\n[@jace1cch](https://github.com/jace1cch) (#16) ·\n[@Minggle](https://github.com/Minggle) (#10) ·\n[4FMTWRV](https://github.com/4FMTWRV) (#6) ·\n[glzhangzhi](https://github.com/glzhangzhi)(per-session SSH 连接池修复)\n\n> 名单随版本更新;头像墙之外的每一份 issue 报告、复现步骤、根因线索同样珍贵——\n> 本仓库近半修复的起点都是一条写清楚的 issue。\n\n</details>\n",
|
|
106
106
|
"readmeFilename": "README.md"
|
|
107
107
|
}
|