dsh-remote 0.8.80 → 0.8.82

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
@@ -66,7 +66,7 @@ The rest:
66
66
  - **Async long tasks** — `rw_sync`/`rw_push` with `async: true` return a `taskId` with progress/result/cancel.
67
67
  - **Data lives under the harness home** — machines and mirrors follow `$DSH_HOME`; pre-0.6 data migrates automatically on first run.
68
68
  - **No `dsh-workspace` core changes** — everything ships as a normal plugin.
69
- - **Pages in the terminal UI too (dsh-tui)** — `/dsh-remote` opens a server management page (add/edit/delete, connect, browse remote directories, set as workspace), and the new-workspace picker can list remote project directories directly — again without patching dsh-tui. See "Use it from the TUI" below.
69
+ - **Pages in the terminal UI too (dsh-tui)** — `/dsh-remote` opens a server management page (add/edit/delete, connect, browse remote directories; press `w` there to set the current directory as a workspace), and the new-workspace picker can list remote project directories directly — again without patching dsh-tui. See "Use it from the TUI" below.
70
70
 
71
71
  ## Install
72
72
 
@@ -180,14 +180,19 @@ Type `/dsh-remote` to open a full-screen settings page (the command also shows u
180
180
  and `/help`):
181
181
 
182
182
  - `↑/↓` picks a machine, `Enter` opens the action menu; `a` add, `e` edit, `d` delete, `t` test
183
- connection, `c` connect, `b` browse remote directories, `m` manage workspaces, `Esc`/`q` close
184
- (inside a sub-view they step back to the list first).
183
+ connection, `c` connect, `b` browse remote directories, `o` open the local mirror folder,
184
+ `Esc`/`q` close (inside a sub-view they step back to the list first; `m` in the action menu
185
+ manages workspaces).
185
186
  - Add/edit: name, host, port, username, auth method (password / private key / SSH agent), password or
186
187
  key path, group. Passwords are **write-only** and never echoed; leaving the field empty keeps the
187
188
  stored value.
188
189
  - `b` browses remote directories; `w` adopts the current one as a **workspace**: it creates the local
189
190
  mirror, registers it as a DSH workspace (title `<machine>-<directory>`) and, per configuration,
190
191
  switches the session there.
