dsh-linked-workspace 0.24.1 → 0.26.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/CHANGELOG.md CHANGED
@@ -2,6 +2,66 @@
2
2
 
3
3
  English · [简体中文](CHANGELOG.zh.md)
4
4
 
5
+ ## 0.26.0 — 2026-11-24
6
+
7
+ - The `@` picker now knows which workspace a session belongs to: DSH hands the trigger
8
+ source only a `sessionId`, so the plugin asks the new `linked.sessionScope` method, which
9
+ matches the session against the workspace registry (ids are compared with or without the
10
+ `session-` prefix).
11
+ - Remote candidates are listed one directory at a time through `fs.list` instead of walking the
12
+ whole tree: the `@` menu answers in a few hundred milliseconds, where `fs.references` took
13
+ 5–20 s (and returns nothing at all for an empty query).
14
+ - The remote group now comes first and says what it is: the plugin registers its trigger source
15
+ with `order: -1` (DSH sorts sources by `order`, its own one uses the default 0) and the group is
16
+ titled **Remote files & folders**. DSH's own group keeps its label — it lives in the shell's
17
+ `reference` locale namespace, and registering that namespace again throws, so the plugin cannot
18
+ rename it.
19
+ - Open file tabs now survive a page reload and a Host restart: the tab list is mirrored into
20
+ `localStorage` under one key per pane (session + mode + pinned workspace), so reopening the
21
+ directory tab reopens the files you had open, with the same active tab. Unsaved edits and the
22
+ caret position are deliberately not restored — only the list.
23
+ - The directory panel no longer gets demolished by session polling: while a session snapshot
24
+ briefly lacks a cwd the tab descriptors are kept instead of disposed, and a signature change
25
+ must stay stable for 900 ms before the tabs are re-registered, so an open file tab (and the
26
+ expanded folders behind it) survive idle refreshes. The per-pane memory key also ignores the
27
+ optional `session-` prefix.
28
+ - One `@` now lists the remote tree: inside a linked or remote workspace the picker grows a
29
+ **Remote files** group next to DSH's own local suggestions, so the remote tree needs a single
30
+ keystroke instead of the old double `@`.
31
+ - The `@@` entry point is gone, and with it the separate "link an address" group: an address
32
+ after `@` (`/shared_data_…`, `~/…` or a workspace-relative path) simply appears as a remote
33
+ candidate you can pick.
34
+ - Fixed `npm run build` failing on a Windows checkout: the inline-parts marker was matched with
35
+ an LF-only string, so a CRLF working copy refused to build.
36
+
37
+ ## 0.25.0 — 2026-11-23
38
+
39
+ - Three more theme families — **Tokyo Night**, **Gruvbox** and **Ayu** — bring the grid to twelve. Every card now previews both halves of the pair (light band on top, dark underneath) with the palette's keyword/string/function colours, so a family is recognisable without switching the app mode first. It lists four colour dots per band — keyword, string, function name and comment.
40
+ - The plugin now has its **own settings tab** (`联动工作区设置`, opened from the gear in the directory toolbar or the "+" menu). The DSH settings dialog only exists in the desktop shell, so the web build could never reach themes, remote exec, SSH trust, extra roots or port forwarding — now it can.
41
+ - Settings page polish: the mode cards share one height and mark the active choice in the brand colour, the section headings line up with their count chips, and the theme grid reports how many families are available.
42
+ - The **auto push** block on each workspace card is tidier: the title and the switch share one row with the state sentence underneath, the divider sits the same distance from its neighbours as the rest of the card, and the labels finally have a style of their own (that class had been referenced but never defined, so they rendered larger and darker than everything around them).
43
+ - The known-host-keys list is folded by default, like the workspace allow-list: one line says how many keys are remembered, and the expand button reveals the fingerprints.
44
+ - Long context menus no longer spill past the bottom of the window: the menu is measured after it renders and flips above the cursor when there is more room up there, otherwise it shrinks and scrolls inside itself. The last items ("Permissions", "Properties") used to be unreachable on a short window.
45
+ - **Port-forward tunnels survive a restart.** The definitions live in `forwards.json`, the listener is re-bound when the Host starts (a taken port moves the tunnel instead of losing it), and only the Stop button removes an entry. A page refresh never affected them; a Host restart used to close them.
46
+ - **Push to the remote** now lives on the local tree (the plan reads the local directory); the remote tree no longer offers it.
47
+ - The preview pane keeps its reading position too: the scroll offset is restored
48
+ after the rendered Markdown comes back, not only in the editing view.
49
+ - The directory panel now survives switching sessions: the open file tabs, the
50
+ active tab and both trees (expansion plus already listed entries) are kept per
51
+ session, so coming back to a workspace no longer looks like a fresh panel.
52
+ - Markdown files now open in **preview** in both workspace kinds; the toolbar
53
+ button switches to editing, and the chosen mode plus the reading position
54
+ survive switching to another file and coming back. Word, Excel, PDF and
55
+ PowerPoint panes remember their page, sheet and slide the same way.
56
+ - `@@` in the composer opens the picker on the **remote** workspace's files and
57
+ folders; a single `@` keeps the stock local menu.
58
+ - `@`/`@@` followed by an address (absolute, `~/…` or workspace relative) offers
59
+ that exact path, and picking it inserts a real reference chip that the model
60
+ receives as a path.
61
+ - The context menu copies addresses: **Copy relative address** gives the path
62
+ relative to the workspace root (the local root in the left tree, the remote
63
+ root in the right one), **Copy absolute address** gives the full path.
64
+
5
65
  ## 0.24.1 — 2026-11-22
6
66
 
7
67
  - Fix: every directory pane showed "the plugin host is still running older code" right after a full DSH restart. 0.24.0 raised the revision the Client expects to 9 but left `API_REVISION` in the Host at 8, so the two halves disagreed on a process that was perfectly up to date.
package/README.en.md CHANGED
@@ -44,7 +44,8 @@ Turn an existing SSH connection into a **linked workspace** or a **remote worksp
44
44
  - Remote workspace list: each card shows “remote · user@host + remote path” and the local placeholder directory, with **open workspace**, **open directory tree**, **test connection**, **rename** (renames the DSH workspace too) and **remove** (two-step confirmation; deletes the record, the placeholder directory and the DSH workspace, never remote files).
45
45
  - Linked workspace list: local ⇄ remote paths, mirror toggle (**off by default**), background sync (archive into `.remote`, with file/byte progress and cancel), remove (optionally remove the DSH workspace and delete `.local`/`.remote`). With the mirror on, the first check runs immediately and then **every 5 minutes**: new or changed remote files are downloaded, mirror files that no longer exist remotely are deleted, unchanged files are skipped via `.local/mirror-manifest.json`, and `.git`/`node_modules`/cache directories are excluded. With the mirror off the two sides may diverge freely.
46
46
  - A linked record without a DSH workspace shows “Register workspace” in its settings card, which registers it without recreating the record.
47
- - **Editor theme**: display mode **System / Light / Dark** (default System, following the DSH theme); nine theme families (GitHub, Solarized, One, Dracula, Monokai, Nord, VS Code, Xcode, Catppuccin), each card previewing its light and dark variant.
47
+ - **Editor theme**: display mode **System / Light / Dark** (default System, following the DSH theme); twelve theme families (GitHub, Solarized, One, Dracula, Monokai, Nord, VS Code, Xcode, Catppuccin, Tokyo Night, Gruvbox, Ayu), each card stacking the light variant above the dark one.
48
+ - **Settings tab**: besides the desktop Settings dialog, the plugin registers its own “Linked workspace settings” tab (gear in the directory toolbar, or the “+” menu), so every switch is reachable from the browser too.
48
49
  - A single form serves “Create linked workspace” and “Create remote workspace”, reachable from both entry points.
49
50
  - The file open mode (editor / system app / copy path) is switched from the sidebar toolbar and persisted.
50
51
 
@@ -79,6 +80,7 @@ hover it for the total size and the used percentage.
79
80
  - **Show/hide hidden files**: applies to both trees; hidden entries are shown by default when a directory opens (including `.local`/`.remote`).
80
81
  - **Refresh**: re-fetches the directory, git status and search; expanded directories refresh silently every 15 seconds and pause while the page is hidden.
81
82
  - Coloured file-type icons (JS/TS/Python/JSON/Markdown/Shell/YAML/images/archives/config files…).
83
+ - **Tabs are remembered**: the files you opened are stored per pane (session + mode + pinned workspace) in the browser, so after a page reload or a DSH/Host restart the directory tab reopens them as they were (unsaved edits and the caret are not restored).
82
84
  - **Tabs and editor**: up to 12 tabs, local and remote files share the same editor; line numbers, syntax highlighting (overlay), theme colours, `Ctrl/Cmd+S`, conflict prompt (reload / force save), read-only protection for binary and >2 MB files; the status bar shows encoding, line endings, line count and file size.
83
85
  - **Find and replace**: `Ctrl/Cmd + F` opens an in-editor bar with a case-sensitive toggle, previous/next, a match counter, replace and replace all. Above 5000 matches the counter shows `5000+` while replace-all still edits the whole document; `Esc` closes it from the replace field too. The Markdown document panel has its own read-only find (`Ctrl+F`, counter, next/previous).
84
86
  - **Image, CSV and HTML previews**: PNG/JPG/GIF/WebP/BMP/ICO/AVIF/SVG render in the content panel (up to 24 MB) with zoom buttons, `Ctrl/Cmd + wheel`, fit-to-window and 1:1; CSV/TSV open as a table with a Table/Source toggle (the source view stays editable), capped at 1000 rows × 80 columns. HTML/HTM render in a sandboxed iframe whose scripts run in an opaque origin (charts draw, but the frame cannot reach the DSH UI or its storage); the cap is 8 MB, and beyond that the panel tells you to download the file and open it in a browser. Markdown previews strip scripts, event attributes and dangerous links.
@@ -87,7 +89,9 @@ hover it for the total size and the used percentage.
87
89
 
88
90
  ### Context menu (file/folder/root)
89
91
 
90
- Transfer (download to `.remote`), download to the default folder, queue, open, edit with Notepad, copy, paste, copy path, **Move to…** (only within the same local or remote tree), rename, delete, change permissions, new (folder/file), properties. Folders also offer “Open terminal here”, and remote folders in a linked workspace offer “Compare with local…” when a local counterpart exists.
92
+ Transfer (download to `.remote`), download to the default folder, queue, open, open a copy in Notepad (edits are not written back), copy, paste, **Copy absolute address**, **Copy relative address**, **Move to…** (only within the same local or remote tree), rename, delete, change permissions, new (folder/file), properties. Remote rows also offer “Copy ssh command”, rows of a linked workspace's local tree offer “Push to the remote”, folders offer “Open terminal here”, and remote folders in a linked workspace offer “Compare with local…” when a local counterpart exists.
93
+
94
+ **Copy absolute address** gives the full path; **Copy relative address** gives it relative to the workspace root (the local root on the left tree, the remote root on the right) — both paste straight into a terminal or an editor.
91
95
 
92
96
  Selecting several rows (`Ctrl/Cmd`-click toggles, `Shift`-click selects a range) adds “Transfer selected (N)” and “Delete selected (N)” at the top of the menu; deletion asks for confirmation and aggregates per-item errors (e.g. a file deleted outside the app reports “path does not exist” while the rest are removed).
93
97
 