192
+ - `o` opens the local mirror root `$DSH_HOME/remote-workspaces` in the system file manager (each
193
+ machine's mirrors live under a `<host>-<user>-<port>` subdirectory). That directory also holds
194
+ `machines.json` and other plugin data — with `credentialFallback: plain` it can contain plaintext
195
+ passwords; it is only exposed locally.
191
196
 
192
197
  ### Pick a remote directory when creating a workspace
193
198
 
@@ -333,12 +338,12 @@ Deploying to a product profile is a separate, explicit action (`./sync.sh`) for
333
338
  | `webAttachDshHome` | string | `''` | `DSH_HOME` exported on the remote when attaching; empty reuses the remote user's own harness home |
334
339
  | `webAttachWaitSeconds` | int | `45` | how long to wait for a freshly started remote `dsh web` to print its launch token |
335
340
  | `localTools` | string | `bootstrap` | which `rw_*` tools a LOCAL session (cwd outside every remote mirror) sees (issue #63): `bootstrap` keeps only the configuration loop `rw_machines`/`rw_connect`/`rw_pick_workspace` (the other 19 refuse a local session with "this session is LOCAL", so exposing them just wastes schema budget); `none` hides all `rw_*` (remote setup happens via the settings page only); `all` restores the legacy full surface. REMOTE sessions (cwd inside a mirror) always see everything; an invalid value degrades to `bootstrap` |
336
- | `telemetry` | bool | `true` | anonymous install heartbeat (daily-active statistics, at most once a day; the payload is a plugin-specific HMAC pseudonym + version, no machine info). `false` disables it; users also get a settings-page checkbox (persisted in `$DSH_HOME`, winning over this config) |
341
+ | `telemetry` | bool | `true` | anonymous install heartbeat (daily-active statistics, at most once a day; the payload is a plugin-specific HMAC pseudonym + version, no machine info). `false` disables it (the admin path); the 0.8.78 settings checkbox was removed in 0.8.81 — a previously persisted user opt-out is still honored |
337
342
  | `remoteTerminalDefault` | bool | `true` | make the shell menu's "remote ssh" launcher the terminal's DEFAULT shell when neither the host (`config.shell`) nor the user (a remembered menu choice) has picked one: a session rooted in a remote mirror opens a terminal already sshed into the remote workspace, any other session transparently falls back to a local shell (issue #55); `false` keeps it menu-only |
338
343
  | `tui` | bool | `true` | master switch for the TUI (dsh-tui) layer; `false` registers no `/dsh-remote` page, workspace provider or status field |
339
344
  | `tuiProviderListRecent` | bool | `true` | list each machine's recent remote projects in the TUI workspace picker |
340
345
  | `tuiProviderRecentLimit` | int | `5` | recent remote projects listed per machine (1–20) |
341
- | `tuiAutoSwitchWorkspace` | bool | `true` | switch the session right after "set as workspace" in the `/dsh-remote` page |
346
+ | `tuiAutoSwitchWorkspace` | bool | `true` | switch the session right after pressing `w` (set as workspace) in the directory browser |
342
347
  | `tuiLang` | string | `''` | language of the TUI layer's own copy: `''` = auto (zh, or en when `DSH_TUI_LANG=en`), `zh` / `en` pins it |
343
348
  | `remoteSandbox` | string | `inherit` | which sandbox semantics remote operations follow (0.8.54+): `inherit` reads the mode the local `ctx.sandboxPolicy` resolved (read-only refuses remote writes/commands/forwards, workspace-write fences remote writes to the workspace root, danger-full-access allows everything); `off` disables the fence (legacy behaviour); an explicit mode name is also accepted. **This is containment, not a security boundary** — deploy hard boundaries on the remote side |
344
349
  | `credentialFallback` | string | `refuse` | what to do when the OS secure store refuses a password (0.8.54+): `refuse` saves no password (the machine is still saved, the UI reports why, and nothing is written to machines.json in plaintext); `plain` restores the legacy plaintext fallback (with a warning). Turning encryption off explicitly (`backend: plain`) is unaffected |
package/README.md CHANGED
@@ -56,7 +56,7 @@ DSH 的 Web 界面刻意只监听 `127.0.0.1`(CLI 为安全拒绝 `--host 0.0.
56
56
  - **数据跟随 Harness 根目录** —— 机器清单与镜像在 `$DSH_HOME/remote-workspaces`;0.6 之前的数据首次启动自动迁移。
57
57
  - **`~/.ssh/config` 是连接四字段的唯一来源**(`0.8.50+`,issue #50)—— 保存机器时把 主机/用户/端口/私钥 写入 `~/.ssh/config` 的受管块(`# dsh-remote: managed` 标记,只动自己的块;你手写的同名 Host 块绝不覆盖,会提示冲突)。之后**改这个文件立即生效**:任何 Host 块点名的主机(含字面 IP),连接都按文件解析(裸 `Host *` 是通用默认,不算点名);机器记录里的副本只做兜底,插件自己的状态(最近工作区/延迟等)仍存注册表。
58
58
  - **不改动 `dsh-workspace` 官方代码** —— 全部作为普通插件实现。
59
- - **终端界面(dsh-tui)里也有页面** —— `/dsh-remote` 打开服务器管理页(增删改/连接/浏览远端目录/设为工作区),新建工作区时可直接挑远程项目目录;同样不改 dsh-tui 本体。见下文「在 TUI 里使用」。
59
+ - **终端界面(dsh-tui)里也有页面** —— `/dsh-remote` 打开服务器管理页(增删改/连接/浏览远端目录),浏览时按 `w` 把当前目录设为工作区;同样不改 dsh-tui 本体。见下文「在 TUI 里使用」。
60
60
 
61
61
  ## 安装
62
62
 
@@ -164,11 +164,15 @@ dsh plugin --profile dsh-tui add dsh-remote
164
164
  输入 `/dsh-remote` 打开全屏设置页(命令同时出现在 `/` 补全与 `/help` 里):
165
165
 
166
166
  - `↑/↓` 选机器,`Enter` 打开动作菜单;`a` 新增、`e` 编辑、`d` 删除、`t` 测试连接、
167
- `c` 连接、`b` 浏览远端目录、`m` 工作区管理、`Esc`/`q` 关闭(子视图里先返回列表)。
167
+ `c` 连接、`b` 浏览远端目录、`o` 打开本机镜像目录、`Esc`/`q` 关闭
168
+ (子视图里先返回列表;动作菜单里按 `m` 管理工作区)。
168
169
  - 新增/编辑:名称、主机、端口、用户名、认证方式(密码 / 私钥 / SSH agent)、密码或私钥路径、
169
170
  分组。密码**只写不回显**,编辑时留空表示不修改。
170
171
  - `b` 浏览远端目录,按 `w` 把当前目录**设为工作区**:自动建本地镜像、注册成 DSH 工作区
171
172
  (标题形如 `机器名-目录名`),并按配置切换过去。
173
+ - `o` 用系统默认文件管理器打开本机镜像根目录 `$DSH_HOME/remote-workspaces`
174
+ (每台机器的镜像按 `<host>-<user>-<port>` 分目录存放;该目录也含 `machines.json`
175
+ 等插件数据,`credentialFallback: plain` 时可能含明文密码,仅在本机可见)。
172
176
 
173
177
  ### 新建工作区时直接选远程目录
174
178
 
@@ -308,12 +312,12 @@ scripts/dev-run.sh --status # 是否在运行
308
312
  | `webAttachDshHome` | string | `''` | 远端启动时导出的 `DSH_HOME`;留空则复用远端用户自己的 harness home |
309
313
  | `webAttachWaitSeconds` | int | `45` | 等待远端 `dsh web` 打印启动令牌的秒数 |
310
314
  | `localTools` | string | `bootstrap` | 本地 session(cwd 不在远程镜像里)暴露哪些 `rw_*` 工具(issue #63):`bootstrap`=只暴露配置闭环 `rw_machines`/`rw_connect`/`rw_pick_workspace`(其余 19 个在本地 session 必然报 "this session is LOCAL",暴露只是白占 schema);`none`=完全不暴露 `rw_*`(远程配置只能走设置页);`all`=旧的 full 暴露。远程 session(cwd 在镜像里)不受影响,始终全量;非法值按 `bootstrap` 处理 |
311
- | `telemetry` | bool | `true` | 匿名安装心跳(日活统计,每天至多一次;内容为插件专属 HMAC 伪名+版本号,不含机器信息)。`false` 关闭;用户也可在设置页用复选框关闭(持久化在 `$DSH_HOME`,优先于此配置) |
315
+ | `telemetry` | bool | `true` | 匿名安装心跳(日活统计,每天至多一次;内容为插件专属 HMAC 伪名+版本号,不含机器信息)。`false` 关闭(管理员路径);0.8.78 曾有的设置页复选框已于 0.8.81 移除——已存在的用户关闭选择仍被尊重 |
312
316
  | `remoteTerminalDefault` | bool | `true` | 让 shell 菜单里的「remote ssh」启动器成为终端**默认 shell**(宿主未配置、用户未手动选择时):远程会话开终端即落到远端工作目录,本地会话自动回落本地 shell(issue #55);`false` 则只保留菜单项 |
313
317
  | `tui` | bool | `true` | TUI 适配层(dsh-tui)总开关;`false` 时不注册 `/dsh-remote` 页面、工作区 provider 与状态行字段 |
314
318
  | `tuiProviderListRecent` | bool | `true` | TUI 工作区选择器里是否列出每台机器最近的远程项目 |
315
319
  | `tuiProviderRecentLimit` | int | `5` | 每台机器列出的最近远程项目数(1–20) |
316
- | `tuiAutoSwitchWorkspace` | bool | `true` | 在 `/dsh-remote` 页面「设为工作区」后立即把会话切过去 |
320
+ | `tuiAutoSwitchWorkspace` | bool | `true` | 在浏览目录里按 `w`「设为工作区」后立即把会话切过去 |
317
321
  | `tuiLang` | string | `''` | TUI 层文案语言:`''`=自动(中文;`DSH_TUI_LANG=en` 时英文),`zh` / `en` 固定 |
318
322
  | `remoteSandbox` | string | `inherit` | 远程操作套用哪套 sandbox 语义(0.8.54+):`inherit`=读取本机 `ctx.sandboxPolicy` 已解析的模式(read-only 拒远端写入/命令/转发,workspace-write 把远端写入围在 workspace 根内,danger-full-access 全放行);`off`=不设围栏(旧行为);也可显式写某一模式。**这是遏制不是安全边界**,硬边界请在远端一侧做 |
319
323
  | `credentialFallback` | string | `refuse` | 系统密钥库写密码失败时怎么办(0.8.54+):`refuse`=不保存该密码(机器照常保存,界面报出失败原因,绝不把明文写进 machines.json);`plain`=旧的明文回退(会警告)。主动关掉加密(`backend: plain`)不受影响 |
package/lib/client.js CHANGED
@@ -37,7 +37,15 @@ window.__ModuleLoader__.load({
37
37
  // one, so there is no downgrade. Older builds / the test harness fall back to
38
38
  // plain source.
39
39
  const Primitives = (() => { try { return require('@deepseek-ai/dsh-client-ui-primitives') } catch { return null } })()
40
- const MarkdownText = (Primitives && typeof Primitives.MarkdownText === 'function') ? Primitives.MarkdownText : null
40
+ // A host primitive is a component TYPE, and a component type is not always a
41
+ // function: the host ships MarkdownText as a `React.memo` wrapper, i.e.
42
+ // `typeof === 'object'` with `$$typeof === Symbol.for('react.memo')`, which
43
+ // createElement accepts just fine. Testing `typeof === 'function'` therefore
44
+ // threw the renderer away and every remote .md silently degraded to the
45
+ // raw-source wall (issue #101).
46
+ const isComponentType = (value) => typeof value === 'function'
47
+ || (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')
48
+ const MarkdownText = (Primitives && isComponentType(Primitives.MarkdownText)) ? Primitives.MarkdownText : null
41
49
  // Host visual primitives adopted incrementally, always with a graceful
42
50
  // fallback (the shared map's contents vary by host version — the bundle
43
51
  // ships ~290 exports, older type packages fewer):
@@ -251,8 +259,6 @@ window.__ModuleLoader__.load({
251
259
  'settings.updateNow': '立即更新',
252
260
  'settings.updateMode': '更新模式:',
253
261
  'settings.explorerAutoOpen': '打开远程工作区时,自动在侧边栏展开「远程文件」(需安装 better-sidebar)',
254
- 'settings.telemetry': '匿名使用统计(每日一次的安装心跳;不含任何机器信息,可随时关闭)',
255
- 'settings.telemetryHint': '上报内容只有插件专属的 HMAC 伪名与版本号;关闭后立即不再发送',
256
262
  'settings.updateManual': '手动',
257
263
  'settings.updateAuto': '自动',
258
264
  'settings.updateOff': '关闭',
@@ -559,8 +565,7 @@ window.__ModuleLoader__.load({
559
565
  'settings.updateNow': 'Update now',
560
566
  'settings.updateMode': 'Update mode:',
561
567
  'settings.explorerAutoOpen': 'Auto-open the Remote Files sidebar tab for remote workspaces (via better-sidebar)',
562
- 'settings.telemetry': 'Anonymous usage statistics (one install heartbeat per day; no machine info; can be turned off anytime)',
563
- 'settings.telemetryHint': 'Only a plugin-specific HMAC pseudonym and the version number are sent; takes effect immediately',
568
+
564
569
  'settings.updateManual': 'Manual',
565
570
  'settings.updateAuto': 'Auto',
566
571
  'settings.updateOff': 'Off',
@@ -1092,6 +1097,16 @@ window.__ModuleLoader__.load({
1092
1097
  }
1093
1098
 
1094
1099
  let SESSIONS = null // optional sessions service, tracked by ctx.inject in apply()
1100
+ let SIDEBAR_RIGHT = null // optional native right-column controller (ctx.sidebarRight)
1101
+ // Which world currently owns the remote-explorer presentation: set by the
1102
+ // guide-card handshake in registerNativeSidebar (better-sidebar arrival
1103
+ // moves the card there; its departure brings it back).
1104
+ let explorerOwnedByBs = false
1105
+ // Sessions whose native explorer tab we already auto-opened. Per-session,
1106
+ // never persisted: a user who closed the tab keeps it closed for the
1107
+ // session, but tomorrow's visit opens it again (same rule as the
1108
+ // better-sidebar world's autoOpenedFor).
1109
+ const autoOpenedNative = new Set()
1095
1110
 
1096
1111
  // ── Settings → 远程工作区 (machine registry + forwards + audit) ──────────
1097
1112
  function RemoteWorkspacePage() {
@@ -1266,12 +1281,6 @@ window.__ModuleLoader__.load({
1266
1281
  // Issue #78: initial value comes from localStorage, so a user's choice
1267
1282
  // survives restarts (the bug was: the panel popped again every restart).
1268
1283
  const [explorerAuto, setExplorerAuto] = React.useState(() => explorerAutoOpenEnabled())
1269
- // Anonymous-heartbeat toggle: null = not loaded yet (checkbox disabled).
1270
- // Effective value is host-side (user override > profile config).
1271
- const [telemetryOn, setTelemetryOn] = React.useState(null)
1272
- React.useEffect(() => {
1273
- api('GET', '/dsh-remote/telemetry').then((r) => setTelemetryOn(!(r && r.enabled === false))).catch(() => {})
1274
- }, [])
1275
1284
  // One applier per toggle, shared by the native-checkbox fallback (event
1276
1285
  // semantics) and the host Switch (bare-boolean callback), so both paths
1277
1286
  // behave identically.
@@ -1279,12 +1288,6 @@ window.__ModuleLoader__.load({
1279
1288
  setExplorerAuto(on)
1280
1289
  try { window.localStorage.setItem(EXPLORER_AUTO_OPEN_KEY, on ? '1' : '0') } catch { /* private mode: choice lasts this session only */ }
1281
1290
  }
1282
- const applyTelemetryEnabled = (on) => {
1283
- setTelemetryOn(on) // optimistic; the host answer re-syncs below
1284
- api('POST', '/dsh-remote/telemetry', { enabled: on })
1285
- .then((r) => setTelemetryOn(!(r && r.enabled === false)))
1286
- .catch(() => setTelemetryOn(null))
1287
- }
1288
1291
  const checkUpdate = (quiet) => {
1289
1292
  if (updBusy) return
1290
1293
  setUpdBusy(true); setUpdMsg('')
@@ -2022,28 +2025,6 @@ window.__ModuleLoader__.load({
2022
2025
  }),
2023
2026
  tr('settings.explorerAutoOpen'),
2024
2027
  ),
2025
- HostSwitch
2026
- ? React.createElement('span', { style: { display: 'inline-flex', gap: 6, alignItems: 'center', opacity: 0.85 }, title: tr('settings.telemetryHint') },
2027
- React.createElement('span', { 'data-testid': 'telemetry-toggle', style: { display: 'inline-flex' } },
2028
- React.createElement(HostSwitch, {
2029
- checked: telemetryOn === true,
2030
- disabled: telemetryOn === null,
2031
- label: tr('settings.telemetry'),
2032
- title: tr('settings.telemetryHint'),
2033
- onChange: (on) => { if (telemetryOn !== null) applyTelemetryEnabled(on === true) },
2034
- })),
2035
- React.createElement('span', {
2036
- style: { cursor: telemetryOn === null ? 'default' : 'pointer' },
2037
- onClick: () => { if (telemetryOn !== null) applyTelemetryEnabled(telemetryOn !== true) },
2038
- }, tr('settings.telemetry')),
2039
- )
2040
- : React.createElement('label', { style: { display: 'flex', gap: 6, alignItems: 'center', cursor: telemetryOn === null ? 'default' : 'pointer', opacity: 0.85 }, title: tr('settings.telemetryHint') },
2041
- React.createElement('input', {
2042
- type: 'checkbox', checked: telemetryOn === true, disabled: telemetryOn === null, 'data-testid': 'telemetry-toggle',
2043
- onChange: (e) => applyTelemetryEnabled(!!(e && e.target && e.target.checked)),
2044
- }),
2045
- tr('settings.telemetry'),
2046
- ),
2047
2028
  ),
2048
2029
  upd && upd.pendingReload
2049
2030
  ? React.createElement('div', { style: { marginTop: 6, fontSize: 12, color: T.warn } },
@@ -3085,6 +3066,25 @@ window.__ModuleLoader__.load({
3085
3066
  // nothing from the sidebar.
3086
3067
  function RemoteSessionChip(props) {
3087
3068
  const m = useSessionMirror(props.sessionId, props.useSessions)
3069
+ // Native-right-column counterpart of the better-sidebar auto-open (#78):
3070
+ // this chip mounts exactly when a session is on screen, making it the
3071
+ // trigger for "a remote session on screen surfaces its remote files".
3072
+ // When better-sidebar is installed it owns the presentation (the
3073
+ // guide-card handshake arbitrates that); never open twice.
3074
+ React.useEffect(() => {
3075
+ if (!m || !props.sessionId) return
3076
+ if (!explorerAutoOpenEnabled()) return // the #78 opt-out covers both worlds
3077
+ if (explorerOwnedByBs) return
3078
+ if (autoOpenedNative.has(props.sessionId)) return
3079
+ const right = SIDEBAR_RIGHT
3080
+ if (!right || typeof right.openTab !== 'function') return
3081
+ autoOpenedNative.add(props.sessionId)
3082
+ try {
3083
+ right.openTab(NATIVE_EXPLORER)
3084
+ } catch {
3085
+ autoOpenedNative.delete(props.sessionId) // unregistered kind, etc: retry next time
3086
+ }
3087
+ }, [m, props.sessionId])
3088
3088
  if (!m) return null
3089
3089
  const target = mirrorTarget(m)
3090
3090
  return React.createElement('span', {
@@ -4109,6 +4109,7 @@ window.__ModuleLoader__.load({
4109
4109
  let guideListed = null
4110
4110
  const syncExplorerType = () => {
4111
4111
  const withGuide = !betterSidebar
4112
+ explorerOwnedByBs = betterSidebar
4112
4113
  if (guideListed === withGuide && disposeExplorer) return
4113
4114
  const previous = disposeExplorer
4114
4115
  disposeExplorer = null
@@ -4237,6 +4238,11 @@ window.__ModuleLoader__.load({
4237
4238
  inner.effect(() => registerSidebarIntegration(inner), 'dsh-remote.betterSidebar')
4238
4239
  })
4239
4240
  ctx.inject(['sidebarRightTabs'], registerNativeSidebar)
4241
+ ctx.inject(['sidebarRight'], (inner) => {
4242
+ const svc = inner.get('sidebarRight')
4243
+ SIDEBAR_RIGHT = svc
4244
+ inner.effect(() => () => { if (SIDEBAR_RIGHT === svc) SIDEBAR_RIGHT = null }, 'dsh-remote.sidebarRight')
4245
+ })
4240
4246
  // Issue #49: mark the remote Sessions in the sidebar's own Session list.
4241
4247
  // These three seats belong to the SHIPPED ui-workspace browser, so they
4242
4248
  // are injected (not assumed): a composition with a replacement sidebar
package/lib/errors.js CHANGED
@@ -39,7 +39,7 @@ export function classifyError(err, opts = {}) {
39
39
  if (/no credentials/i.test(msg)) {
40
40
  return {
41
41
  category: 'credentials',
42
- hint: `缺少凭据${where}:这台机器没有可用密码、私钥或 agent。请在「远程工作区」设置里填密码(或用私钥路径 / 勾选 agent)后保存;若你确信已经填过,说明保存时密码没有真正落盘(看保存后是否弹出密钥库失败警告),重新填写并保存即可,可用「测试连接」当场验证。`,
42
+ hint: `缺少凭据${where}:这台机器没有可用密码、私钥或 agent。请在「远程工作区」设置里填密码(或用私钥路径 / 勾选 agent)后保存;若这台机器来自 ~/.ssh/config(勾了「Host 名来自 ~/.ssh/config」)且你的 ssh 本来就能连,请把「连接后端」改成 openssh —— 认证完全交给本机 ssh(默认私钥/agent/ProxyJump 全部生效),不需要再填凭据。若你确信已经填过,说明保存时密码没有真正落盘(看保存后是否弹出密钥库失败警告),重新填写并保存即可,可用「测试连接」当场验证。`,
43
43
  raw: msg,
44
44
  }
45
45
  }
package/lib/host-api.js CHANGED
@@ -170,6 +170,7 @@ function parentOf(p, platform) {
170
170
  * · `resolveDirBinding({machineId, sessionId, local})` → `{pool, ws, bound,
171
171
  * machine}` (throws MACHINE_NOT_FOUND / NO_ACTIVE_MACHINE);
172
172
  * · `listRemoteProjects()` → mirror registry entries (+machineId);
173
+ * · `revealMirrorFolderRecord()` → `{path}` (opens `remote-workspaces` in the file manager);
173
174
  * · `resolveMachine(machineId?)` → `{record, machineId, name, host, port,
174
175
  * username, alias}` (resolved connect identity);
175
176
  * · `ensureMirror(remotePath, host, username, port, extra)` → local dir;
@@ -773,6 +774,18 @@ export function createHostApi(deps = {}) {
773
774
  }
774
775
  }
775
776
 
777
+ /** 在系统文件管理器里打开本机 dsh-remote 的镜像根目录(`remote-workspaces`)。 */
778
+ const revealMirrorFolder = async () => {
779
+ try {
780
+ const result = await need('revealMirrorFolderRecord')()
781
+ const dir = String((result && result.path) || '')
782
+ if (!dir) throw apiError('INTERNAL', 'dshRemote.revealMirrorFolder: host returned no path')
783
+ return { path: dir }
784
+ } catch (err) {
785
+ throw asApiError(err)
786
+ }
787
+ }
788
+
776
789
  const subscribe = (listener) => {
777
790
  if (typeof listener !== 'function') {
778
791
  throw apiError('INTERNAL', 'dshRemote.subscribe: listener must be a function')
@@ -803,6 +816,7 @@ export function createHostApi(deps = {}) {
803
816
  deleteWorkspaceSessions,
804
817
  deleteRemoteWorkspace,
805
818
  forgetWorkspaceRecent,
819
+ revealMirrorFolder,
806
820
  subscribe,
807
821
  }
808
822
  }
@@ -142,7 +142,12 @@ export function guardRoute(route, connectionOf) {
142
142
  return {
143
143
  ...route,
144
144
  handler: async (req, res) => {
145
- const connection = connectionOf()
145
+ // `fence: 'bearer'` routes authenticate with their OWN credential (a
146
+ // per-boot token from a 0600 file) and serve non-browser local processes
147
+ // (the askpass helper) — the Connection fence would 401 them for lacking
148
+ // the browser cookie. They still get the fail-closed fallback fence, so a
149
+ // cross-site page (which cannot read the token file) stays locked out.
150
+ const connection = route.fence === 'bearer' ? undefined : connectionOf()
146
151
  const rejection = typeof connection?.requestRejection === 'function'
147
152
  ? connection.requestRejection(req)
148
153
  : fallbackRejection(req)