@@ -98,7 +102,7 @@ Appears automatically for sessions that belong to a remote workspace (and can be
98
102
  - A **single remote tree** with no local pane; it is rooted at “All files” and the header shows `user@host · Remote`.
99
103
  - Files are **editable in the built-in editor and saved straight back to the host** (Ctrl/Cmd+S, autosave, save-conflict prompt, find & replace and jump-to-match all behave like the linked workspace). Read-only protection still follows each file: binaries, files over 2 MB and truncated reads show “Read-only” and reject typing.
100
104
  - Markdown, Word, Excel, PowerPoint and PDF documents open in their own panes and save back to the host as well.
101
- - The context menu, search (name / content, including case, regex and “search this folder only”), hidden-file toggle and the 15-second refresh throttle match the linked workspace's remote tree: open, edit in Notepad, copy / paste, copy path, move to…, rename, delete, change permissions, open terminal here, new file / folder, properties, download, plus the batch “delete selected”, “move selected” and “rename selected”.
105
+ - The context menu, search (name / content, including case, regex and “search this folder only”), hidden-file toggle and the 15-second refresh throttle match the linked workspace's remote tree: open, open a copy in Notepad, copy / paste, copy absolute address, copy relative address, copy ssh command, move to…, rename, delete, change permissions, open terminal here, new file / folder, properties, download, plus the batch “delete selected”, “move selected” and “rename selected”.
102
106
  - Only the four features that need a local directory stay linked-only: **transfer to the local mirror, the transfer queue, two-way comparison, and the local terminal / local pane** (in a remote workspace the transfer button is disabled and its tooltip reads “Transfer needs a linked workspace (remote → local)”).
103
107
  - Both directory tabs (linked and remote) register eagerly, so a remote tree can be opened from settings even while the current session belongs to a linked workspace.
104
108
 
@@ -122,7 +126,7 @@ The workspace resolves automatically when the session cwd falls inside a linked
122
126
  ### Documents, tunnels and paths outside the workspace (0.23.0)
123
127
 
124
128
  - Models can read the **text of PDF / Word / Excel / PowerPoint** files directly (`read_doc`) instead of installing a parser.
125
- - When TensorBoard or Jupyter runs remotely, map it onto a local `127.0.0.1` port under Settings → Linked workspaces → **Port forwards** and open the URL in a browser; tunnels close with the plugin.
129
+ - When TensorBoard or Jupyter runs remotely, map it onto a local `127.0.0.1` port under Settings → Linked workspaces → **Port forwards** and open the URL in a browser. A tunnel is a **standing arrangement**: the definition is written to `forwards.json`, so a page refresh, an app restart or a Host restart re-binds it automatically (picking and remembering a new local port if the old one is taken); only “Stop” removes it.
126
130
  - To touch a shared drive outside the workspace, add the prefix under Settings → Linked workspaces → **Extra roots** first; only then can the model use `read_outside` / `write_outside` / `list_outside`, and every access lands in `outside-audit.jsonl`.
127
131
  - `sync_status` reports progress and counters while a mirror sync runs.
128
132
 
@@ -139,9 +143,13 @@ Every attempt — including refused ones — appends a line to `$DSH_HOME/linked
139
143
  ### @ references and finer search (0.18.0)
140
144
 
141
145
  - The `references` action (backed by `fs.references`) matches **path names** case-insensitively with the best match first (exact name → prefix → substring) and directories flagged `dir`, so the model can turn a file name you mention into a real remote path.
142
- - Right-click a file or folder → “Copy as @ reference” to put `@relative/path` (e.g. `@src/app.py`) on the clipboard.
146
+ - `@` in the composer still opens DSH's own menu (local files, folders, conversations). The plugin adds its own candidate groups to that menu:
147
+ - inside a linked or remote workspace a single **`@`** adds a “**Remote files & folders**” group (listed first) on top of DSH's own local suggestions — it lists the workspace's remote tree; picking one inserts a real reference chip, and the model receives that remote path;
148
+ - Candidates are listed **one directory at a time**: `@` opens the remote root, further characters filter by name, and a trailing `/` descends into that folder (for example `@code/` lists what is inside the remote `code/`), so a huge tree never stalls the menu;
149
+ - The context menu still copies addresses: **Copy relative address** / **Copy absolute address** give the path itself, without an `@` prefix.
143
150
  - Content search gained two switches — “search usually ignored folders” (`node_modules`/`.venv`/`dist` included, `.git` always out) and “file names only” — plus a “Stop” button that cancels a running sweep; the scan stats (“Scanned N files · X”) appear above the results.
144
- - Known limitation: DSH's `@` completion popup is not extensible by plugins (the Host `fileReferences` service only offers `list()`, with no registration hook), so remote paths do not show up in that dropdown — use the `references` action or copy-as-reference instead.
151
+ - At most 30 candidates per listing and hidden files are skipped; keep typing to narrow and descend, and use the sidebar tree when you want to browse.
152
+ - Group order: the plugin registers its trigger source with `order: -1` (DSH sorts sources by `order`, its own one uses the default 0), so “Remote files & folders” always comes first, then DSH's own “Files and folders” and “Conversations”. That second label belongs to the shell's `reference` locale namespace, so the plugin cannot rename it.
145
153
 
146
154
  ### Running icon / local skills
147
155
 
@@ -200,7 +208,7 @@ The npm package is `dsh-linked-workspace`; released versions can also be install
200
208
 
201
209
  ## Configuration
202
210
 
203
- - **Settings → Linked workspaces**: editor theme and display mode, file open mode, auto save, mirror toggle, manual sync and removal options.
211
+ - **Settings → Linked workspaces**: editor theme and display mode, file open mode, auto save, mirror toggle, manual sync and removal options; below that come remote exec (switch, host allow-list and the per-workspace second layer, folded by default), SSH trust and encoding (including the folded known-host-key list), extra roots, and port forwards. The same page opens in the browser as its own sidebar tab.
204
212
  - **Data directory**: `$DSH_HOME/linked-workspace` (remote workspace records, linked records, settings); override with `DSH_LINKED_WORKSPACE_HOME`.
205
213
  - **Python interpreter**: `DSH_OFFICE_PYTHON` for Office/PDF operations.
206
214
  - **Terminal**: `DSH_LINKED_WORKSPACE_NO_TERMINAL=1` keeps “Open terminal” from launching a real window (used in tests).
package/README.md CHANGED
@@ -44,7 +44,8 @@
44
44
  - **联动工作区**列表:本地 ⇄ 远端路径、镜像开关(**默认关闭**)、后台同步(归档到 `.remote`,显示文件数/体积进度,可取消)、移除(可选同时移除 DSH 工作区、删除 `.local`/`.remote`)。开启镜像后首次立即检查,之后**每 5 分钟**自动比较远端与 `.remote`:下载新增/变更文件、删除远端已不存在的镜像文件、跳过未变更文件(`.local/mirror-manifest.json`),并排除 `.git`/`node_modules`/缓存目录;关闭镜像时允许两侧存在版本和文件差异。
45
45
  - **远程工作区**列表:每张卡片显示「远端 · 用户名@主机 + 远端路径」和「本地占位目录」,提供**打开工作区**(切到该 DSH 工作区)、**打开目录树**、**测试连接**、**重命名**(同步改名 DSH 工作区)、**移除远程工作区**(两步确认;同时删除占位目录和 DSH workspace 注册,不动远端文件)。
46
46
  - 联动记录若没有对应的 DSH 工作区,设置卡会显示「注册为工作区」,点击即可补注册,无需删除重建。
47
- - **编辑器主题**:显示模式分 **系统 / 浅色 / 深色**(默认系统:跟随 DSH 当前主题);指定主题为 **9 张卡片**(GitHub、Solarized、One、Dracula、Monokai、Nord、VS Code、Xcode、Catppuccin),每张卡同时包含浅色/深色版本,预览随模式卡选择实时切换。
47
+ - **编辑器主题**:显示模式分 **系统 / 浅色 / 深色**(默认系统:跟随 DSH 当前主题);指定主题为 **12 张卡片**(GitHub、Solarized、One、Dracula、Monokai、Nord、VS Code、Xcode、Catppuccin、Tokyo Night、Gruvbox、Ayu),每张卡上下两条色带同时预览这一套的浅色与深色版本。
48
+ - **设置标签页**:除了桌面端「设置 → 联动工作区」,插件还在右侧栏注册了「联动工作区设置」标签(目录工具栏的齿轮按钮或「+」菜单打开),浏览器里也能改全部设置。
48
49
  - 添加联动工作区 / 添加远程工作区共用同一个表单,可在两处入口使用。
49
50
  - 文件打开方式(编辑器 / 系统默认应用 / 复制路径)由右侧栏工具栏的「打开选项菜单」切换并持久化。
50
51
 
@@ -78,6 +79,7 @@
78
79
  - **显示/隐藏隐藏文件**:同时约束远端树和本地树;打开目录时默认显示隐藏项(包括 `.local`/`.remote`),可用按钮隐藏。
79
80
  - **刷新**:重新拉取目录、git 状态与搜索;展开的目录每 15 秒静默刷新一次,页面隐藏时暂停。
80
81
  - 不同文件类型使用不同彩色图标(JS/TS/Python/JSON/Markdown/Shell/YAML/图片/压缩包/配置文件等)。
82
+ - **标签会记住**:打开的文件按面板(会话 + 模式 + 固定的工作区)记在浏览器本地,刷新页面或重启 DSH/Host 后重新打开目录标签,之前开着的文件会原样回来(未保存的编辑与光标位置不会恢复)。
81
83
  - **标签与编辑器**:最多同时打开 12 个标签,本地与远端文件共用内部编辑器;行号、语法高亮(叠层渲染)、主题配色、`Ctrl/Cmd+S` 保存、冲突提示(重新加载/强制保存)、二进制与 >2 MB 文件只读保护;状态栏显示编码、换行符、行数与文件大小。
82
84
  - **查找/替换**:编辑器内 `Ctrl/Cmd + F` 打开查找条,支持区分大小写、上一个/下一个、命中计数、替换与全部替换;命中超过 5000 处时计数显示 `5000+`,全部替换仍作用于全文。替换框内按 `Esc` 也能关闭查找条。Markdown 文档面板另有只读查找(同样 `Ctrl+F`,支持计数与上下跳转)。
83
85
  - **图片、CSV 与网页预览**:PNG/JPG/GIF/WebP/BMP/ICO/AVIF/SVG 直接在内容面板按图片显示(最大 24 MB),支持按钮缩放、`Ctrl/Cmd + 滚轮` 缩放、适应窗口和 1:1 原始大小;CSV/TSV 默认按表格显示,可在「表格 / 源码」间切换,源码视图仍可编辑保存,超过 1000 行或 80 列时只展示截断后的表格。HTML/HTM 以沙箱 iframe 渲染(脚本在独立源里运行,图表能画出来,但拿不到 DSH 界面与存储;上限 8 MB,超过时提示改下载后用浏览器打开),Markdown 预览会移除脚本、事件属性与危险链接。
@@ -86,7 +88,9 @@
86
88
 
87
89
  ### 右键菜单(文件/文件夹/根节点)
88
90
 
89
- 传输(下载到 `.remote`)、下载到默认文件夹、队列、打开、用记事本编辑、复制、粘贴、复制路径、**移动到…**(只允许移动到同一棵本地树或同一棵远程树内的目录)、重命名、删除、更改权限、新建(文件夹/文件)、属性;目录还提供「在此打开终端」,联动工作区的远端目录在本地存在对应路径时提供「与本地对比…」。
91
+ 传输(下载到 `.remote`)、下载到默认文件夹、队列、打开、用记事本打开副本(不回写)、复制、粘贴、**复制绝对地址**、**复制相对地址**、**移动到…**(只允许移动到同一棵本地树或同一棵远程树内的目录)、重命名、删除、更改权限、新建(文件夹/文件)、属性;远端目录行另有「复制 ssh 命令」,联动工作区本地树的行另有「推送到远端」,目录还提供「在此打开终端」,联动工作区的远端目录在本地存在对应路径时提供「与本地对比…」。
92
+
93
+ **复制绝对地址**给完整路径,**复制相对地址**给相对工作区根目录的路径(左树相对本地根、右树相对远端根)——粘到终端或编辑器里都是能直接用的地址。
90
94
 
91
95
  选中多个文件(`Ctrl/Cmd` 点击切换、`Shift` 点击按区间选择)后,菜单顶部出现「传输所选的 N 项」「删除所选的 N 项」;删除会先弹确认,逐项失败会聚合提示(例如外部已删掉的文件报「路径不存在」,其余照常删除)。
92
96
 
@@ -97,7 +101,7 @@
97
101
  - 只有**一棵远端树**,不显示本地分栏;根节点同样是「所有文件」,标题栏显示 `用户名@主机 · 远程`。
98
102
  - 文件可在内部编辑器里**直接编辑并保存回远端**(`Ctrl/Cmd+S`、自动保存、保存冲突提示、查找替换、按命中行跳转都与联动工作区一致);只读保护仍按文件本身生效:二进制文件、超过 2 MB 或读取被截断时显示「只读」且不可输入。
99
103
  - Markdown、Word、Excel、PowerPoint、PDF 等文档走各自的文档面板打开,编辑后同样保存回远端。
100
- - 右键菜单、搜索(文件名 / 内容,含大小写、正则、限定当前目录)、隐藏文件开关、刷新节流(15 秒)与联动工作区的远端树完全一致:打开、用记事本编辑、复制 / 粘贴、复制路径、移动到…、重命名、删除、更改权限、在此打开终端、新建文件 / 文件夹、属性、下载,以及批量的「删除所选」「移动所选」「批量重命名所选」。
104
+ - 右键菜单、搜索(文件名 / 内容,含大小写、正则、限定当前目录)、隐藏文件开关、刷新节流(15 秒)与联动工作区的远端树完全一致:打开、用记事本打开副本、复制 / 粘贴、复制绝对地址、复制相对地址、复制 ssh 命令、移动到…、重命名、删除、更改权限、在此打开终端、新建文件 / 文件夹、属性、下载,以及批量的「删除所选」「移动所选」「批量重命名所选」。
101
105
  - 只有依赖本地目录的四项仍然只对联动工作区开放:**传输到本地镜像、传输队列、与本地目录对比、本地终端 / 本地分栏**(远程工作区里传输按钮为禁用态,悬停提示「传输只在联动工作区可用(远端 → 本地)」)。
102
106
  - 两个目录标签(联动 / 远程)都常驻注册,因此当前会话属于联动工作区时也能从设置页打开远程工作区目录树。
103
107
 
@@ -121,7 +125,7 @@
121
125
  ### 读文档、开隧道、访问工作区外(0.23.0)
122
126
 
123
127
  - 模型可以直接读 **PDF / Word / Excel / PowerPoint 的文字**(`read_doc`),不用再自己装解析库。
124
- - 远端跑着 TensorBoard、Jupyter 时,可以在 设置 → 联动工作区 → **端口转发** 里把它映射到本机 `127.0.0.1` 的端口,点 URL 就能在浏览器打开;插件退出时隧道自动关闭。
128
+ - 远端跑着 TensorBoard、Jupyter 时,可以在 设置 → 联动工作区 → **端口转发** 里把它映射到本机 `127.0.0.1` 的端口,点 URL 就能在浏览器打开。隧道是**常驻的**:定义写进 `forwards.json`,刷新页面、重启应用或重启 Host 都会自动重新监听(原来的本机端口被占用时会换一个并记下来),只有点「停止」才会移除。
125
129
  - 需要碰工作区之外的共享盘时,先在 设置 → 联动工作区 → **额外根目录** 里加前缀,模型才能用 `read_outside` / `write_outside` / `list_outside` 访问,而且每次访问都会记进 `outside-audit.jsonl`。
126
130
  - 镜像同步进行中可以用 `sync_status` 看进度与计数。
127
131
 
@@ -139,9 +143,13 @@
139
143
  ### @ 引用与更细的搜索(0.18.0)
140
144
 
141
145
  - `references` 动作(对应 `fs.references`)按**路径名**做大小写不敏感匹配,最佳匹配排在最前(完全同名 → 前缀 → 包含),目录带 `dir` 标记;模型可以用它把你口头提到的文件名解析成远端真实路径。
142
- - 右键文件或目录 →「复制为 @ 引用」,把 `@相对路径`(如 `@src/app.py`)复制到剪贴板。
146
+ - 输入框里的 **`@`** 仍然是 DSH 原有的菜单(本地文件、文件夹、对话);插件往这个菜单里又加了一组自己的候选:
147
+ - 只要会话属于联动/远程工作区,单打一个 **`@`** 就会在 DSH 原生的本地候选之上,多出一组「**远程文件与文件夹**」(排在最前)——列出当前工作区远端树的文件与文件夹;选中后插入一个真正的引用 chip,模型收到的是该远端路径;
148
+ - 候选**每次只列一个目录**:`@` 打开远端根目录,再打字符按名字过滤,写完目录名加 `/` 会进到下一层(例如 `@code/` 列出远端 `code/` 里的内容),几千个文件也不会卡住菜单;
149
+ - 右键仍然是取地址:**复制相对地址** / **复制绝对地址** 给出的是路径本身,不带 `@` 前缀。
143
150
  - 内容搜索多了两枚开关:「包含通常忽略的目录」(`node_modules`/`.venv`/`dist` 也会搜,`.git` 始终排除)、「只列文件名」;搜索中可以点「停止」中途取消,结果上方会显示「扫描 N 个文件 · X」。
144
- - 已知限制:DSH 的 `@` 补全弹窗没有开放给插件(宿主 `fileReferences` 服务只提供 `list()`,没有注册入口),所以远端路径不会出现在 `@` 下拉里,请用 `references` 动作或右键复制。
151
+ - 每个候选最多 30 条、跳过隐藏文件;按 `Ctrl/⌘` 逐层打字即可下钻,想整体浏览仍用右侧栏目录树。
152
+ - 分组顺序:插件注册触发器时用 `order: -1`(DSH 按 `order` 升序排,它自己的 source 用默认 0),所以「远程文件与文件夹」总排在最前,其次是 DSH 原生的「文件与文件夹」「对话」。DSH 那组的标题归外壳的 `reference` 文案命名空间所有,插件无法改名。
145
153
 
146
154
  ### 运行中图标 / 本地技能
147
155
 
@@ -200,7 +208,7 @@ npm 包名为 `dsh-linked-workspace`,也可以从 npm 安装已发布版本(
200
208
 
201
209
  ## 配置
202
210
 
203
- - **设置 → 联动工作区**:编辑器主题与显示模式、文件打开方式、自动保存、镜像开关、手动同步与移除选项。
211
+ - **设置 → 联动工作区**:编辑器主题与显示模式、文件打开方式、自动保存、镜像开关、手动同步与移除选项;下方依次是远端命令执行(开关 + 主机白名单 + 按工作区第二层,默认折叠)、SSH 信任与编码(含默认折叠的已知主机密钥清单)、额外根目录、端口转发。
204
212
  - **数据目录**:`$DSH_HOME/linked-workspace`(远程工作区、联动记录、设置);可用 `DSH_LINKED_WORKSPACE_HOME` 覆盖。
205
213
  - **Python 解释器**:`DSH_OFFICE_PYTHON` 指定用于 Office/PDF 的 Python。
206
214
  - **终端**:`DSH_LINKED_WORKSPACE_NO_TERMINAL=1` 关闭「打开终端」的实际启动(测试环境用)。
package/docs/API.md CHANGED
@@ -62,8 +62,8 @@ scope root, or absolute inside it.
62
62
  | `fs.readOutside` | `{ linkedId?, remoteId?, path, maxBytes? }` | `{ path, size, mtime, binary, truncated, content }` (only under an `extraRoots` prefix; audited) |
63
63
  | `fs.writeOutside` | `{ linkedId?, remoteId?, path, content, ifModifiedSince? }` | `{ path, size, mtime, created }` (8 MB limit; only under an `extraRoots` prefix; audited) |
64
64
  | `fs.listOutside` | `{ linkedId?, remoteId?, path }` | `{ path, entries }` (only under an `extraRoots` prefix; audited) |
65
- | `hosts.forward` | `{ hostId, remotePort, remoteHost?, localPort? }` | `{ forward: { id, hostId, hostName, remoteHost, remotePort, localPort, startedAt, url } }` (localhost TCP tunnel; reuses an identical one) |
66
- | `hosts.forwards` | `{}` | `{ forwards: [...] }` |
65
+ | `hosts.forward` | `{ hostId, remotePort, remoteHost?, localPort? }` | `{ forward: { id, hostId, hostName, remoteHost, remotePort, localPort, startedAt, url } }` (localhost TCP tunnel; reuses an identical one; the definition is written to `forwards.json`, so a restarted Host re-binds the same port) |
66
+ | `hosts.forwards` | `{}` | `{ forwards: [...] }` — a tunnel that could not get its port back after a restart is listed with `localPort: 0`, `url: ""` and an `error`; Stop removes it |
67
67
  | `hosts.unforward` | `{ id }` | `{ removed }` |
68
68
  | `hosts.reconnect` | `{ hostId }` | `{ hostId, state, reason?, message?, latencyMs?, checkedAt? }` (drops the pooled socket and dials again; returns the resulting status instead of throwing, so the UI can show the reason) |
69
69
  | `hosts.mkdir` | `{ hostId, path?, name }` | `{ path }` (creates `name` inside `path`; defaults to the login home; `409`/`FS_EXISTS` when it already exists) |
@@ -112,7 +112,8 @@ scope root, or absolute inside it.
112
112
  | `linked.push` | `{ id, paths?, dryRun?, conflict?, jobId? }` | `{ linkedId, dryRun, conflict, files, pushed, skipped, conflictsLeft, bytes, cancelled }` (`conflict` is `skip` by default; every file is written as a temporary file and renamed into place; `paths` entries may be files or folders — a folder matches everything under it — and every planned entry carries `localMtime` / `remoteMtime`) |
113
113
  | `linked.pushCancel` | `{ jobId }` | `{ cancelled }` (stops after the file being written) |
114
114
  | `transfer.history` | `{}` | `{ entries: [{ kind: "transfer" \| "push", direction?, linkedId?, files, bytes, skipped, truncated?, at }] }` (newest first, at most 50) |
115
- | `fs.references` | `{ linkedId?/remoteId?, query, limit?, includeIgnored?, side? }` | `{ ok, query, candidates: [{ path, relative, name, kind }], total, truncated, scannedEntries }` (path completion for `@`-style references: matches the **path**, case-insensitive, best match first — exact name, then prefix, then substring; `limit` defaults to 50 and caps at 200; walking stops after 20000 entries or 3 s; `side: 'local'` searches the local tree of a linked workspace) |
115
+ | `linked.sessionScope` | `{ sessionId }` | `{ scope: { linkedId?, remoteId?, root, cwd } \| null }` (resolves which linked/remote workspace a session belongs to by matching the registry path against every record; session ids are compared with or without the `session-` prefix. The `@` picker calls this instead of guessing from the agent context, which only carries `sessionId`) |
116
+ | `fs.references` | `{ linkedId?/remoteId?, query, limit?, includeIgnored?, side? }` | `{ ok, query, candidates: [{ path, relative, name, kind }], total, truncated, scannedEntries }` (path completion for `@`-style references: matches the **path**, case-insensitive, best match first — exact name, then prefix, then substring; `limit` defaults to 50 and caps at 200; walking stops after 20000 entries or 3 s; `side: 'local'` searches the local tree of a linked workspace. **An empty `query` returns no candidates**, and a full tree walk takes 5–20 s on a real remote, so the `@` picker no longer uses this method — it lists one directory at a time by calling `fs.list` with the parent path) |
116
117
  | `fs.compare` | `{ linkedId?, path? }` | `{ path, relative, localPath, localMissing, counts: { onlyLocal, onlyRemote, changed, same }, onlyLocal, onlyRemote, changed, truncated, remoteTruncated, localTruncated, skippedLinks }` (linked workspaces only; excludes `.git`, `node_modules`, `.local`, `.remote`; 4000 files and depth 12 **per side**, 200 rows per group; `skippedLinks` counts symlinks and non-regular files) |
117
118
  | `fs.pullToLocal` | `{ linkedId?, path, targetDir?, conflict? }` | `{ path, relative, size, mtime }` (linked workspaces only; single file, ≤64 MB; `targetDir` must stay inside the local root; `conflict` is `error` (default), `overwrite` or `unique`) |
118
119
  | `fs.upload` | `{ linkedId?/remoteId?, path, paths, conflict? }` | `{ side: 'remote', target, files, bytes, skipped }` (≤50 local files, 64 MB each; `conflict` is `error` (default), `overwrite` or `unique`; a missing target directory is created) |
@@ -147,6 +148,7 @@ Under `$DSH_HOME/linked-workspace/`:
147
148
 
148
149
  - `linked.json` — linked workspaces (no credentials).
149
150
  - `remote-workspaces.json` — remote workspaces (no credentials).
151
+ - `forwards.json` — `{ version, forwards: [{ id, hostId, hostName, remoteHost, remotePort, localPort, startedAt }] }`. Since 0.25.0 the tunnels opened from 设置 → 端口转发 are standing arrangements: the listener is re-bound on start (with a new local port if the old one is taken, and the record updated), and only `hosts.unforward` removes an entry.
150
152
  - `settings.json` — `{ editorTheme, editorThemeFamily, editorThemeMode, fileOpenMode, autoSave, execEnabled, execHostIds, execWorkspaceIds, execTimeoutMs, execMaxOutputChars, execShell, hostKeyPolicy, outputEncoding, extraRoots }`. The four `autoPush*` keys are still accepted so an old file loads unchanged, but since 0.24.0 auto push is configured per workspace (`linked.json` → each record's `autoPush`), and those keys no longer drive any watcher.
151
153
  - `linked.json` — every record carries `autoPush: { enabled, debounceMs, include[], exclude[] }` (`debounceMs` clamped to 300–60000, default 1500). `linked.list` returns it, `linked.update { id, autoPush }` writes it, and the Host starts/stops one `fs.watch` per enabled workspace.
152
154
  The exec keys are off unless you turn them on: `execEnabled` defaults to
package/docs/VERIFY.md CHANGED
@@ -9,6 +9,8 @@ Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-wor
9
9
  3. 切回 tofu 再刷新:连接恢复,密钥重新出现在列表里。
10
10
  4. 把输出编码切到 gbk,用 `hosts.exec` 让中文 Windows 远端输出中文,应正常显示;切回 utf8 应变成乱码(说明不是被强行转码)。
11
11
 
12
+ 5. 「已知主机密钥」默认收起、只显示条数;点「展开」列出指纹与「忘记」按钮,点「收起」回到一行。(0.25.0)
13
+
12
14
  ## 本地改动推回远端(0.19.0)
13
15
 
14
16
  1. 在联动工作区的**本地**目录里改一个文件、新建一个文件,然后点目录栏的同步按钮:差异预览里能看到「新增 1 · 修改 1」,并列出这两个文件。
@@ -28,7 +30,17 @@ Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-wor
28
30
  5. 右键任一文件或目录 → 「复制为 @ 引用」→ 剪贴板得到 `@相对路径`(如 `@src/app.py`),提示「已复制 @src/app.py」。
29
31
  6. `fs.references { linkedId, query: 'a.txt' }` → `{ candidates: [{ relative, name, kind }], scannedEntries }`,完全同名的排最前;`limit` 生效;空 query 返回空候选而不是报错。
30
32
  7. 模型侧:让它「用 linked_workspace 的 references 动作找一下 xxx 文件」→ 工具卡片按「dir/file + 相对路径」列出候选。
31
- 8. 已知限制(需人工确认未变化):`@` 补全弹窗里不会出现远端路径 —— 宿主 `fileReferences` 服务只有 `list(agent, query, signal)`,没有 provider 注册入口。
33
+ 8. 触发字符由 DSH 外壳写死:`detectTrigger` 只认 `@` 与 `/`,`#` 之类的自定义字符即使 `registerSource` 接受也永远不会被匹配(真机确认:输入 `#may` 没有任何菜单,`#` 被直接丢弃)。
34
+
35
+
36
+ 9. 会话属于联动/远程工作区时,输入框单打一个 **`@`** → 菜单里除了 DSH 原生的「文件与文件夹」「对话」,还有一组「**远程文件与文件夹**」,并且排在 DSH 自己那两组之前(插件用 `order: -1`,DSH 自己的 source 用默认 0)。DSH 那组仍叫「文件与文件夹」——它属于外壳 `reference` 文案命名空间,重复注册会抛错,插件改不了。
37
+ 10. 继续打字过滤:`@co` → 只剩匹配项(如 `.conda/`、`code/`);写到目录名再加 `/`(如 `@code/`)→ 列出该目录里的内容(每次只列一个目录,几百毫秒返回,远端几千个文件也不卡菜单)。
38
+ 11. 选中任一远端候选 → 输入框出现真正的引用 chip(`data-composer-chip="linked-workspace"`,悬停显示相对路径),发送后模型收到该远端路径。
39
+ 12. 接口自检:`linked.sessionScope { sessionId }` → `{ scope: { linkedId | remoteId, root, cwd } }`;会话 id 带不带 `session-` 前缀都能解析;不属于任何联动/远程工作区时返回 `{ scope: null }`,此时 `@` 只剩 DSH 原生分组。
40
+ 14. 文件标签跨刷新与重启:打开「联动工作区目录」,点开两个文件(出现两个文件标签,记住当前标签)→ 刷新页面 → 两个标签与当前标签都恢复;再把 DSH(或 Web 实例的 Host 进程)整个重启,重新打开目录标签 → 标签依旧在。`localStorage` 里键为 `dsh-linked-workspace:pane-tabs`,每面板最多 24 个标签、最多记 12 个面板;关掉全部标签后该面板的记录会被删除。
41
+
42
+ 13. 面板不被轮询冲掉:在会话里打开右侧「联动工作区目录」,展开两层目录并点开一个文件(出现文件标签),然后闲置 50 秒以上 → 文件标签仍在、展开状态不变;期间会话快照短暂缺少 cwd 时两个目录标签也不会被注销(旧实现会 dispose 后重建,正在看的文件随之关闭)。
43
+
32
44
 
33
45
  ## 远端命令执行(0.17.0)
34
46
 
@@ -39,7 +51,8 @@ Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-wor
39
51
  3. 开关打开但主机白名单为空 → `403 EXEC_HOST_NOT_ALLOWED`;把该主机加进白名单 → `echo hi; pwd` 返回 `exitCode: 0`、`stdout` 含 `hi`、`cwd` 等于工作区远端根。
40
52
  4. 工作区白名单填一个不相干的值 → `403 EXEC_WORKSPACE_NOT_ALLOWED`;留空表示不限制。
41
53
  5. `command: ''` → `400 BAD_REQUEST`;`cwd: '../..'` → `400 BAD_REQUEST`;`timeoutMs: 1000` 配 `sleep 5` → `504 EXEC_TIMEOUT`。
42
- 6. 审计:每次尝试(含被拒绝)都往 `$DSH_HOME/linked-workspace/exec-audit.jsonl` 追加一行 JSON,含 `auditId`、`hostId`、`command`、成功时的 `exitCode`/`durationMs`/`stdoutHead`、失败时的 `refusal`/`message`;文件超过 5 MB 时轮转为 `exec-audit.jsonl.1`;设置页「打开审计日志」用系统默认应用打开它。
54
+ 6. 审计:每次尝试(含被拒绝)都往 `
55
+ DSH_HOME/linked-workspace/exec-audit.jsonl` 追加一行 JSON,含 `auditId`、`hostId`、`command`、成功时的 `exitCode`/`durationMs`/`stdoutHead`、失败时的 `refusal`/`message`;文件超过 5 MB 时轮转为 `exec-audit.jsonl.1`;设置页「打开审计日志」用系统默认应用打开它。
43
56
  7. 模型侧:在联动/远程工作区的会话里让它「用 linked_workspace 的 exec 动作跑 uname -a」→ 工具卡片返回退出码与输出;开关关闭时模型会收到 `EXEC_DISABLED` 与开启指引。
44
57
  8. 旧 Host:`meta.info` 的 `apiRevision` < 3 时目录树顶部出现「DSH 的插件进程仍在运行旧版代码」横幅。
45
58
 
@@ -355,3 +368,38 @@ Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-wor
355
368
  4. **跨侧批量**:多选本地文件拖到远端目录(或反过来):应提示「已导入 N 个文件」,逐个文件各一次请求;其中一个目标同名时会先弹冲突对话框。
356
369
  5. **批量右键移动**:多选后用右键「移动所选的 N 项…」,选目标目录:应提示「已移动 N 项」。
357
370
  6. **同目录/自身保护**:把文件拖到它当前所在的目录、或把目录拖进自己的子目录:应被忽略,不产生报错或递归。
371
+
372
+ ## 阅读模式与 @ 引用(0.25.0)
373
+
374
+ 1. 打开任一联动工作区或远程工作区里的 `.md`:默认是**预览**,工具栏显示「编辑」。
375
+ 2. 点「编辑」进入编辑,向下滚动一段,切到另一个文件再切回来:仍是编辑模式,且滚动位置没有跳回顶部。
376
+ 3. 再点回「预览」,切走再切回:仍是预览,阅读位置保留。
377
+ 4. 打开 `.xlsx` / `.pptx` / `.pdf`,切到第 2 个工作表 / 幻灯片 / 页面,切走再切回:仍停在原处。
378
+ 5. 在联动/远程工作区的会话里输入单个 `@`:除了 DSH 原生的本地候选,还会出现「远程目录」分组,列出远端文件与文件夹;选中一个后变成引用 chip。
379
+ 6. 输入 `@` 再输入 `README.md` 之类的名字:菜单仍是原有的本地文件/文件夹/对话,没有被远程条目污染。
380
+ 7. 输入 `@/shared_data_ssd1/huangjh` 或 `@code/projects_wpf`:「远程目录」分组会把这个地址本身列为候选,选中即插入引用。
381
+ 8. 右键任一文件或文件夹:
382
+ - 「复制绝对地址」→ 得到完整路径(远端形如 `/shared_data_ssd1/huangjh/code/a.txt`,本地形如 `D:\…\a.txt`);
383
+ - 「复制相对地址」→ 左树得到相对**本地根**的路径(如 `code/a.txt`),右树得到相对**远端根**的路径;
384
+ - 提示条会显示实际复制的内容,两者都不带 `@`。
385
+
386
+ 9. 预览模式下把 Markdown 滚到中间,切到另一个文件再切回:仍是预览,且停在原处。
387
+ 10. 在一个工作区里打开几个文件标签、展开两棵树的几个目录,切到另一个工作区的会话再切回:
388
+ 标签页与树的展开状态都还在,目录树不会重新从根加载。
389
+
390
+ 11. 本地树右键一个文件或目录:有「推送到远端」;远端树右键同一项:没有这一项。
391
+ 12. 端口转发开一条隧道(例如远端 TensorBoard 的 `127.0.0.1:6006` → 本机 16006),浏览器能打开;随后**完全退出并重启 DSH**,再进设置:这条隧道仍在列表里、端口没变、点「打开」还能用(0.25.0)。
392
+ 13. 上一步之后点「停止」→ 重启 DSH,列表里不再出现该隧道(0.25.0:停止会删掉 `forwards.json` 里的记录,只有它会删)。
393
+
394
+ ## 主题与设置页(0.25.0)
395
+
396
+ 1. 打开「设置 → 联动工作区」(桌面端)或在浏览器里打开「联动工作区设置」标签(目录工具栏的齿轮按钮 / 「+」菜单):两者应显示同一份页面,`详细` 内容一致。
397
+ 2. 「指定主题」标题右侧显示 `12`,网格里应有 GitHub、Solarized、One Dark / Light、Dracula、Monokai、Nord、VS Code Dark+ / Light+、Xcode Light / Dark、Catppuccin Latte / Mocha、**Tokyo Night**、**Gruvbox**、**Ayu** 共 12 张卡片;每张卡片上半是浅色条、下半是深色条,右侧四个色点分别是关键字/字符串/函数名/注释色;当前选中的那张右上角有 ✓。
398
+ 3. 点 Tokyo Night / Gruvbox / Ayu 各一次:应提示「主题已保存」,编辑器(打开任意远端文件)配色随之改变;刷新页面后仍是选中的那一套。
399
+ 4. 浏览器(`http://127.0.0.1:<port>/?token=…`)里点目录工具栏的齿轮:应打开「联动工作区设置」标签并完整渲染整页(含工作区卡片、端口转发表单),不再提示找不到设置入口。
400
+ 5. 设置标签页与桌面端设置对话框同时改动同一项(例如显示模式)后,另一边刷新一次应看到相同结果。
401
+
402
+ ## 右键菜单(0.25.0)
403
+
404
+ 1. 在高度吃紧的窗口里右键靠下的行(例如窗口 800px 高时右键第 18 行):菜单整体上翻到光标上方、最下面的「更改权限」「属性」都点得到;若上下空间都不够,菜单自身出现滚动条而不是被窗口裁掉。
405
+