dsh-linked-workspace 0.13.0 → 0.15.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,27 @@
2
2
 
3
3
  English · [简体中文](CHANGELOG.zh.md)
4
4
 
5
+ ## 0.15.0 — 2026-11-15
6
+
7
+ - **Remote workspace files are editable**: a remote workspace’s remote tree now behaves like the remote side of a linked workspace — files open in the built-in editor, `Ctrl/Cmd+S` (and autosave) write straight back to the host, save conflicts are detected the usual way, and Markdown / Word / Excel / PowerPoint / PDF documents open in their document panes. Only the 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 (the transfer button is disabled there and its tooltip says so).
8
+ - **`docs.*` accepts `remoteId`**: the document methods used to ignore `remoteId`, so remote documents were resolved as local absolute paths and failed; they now resolve the remote scope exactly like the `fs.*` methods do.
9
+ - **A stale Host is called out**: a new `meta.info` check (`{ version, apiRevision, startedAt }`) means a DSH process that still runs an older copy of the plugin now shows a banner in the directory pane (quit and restart DSH), instead of failing later with something like `ENOENT ... C:\shared_data_...`.
10
+
11
+ ## 0.14.0 — 2026-11-14
12
+
13
+ - **Content search shows the hit**: results now list the file **and** the matching line (number + trimmed snippet, one row per hit), clicking one opens the file with the caret on that line, and Markdown files switch to the code editor for the jump. Local and remote searches share the same limits (1 MB per file, 2000 files, 8 MB, 5 s) and the same default folder exclusions (`node_modules`, `.git`, `site-packages`, `dist`, `build`, `target`, `.venv`, `.conda`, …), so a remote scan no longer crawls a conda tree; when a scan is cut short the notice names the reason (files / bytes / time / result cap) instead of a bare “too many”.
14
+ - **Search options**: three toggles in the search bar — `Aa` (match case), `.*` (regular expression, with the server's own “invalid regular expression” message) and a folder chip that limits the scan to the selected folder.
15
+ - **Keyboard navigation**: the file tree and the result list accept `↑`/`↓`/`Home`/`End`, `→` expands a folder, `←` collapses it (or jumps to the parent from a file), and `Enter` opens; `↓` from the search box drops into the results.
16
+ - **Transfer progress and cancel**: queued transfers report live progress (“2 sent · 2.0 MB”) by polling the new `fs.transferProgress`, and the queue dialog gained a cancel button backed by `fs.transferCancel`; a cancelled run keeps the files already landed and says so.
17
+ - **Batch rename**: with several entries selected the row menu offers “Batch rename selected (N)…” — numbering mode (prefix + start + padding, extension kept) or find-and-replace, with a live preview that flags empty names and duplicates before anything is renamed.
18
+ - **Hover tooltips with mtime**: hovering a row now appends “modified …” and the size to the path tooltip, fetched on demand and cached for 5 s.
19
+ - **Welcome card again**: the settings header gained a “Show the welcome card again” button.
20
+ - **Consistent dialogs**: the confirm dialogs use the plugin's own modal styling (blurred backdrop, rounded card) instead of the host's plain white box.
21
+ - **New folder on the remote side**: the remote path picker gained a “New folder” button (backed by the new `hosts.mkdir` host method), matching the local picker — type a name, press Enter or “Create”, and the picker lands inside the folder it just made. Duplicates report “remote directory already exists”, and names containing `/`, `\` or `..` are refused.
22
+ - **Long paths no longer push the buttons out**: the remote path line ellipsizes in place (hover for the full path), so “New folder” and “Use this directory” always stay visible.
23
+ - **Dropped the redundant “Open” button**: the local path field no longer needs it — Enter navigates to the typed path; the desktop “Browse…” system picker stays.
24
+ - **Fixed**: typing in any picker's filter or folder-name box used to crash the whole “Add workspace” dialog (the React event object was read inside a state updater). The value is now captured before the update.
25
+
5
26
  ## 0.13.0 — 2026-11-14
6
27
 
7
28
  - **Batch drag and move**: dragging inside one tree is now a move instead of a dead end — remote-to-remote in a linked or remote workspace, local-to-local in a linked workspace — and a multi-selection travels as one gesture in both directions (one request per entry, so a failure leaves the rest untouched and the notice reports how many landed). The row menu gained “Move selected (N)…” for the same job without dragging.
package/README.en.md CHANGED
@@ -64,7 +64,8 @@ The plugin takes over the DSH sidebar/hero directory-selection hole; the dialog
64
64
  - **Single-click opens, double-click pins**: single-click a folder to expand/collapse; single-click a file to open it in the content panel, replacing the current unpinned preview. Double-click a file to pin it so later single clicks do not replace it; double-clicking a folder only keeps it expanded.
65
65
  - Toolbar (top right of the sidebar):
66
66
  - **Switch file tree**: all files / changed files / all changes. The change lists come from remote and local `git status` (branch, state, staged marker; deleted entries are greyed).
67
- - **Search in files**: after ≥2 characters, switch between “File name” and “Content”. Name mode uses `find` remotely and a local walk; content mode calls `fs.grep` (bounded local scan, `grep -rIl` remotely). Results are grouped into remote and local directories, with a truncation notice above 200 rows.
67
+ - **Search in files**: after ≥2 characters, switch between “File name” and “Content”. Name mode uses `find` remotely and a local walk; content mode calls `fs.grep`, and both sides share the same limits (1 MB per file, 2000 files, 8 MB, 5 s) and skip `node_modules`, `.git`, `site-packages`, `dist`, `build`, `target`, `.venv`, `.conda` by default. Results are grouped into remote and local directories, **each row showing `path :line` plus the matched snippet**; clicking one opens the file with the caret on that line, and a truncated scan names its reason (files / bytes / time / result cap) above 200 rows. The search bar also has three toggles: `Aa` (match case), `.*` (regular expression) and a folder chip that limits the scan to the selected folder.
68
+ - **Keyboard**: the tree and the result list accept `↑`/`↓`/`Home`/`End`, `→` expands, `←` collapses (or jumps to the parent from a file) and `Enter` opens; `↓` in the search box drops into the results. Hovering a row appends “modified …” and the size to the path tooltip (fetched on demand, cached for 5 s).
68
69
  - **Open options menu**: editor / system default app (downloads the remote file to a temp directory first) / copy path.
69
70
  - **Transfer button (two-way)**: with a remote file or folder selected it transfers to the local `.remote`; with a local file or folder selected it transfers to the matching relative remote path. Transfers run through a queue, one job at a time, with status and retry on failure.
70
71
  - **Open terminal**: the remote button sits at the top right of the remote tree and opens a system terminal via `ssh` in the current remote directory; linked workspaces also get a local button. The folder context menu adds “Open terminal here” for a subdirectory.
@@ -88,8 +89,10 @@ Selecting several rows (`Ctrl/Cmd`-click toggles, `Shift`-click selects a range)
88
89
  Appears automatically for sessions that belong to a remote workspace (and can be opened any time from the settings card):
89
90
 
90
91
  - A **single remote tree** with no local pane; it is rooted at “All files” and the header shows `user@host · Remote`.
91
- - Files open **read-only** in the built-in editor (encoding, line endings, line count and size are still shown) and are never written back locally.
92
- - Context menu, search (name / content), hidden-file toggle and the 15-second refresh throttle match the remote tree of a linked workspace; transfer, two-way comparison and local-side actions are unavailable in this mode.
92
+ - 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.
93
+ - Markdown, Word, Excel, PowerPoint and PDF documents open in their own panes and save back to the host as well.
94
+ - 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”.
95
+ - 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)”).
93
96
  - 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.
94
97
 
95
98
  ### Transfer, comparison and conflicts
@@ -97,7 +100,7 @@ Appears automatically for sessions that belong to a remote workspace (and can be
97
100
  - **Drag and drop**: drag rows between the local and remote trees to transfer them, or drag inside one tree (remote-inside-remote, local-inside-local) to **move** them; with several rows selected the whole selection travels in one gesture. OS files can be dropped onto either tree (the web client cannot read dropped file paths and says to use the desktop app). Hovering a collapsed folder for 700 ms while dragging expands it; a multi-selection can also be moved at once with “Move selected (N)…”.
98
101
  - **Overwrite confirmation**: dropping onto a folder that already has the name no longer overwrites silently — a dialog offers cancel / keep both / overwrite. “Keep both” produces `name copy.txt` or `name (2).txt`. The API and tools accept `conflict=error|overwrite|unique`.
99
102
  - **Local ⇄ remote comparison**: right-click a remote folder → “Compare with local…” groups entries into only-local / only-remote / changed (size differs, or mtime differs by more than 2 s); up to 4000 files and depth 12 per side, 200 rows per group, with a truncation notice. Clicking a row opens the file; each row can push to remote or pull to local; a missing local folder is called out explicitly.
100
- - **Transfer queue**: one job at a time with queued/running/done/failed states; failed items can be retried.
103
+ - **Transfer queue**: one job at a time with queued/running/done/failed states and live progress (“2 sent · 2.0 MB”); the queue dialog can cancel a running job (files already landed are kept). Failed items can be retried.
101
104
  - **Limits**: 8 MB per editor save; 150 files / 15 MB per “Transfer” or “Download to default folder”; 50 files / 64 MB each per drop-upload; mirror sync 500 files / 50 MB by default, skipping files over 20 MB.
102
105
 
103
106
  ### Model tools
@@ -193,7 +196,7 @@ Check that `dsh-better-sidebar` (≥0.24) is installed and restart the client
193
196
  Install `python-docx`, `openpyxl`, `python-pptx` and `PyMuPDF`, or point `DSH_OFFICE_PYTHON` at an interpreter that has them. Markdown previews do not need Python.
194
197
 
195
198
  **Search cannot find text inside files?**
196
- The search bar matches file names by default — switch to “Content”. Content search is bounded to 1 MB per file, 2000 files, 8 MB and 5 s locally, with a truncation notice.
199
+ The search bar matches file names by default — switch to “Content”. Content search is bounded to 1 MB per file, 2000 files, 8 MB and 5 s, and the notice names the reason when it stops. Remote search uses the same limits and skips `node_modules`, `.conda`, `site-packages` and friends by default — narrow the scope to a folder if you really need to look inside them.
197
200
 
198
201
  **Sync seems to do nothing?**
199
202
  The mirror is off by default; enable it in Settings → Linked workspaces to archive into `.remote`. Runs over 500 files / 50 MB, or files over 20 MB, are skipped; progress is shown in the settings card.
@@ -205,7 +208,10 @@ Web browsers do not expose dropped file paths; the notice tells you to use the d
205
208
  `Ctrl+W` and `Ctrl+Tab` are taken by the browser; use the DSH desktop app for those shortcuts.
206
209
 
207
210
  **Changed the code but the UI is unchanged?**
208
- Run `npm run build` to regenerate `lib/client.js`, then restart the DSH client; Host changes require a process restart.
211
+ Run `npm run build` to regenerate `lib/client.js`, then restart the DSH client. Host changes are loaded when the DSH **process** starts; refreshing the page only swaps the browser half.
212
+
213
+ **The directory pane says “the plugin host is still running older code”?**
214
+ The copy of the plugin on disk is newer than the Host loaded by this DSH process. Quit DSH completely and open it again (a page refresh is not enough, and the plugin does not need reinstalling). Every directory pane compares versions through `meta.info`, so the notice never shows up on a matching install.
209
215
 
210
216
  ## Architecture and development
211
217
 
package/README.md CHANGED
@@ -64,7 +64,8 @@
64
64
  - **单击打开,双击固定**:单击文件夹立即展开/折叠;单击文件直接在文件内容面板打开,再次单击其他文件会替换当前未固定的预览标签。双击文件可固定该标签,之后单击其他文件不会覆盖它;双击文件夹只保持展开。
65
65
  - 工具栏(右侧栏右上角):
66
66
  - **切换文件树**:所有文件 / 已更改的文件 / 所有更改。更改列表来自远端与本地的 `git status`(分支、状态、暂存标记;删除项置灰)。
67
- - **在文件中搜索**:输入 ≥2 个字符后搜索,可在「文件名 / 内容」之间切换。文件名模式远端用 `find`、本地遍历目录;内容模式调用 `fs.grep`(本地逐文件扫描,远端 `grep -rIl`)。结果分「远端 / 本地」列出,超过 200 条会提示截断。
67
+ - **在文件中搜索**:输入 ≥2 个字符后搜索,可在「文件名 / 内容」之间切换。文件名模式远端用 `find`、本地遍历目录;内容模式调用 `fs.grep`,本地与远端共用一套限额(单文件 1 MB、2000 文件、8 MB、5 秒)并默认跳过 `node_modules`、`.git`、`site-packages`、`dist`、`build`、`target`、`.venv`、`.conda` 等目录。结果分「远端 / 本地」列出,**每条显示 `路径 :行号` 和命中的片段**,点击直接打开并把光标定位到该行;被截断时提示会说明原因(文件数 / 体积 / 时间 / 结果上限),超过 200 条也会提示。搜索栏还有三枚开关:`Aa` 区分大小写、`.*` 按正则匹配、文件夹 chip 把范围限定在当前选中的目录。
68
+ - **键盘**:目录树与结果列表支持 `↑`/`↓`/`Home`/`End`,`→` 展开、`←` 收起(文件上按 `←` 回到父目录),`Enter` 打开;搜索框里按 `↓` 直接进入结果列表。文件行悬停时提示里会显示「修改于 …」和大小(按需查询,缓存 5 秒)。
68
69
  - **打开选项菜单**:编辑器 / 系统默认应用(把远端文件下载到临时目录后交给本机应用打开)/ 复制路径。
69
70
  - **传输按钮(双向)**:选中远端文件/文件夹时传输到本地 `.remote`;选中本地文件/文件夹时传输到远端对应相对路径(进入传输队列,一次一个任务并显示状态,失败可重试)。
70
71
  - **打开终端**:远程按钮位于远端树右上角,打开本机终端并用系统 `ssh` 直接进入当前远端目录;联动工作区还会显示本地按钮,直接打开本地目录。右键目录还可用「在此打开终端」在该子目录启动。
@@ -88,8 +89,10 @@
88
89
  会话属于某个远程工作区时自动出现(设置页的「打开目录树」也能随时打开):
89
90
 
90
91
  - 只有**一棵远端树**,不显示本地分栏;根节点同样是「所有文件」,标题栏显示 `用户名@主机 · 远程`。
91
- - 文件以**只读**方式在内部编辑器打开(显示编码、换行符、行数与大小),不会写回本地。
92
- - 右键菜单、搜索(文件名 / 内容)、隐藏文件开关、刷新节流(15 秒)与联动工作区的远端树一致;传输、双向对比、本地相关操作在该模式下不可用。
92
+ - 文件可在内部编辑器里**直接编辑并保存回远端**(`Ctrl/Cmd+S`、自动保存、保存冲突提示、查找替换、按命中行跳转都与联动工作区一致);只读保护仍按文件本身生效:二进制文件、超过 2 MB 或读取被截断时显示「只读」且不可输入。
93
+ - Markdown、Word、Excel、PowerPoint、PDF 等文档走各自的文档面板打开,编辑后同样保存回远端。
94
+ - 右键菜单、搜索(文件名 / 内容,含大小写、正则、限定当前目录)、隐藏文件开关、刷新节流(15 秒)与联动工作区的远端树完全一致:打开、用记事本编辑、复制 / 粘贴、复制路径、移动到…、重命名、删除、更改权限、在此打开终端、新建文件 / 文件夹、属性、下载,以及批量的「删除所选」「移动所选」「批量重命名所选」。
95
+ - 只有依赖本地目录的四项仍然只对联动工作区开放:**传输到本地镜像、传输队列、与本地目录对比、本地终端 / 本地分栏**(远程工作区里传输按钮为禁用态,悬停提示「传输只在联动工作区可用(远端 → 本地)」)。
93
96
  - 两个目录标签(联动 / 远程)都常驻注册,因此当前会话属于联动工作区时也能从设置页打开远程工作区目录树。
94
97
 
95
98
  ### 传输、对比与冲突处理
@@ -97,7 +100,7 @@
97
100
  - **拖拽**:在本地树与远端树之间拖动文件即可互传;同一棵树内拖动(远端内或本地内)则是**移动**,选中多项后拖动会一起移动/传输。也可以把系统文件拖进任一树(Web 端浏览器无法读取拖入文件路径时会提示改用桌面端)。拖动时悬停在折叠目录上 700 ms 会自动展开;多选后用右键「移动所选的 N 项…」也能批量移动。
98
101
  - **覆盖确认**:目标目录已有同名文件时,不再静默覆盖,而是弹出「取消 / 保留两者 / 覆盖」;保留两者会自动生成 `name copy.txt` 或 `name (2).txt`。工具与 API 也可用 `conflict=error|overwrite|unique` 指定策略。
99
102
  - **本地 ⇄ 远端对比**:右键远端目录 →「与本地对比…」,按「仅本地存在 / 仅远端存在 / 大小或时间不同」分组列出;单侧最多扫描 4000 个文件、深度 12、每组展示 200 行,超限会提示。点行直接打开文件;每行可「推送到远端」或「拉取到本地」;本地缺少对应目录时会明确说明。
100
- - **传输队列**:一次执行一个任务,显示排队/传输中/完成/失败;失败项可重试。
103
+ - **传输队列**:一次执行一个任务,显示排队/传输中/完成/失败,运行中会持续显示「已传 N 个 · X MB」;可以点「取消」中途停止(已经传完的文件保留)。失败项可重试。
101
104
  - **上限**:编辑器保存单文件 8 MB;右键「传输」与「下载到默认文件夹」单次最多 150 文件 / 15 MB;拖拽导入/上传单次最多 50 个文件、单个 64 MB;镜像同步默认最多 500 文件 / 50 MB,单文件 20 MB 以上跳过。
102
105
 
103
106
  ### 模型工具
@@ -193,7 +196,7 @@ npm 包名为 `dsh-linked-workspace`,也可以从 npm 安装已发布版本(
193
196
  安装 `python-docx`、`openpyxl`、`python-pptx`、`PyMuPDF`,或用 `DSH_OFFICE_PYTHON` 指向带这些库的解释器。Markdown 预览不需要 Python。
194
197
 
195
198
  **搜索找不到正文里的内容?**
196
- 搜索条默认按文件名匹配,切到「内容」模式再搜;内容搜索对本地单文件限 1 MB、最多 2000 个文件、8 MB、5 秒,超限会提示。
199
+ 搜索条默认按文件名匹配,切到「内容」模式再搜;内容搜索对本地单文件限 1 MB、最多 2000 个文件、8 MB、5 秒,超限会提示原因。远程搜索有同样的限额,并默认跳过 `node_modules`、`.conda`、`site-packages` 等目录——确实要搜这些目录时,请把范围限定到更具体的文件夹,或改用「文件名」模式。
197
200
 
198
201
  **同步没有变化?**
199
202
  镜像默认关闭;在设置 → 联动工作区里开启后才会归档到 `.remote`。超过 500 文件 / 50 MB 或单文件 20 MB 的部分会跳过,可在面板里查看同步进度。
@@ -205,7 +208,10 @@ Web 端浏览器不暴露拖入文件的真实路径,会提示改用桌面端
205
208
  `Ctrl+W`、`Ctrl+Tab` 会被浏览器占用,请在 DSH 桌面端使用这些快捷键。
206
209
 
207
210
  **改了代码但界面没变?**
208
- 先 `npm run build` 重新生成 `lib/client.js`,再重启 DSH 客户端;Host 代码改动需要重启进程。
211
+ 先 `npm run build` 重新生成 `lib/client.js`,再重启 DSH 客户端;Host 代码改动需要在 **DSH 进程启动时**加载,刷新页面只换浏览器端的那一半。
212
+
213
+ **目录树顶部提示「DSH 的插件进程仍在运行旧版代码」?**
214
+ 说明磁盘上的插件已经更新,但当前 DSH 进程加载的还是旧版 Host。完全退出 DSH(不是刷新页面,也不需要重装插件)再打开即可;插件每次打开目录树都会用 `meta.info` 比对一次 Host 版本,正常时不会出现这条提示。
209
215
 
210
216
  ## 架构与开发
211
217
 
package/docs/API.md CHANGED
@@ -20,11 +20,11 @@ Codes: `BAD_REQUEST`, `NOT_FOUND`, `SSH_CONNECT`, `AUTH_FAILED`,
20
20
 
21
21
  | Method | Params | Result |
22
22
  | --- | --- | --- |
23
- | `docs.read` | `{ path, linkedId?, workspaceId? }` | kind-specific document model |
24
- | `docs.write` | `{ path, data, expectedMtime?, linkedId?, workspaceId? }` | `{ kind, path, size, mtime }` |
25
- | `docs.create` | `{ path, kind?, linkedId?, workspaceId? }` | `{ kind, path, size, mtime }` |
26
- | `docs.mdPreview` | `{ path, text?, linkedId?, workspaceId? }` | `{ kind, html }` |
27
- | `docs.mdPdf` | `{ path, text?, linkedId?, workspaceId? }` | `{ kind: "pdf", path, size, mtime }` |
23
+ | `docs.read` | `{ path, linkedId?, remoteId? }` | kind-specific document model |
24
+ | `docs.write` | `{ path, data, expectedMtime?, linkedId?, remoteId? }` | `{ kind, path, size, mtime }` |
25
+ | `docs.create` | `{ path, kind?, linkedId?, remoteId? }` | `{ kind, path, size, mtime }` |
26
+ | `docs.mdPreview` | `{ path, text?, linkedId?, remoteId? }` | `{ kind, html }` |
27
+ | `docs.mdPdf` | `{ path, text?, linkedId?, remoteId? }` | `{ kind: "pdf", path, size, mtime }` |
28
28
 
29
29
  ## Records
30
30
 
@@ -54,6 +54,7 @@ scope root, or absolute inside it.
54
54
  | `hosts.list` | `{ refresh? }` | `{ hosts: HostInfo[] }` (`HostInfo` carries `authType`, `hasCredential`, `hasStoredPassword`) |
55
55
  | `hosts.credentials` | `{ hostId, password?, passphrase?, privateKey?, clear? }` | `{ hostId, authType, hasCredential, hasStoredPassword }` (stores the secret in the plugin's own `ssh-credentials.json`; `clear: true` deletes it) |
56
56
  | `hosts.browse` | `{ hostId, path? }` | `{ path, parent, home, entries }` (dirs + files) |
57
+ | `hosts.mkdir` | `{ hostId, path?, name }` | `{ path }` (creates `name` inside `path`; defaults to the login home; `409`/`FS_EXISTS` when it already exists) |
57
58
  | `remote_workspaces.list` | `{}` | `{ workspaces: RemoteWorkspaceInfo[] }` |
58
59
  | `remote_workspaces.create` | `{ hostId, remotePath, name? }` | `{ workspace }` |
59
60
  | `remote_workspaces.get` | `{ id }` | `{ workspace }` |
@@ -70,6 +71,7 @@ scope root, or absolute inside it.
70
71
  | `fs.move` | `{ linkedId?/remoteId?, path, targetDir? }` | `{ path }` (same remote tree; collision → 409) |
71
72
  | `fs.delete` | `{ linkedId?/remoteId?, path }` | `{}` |
72
73
  | `fs.home` | `{ linkedId?/remoteId? }` | `{ home }` |
74
+ | `meta.info` | `{}` | `{ version, apiRevision, startedAt }` (the client warns when `apiRevision` is older than its own, i.e. DSH still runs an older copy of this plugin) |
73
75
  | `settings.get` | `{}` | `{ editorTheme, editorThemeFamily, editorThemeMode, fileOpenMode, autoSave }` |
74
76
  | `settings.update` | `{ editorTheme?, editorThemeFamily?, editorThemeMode?, fileOpenMode?, autoSave? }` | `{ editorTheme, editorThemeFamily, editorThemeMode, fileOpenMode, autoSave }` |
75
77
  | `local.browse` | `{ path? }` | `{ path, parent, home, entries: [{ name, path }] }` |
@@ -91,11 +93,13 @@ scope root, or absolute inside it.
91
93
  | `skills.read` | `{ linkedId, name }` | `{ name, description, content, path }` |
92
94
  | `git.status` | `{ linkedId?/remoteId?, side: 'remote'|'local' }` | `{ ok, repo, root, branch, changes, error? }` (remote workspaces only support `side: 'remote'`) |
93
95
  | `fs.search` | `{ linkedId?/remoteId?, side, query, maxResults? }` | `{ ok, query, entries, truncated }` (matches **file names**, not contents; use `fs.grep` for contents) |
94
- | `fs.grep` | `{ linkedId?/remoteId?, side, query, maxResults? }` | `{ ok, query, entries, truncated }` (searches file **contents**; local scans stop at 1 MB per file, 2000 files, 8 MB and 5 s; remote uses `grep -rIl`; max 1000 rows) |
96
+ | `fs.grep` | `{ linkedId?/remoteId?, side, query, maxResults?, path?, ignoreCase?, regex? }` | `{ ok, query, entries: [{ path, relative, size, line, preview }], truncated, truncatedReason }` (searches file **contents**; `path` narrows the scan to a sub-folder; `ignoreCase` defaults to `true`; `regex` treats `query` as a regular expression; limits are 1 MB per file, 2000 files, 8 MB and 5 s for both sides, and `truncatedReason` is one of `files`, `bytes`, `deadline`, `results`; max 1000 rows) |
95
97
  | `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) |
96
98
  | `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`) |
97
99
  | `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) |
98
- | `fs.transfer` | `{ linkedId?/remoteId?, path }` | `{ files, bytes, skipped, truncated, dest }` |
100
+ | `fs.transfer` | `{ linkedId?/remoteId?, path, jobId? }` | `{ files, bytes, skipped, truncated, dest }` (with `jobId` the run is tracked and can be polled/cancelled) |
101
+ | `fs.transferProgress` | `{ jobId }` | `{ job: { id, files, bytes, skipped, state, cancelled, reason } \| null }` (`state` is `running`, `done`, `cancelled` or `failed`; jobs are dropped after 5 minutes) |
102
+ | `fs.transferCancel` | `{ jobId }` | `{ cancelled }` (asks the running transfer to stop; it finishes the file in flight, then reports `CANCELLED`) |
99
103
  | `fs.download` | `{ linkedId?/remoteId?, path }` | `{ path, files, bytes, skipped, truncated }` |
100
104
  | `fs.edit` | `{ linkedId?/remoteId?, path, app? }` | `{ localPath, size }` (opens Notepad/default app) |
101
105
  | `fs.copy` | `{ linkedId?/remoteId?, path, targetDir? }` | `{ path, files }` |
package/docs/VERIFY.md CHANGED
@@ -20,21 +20,25 @@ Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-wor
20
20
 
21
21
  1. 点左侧工作区标题栏的「+」→ 弹窗出现「本地工作区 / 联动工作区 / 远程工作区」三个页签。
22
22
  2. **底部按钮一致**:三个页签的「创建」都应是同一种主按钮外观(不因页签切换而变灰);本地页签在没填目录时点「创建」→ 表单里出现红色提示「先选择或填写一个本地目录」,填入后提示消失。
23
- 3. 本地页签:浏览目录、新建文件夹、系统选择器、「使用此目录」→ DSH 工作区创建并选中。
24
- 4. 联动页签:填写主机/远端目录/本地目录 → 创建后工作区出现在左侧,行图标为链环;弹窗关闭。
25
- 5. 远程页签:`1. 选择 SSH 连接 / 2. 远程目录 / 3. 工作区名称`(编号连续、无本地目录步骤)→ 创建后左侧出现占位目录工作区。
26
- 6. 已有旧工作区若标题仍带 `⇄ `:Host 启动约 1 s 内自动去掉前缀(`linked.list` 的 `workspaceTitle` 同步更新)。
23
+ 3. 本地页签:浏览目录、新建文件夹、系统选择器、「使用此目录」→ DSH 工作区创建并选中;路径输入框旁**不再有「打开」按钮**,直接回车即可进入输入的目录。
24
+ 4. 联动/远程页签的**远程目录选择器**:底行左边的路径很长时,路径在自身位置省略显示(悬停看完整路径),右边的「+ 新建文件夹」「使用此目录」始终可见;点「新建文件夹」→ 输入名称 → 回车或「创建」→ 远端建好该目录并自动进入;重名会在选择器内提示「远程目录已存在」。
25
+ 5. 在任一选择器的「按名称过滤…」或「文件夹名称」框里连续打字:弹窗**不能消失**,列表应按输入过滤(旧版本这里会让整个弹窗崩溃)。
26
+ 6. 联动页签:填写主机/远端目录/本地目录 → 创建后工作区出现在左侧,行图标为链环;弹窗关闭。
27
+ 7. 远程页签:`1. 选择 SSH 连接 / 2. 远程目录 / 3. 工作区名称`(编号连续、无本地目录步骤)→ 创建后左侧出现占位目录工作区。
28
+ 8. 已有旧工作区若标题仍带 `⇄ `:Host 启动约 1 s 内自动去掉前缀(`linked.list` 的 `workspaceTitle` 同步更新)。
27
29
 
28
- ## 远程工作区(0.11.0)
30
+ ## 远程工作区(0.11.0,0.15.0 起可编辑)
29
31
 
30
32
  1. **设置页分组**:设置 → 联动工作区 →「远程工作区」组显示计数与说明「会话运行在远端目录:DSH 不在本地创建项目文件,模型通过 remote_workspace 与 linked_workspace 工具读写远端。」;无记录时显示「还没有远程工作区…」。
31
33
  2. **创建**:顶部「创建远程工作区」→ 选主机、填已存在的远端目录、名称 → 卡片出现,左侧工作区列表同步新增同名 DSH 工作区。
32
34
  3. **卡片操作**:打开工作区(跳转并关闭设置)、打开目录树(新标签页出现并关闭设置对话框)、测试连接(Banner「连接正常」)、重命名(卡片与左侧工作区同步改名)、移除远程工作区(两步确认,文案「只移除记录与占位目录,不会删除远端文件。」)。
33
- 4. **目录树**:点「打开目录树」→ 右侧栏出现「远程工作区目录」标签,只有「远程目录」一棵树,根节点「所有文件」;点文件以只读方式打开(状态栏显示 UTF-8 / LF / 行数 / 大小 / 只读)。
34
- 5. **会话链路**:切到该工作区新建会话,让模型 `linked_workspace` `list` / `list_dir` → 能确认 workspaceId、占位目录与远端根目录,并列出远端顶层内容。
35
- 6. **移除清理**:移除后卡片消失、计数归零、左侧工作区消失;`$DSH_HOME/linked-workspace/remote-placeholders/` 下不再有该占位目录,`remote-workspaces.json` 中记录被删除。
36
- 7. **远端目录必须已存在**:填一个不存在的路径 → 报错 `FS_NOT_FOUND`(不会自动创建)。
37
- 8. **标签常驻**:当前会话属于联动工作区时,设置页仍能打开远程工作区目录树(不再依赖会话 scope 才注册标签)。
35
+ 4. **目录树编辑**:点「打开目录树」→ 右侧栏出现「远程工作区目录」标签,只有「远程目录」一棵树,根节点「所有文件」;点一个文本文件以可编辑方式打开(状态栏显示 UTF-8 / LF / 行数 / 大小),改一行后 `Ctrl/Cmd+S` 保存,状态栏出现「已保存」;用 `ssh` 查看远端文件确认内容已变。二进制文件、超过 2 MB 的文件仍显示「只读」且无法输入。
36
+ 5. **文档面板**:打开远端的 `.md` → 文档面板可编辑并保存回远端;`.xlsx` / `.docx` 打开不再报错(旧版本会落到本地路径而失败)。
37
+ 6. **菜单与工具栏对齐**:右键菜单出现「用记事本编辑 / 复制 / 粘贴 / 复制路径 / 移动到… / 重命名 / 删除 / 更改权限 / 在此打开终端 / 新建文件 / 新建文件夹 / 属性 / 下载」,**不出现**「传输… / 队列 / 与本地对比」;多选后出现「删除所选的 N 项 / 移动所选的 N 项 / 批量重命名所选的 N 项」,不出现「传输所选的 N 项」;工具栏传输按钮为禁用态,悬停提示「传输只在联动工作区可用(远端 → 本地)」。
38
+ 7. **会话链路**:切到该工作区新建会话,让模型 `linked_workspace` `list` / `list_dir` → 能确认 workspaceId、占位目录与远端根目录,并列出远端顶层内容。
39
+ 8. **移除清理**:移除后卡片消失、计数归零、左侧工作区消失;`$DSH_HOME/linked-workspace/remote-placeholders/` 下不再有该占位目录,`remote-workspaces.json` 中记录被删除。
40
+ 9. **远端目录必须已存在**:填一个不存在的路径 → 报错 `FS_NOT_FOUND`(不会自动创建)。
41
+ 10. **标签常驻**:当前会话属于联动工作区时,设置页仍能打开远程工作区目录树(不再依赖会话 scope 才注册标签)。
38
42
 
39
43
  ## 首次运行欢迎卡片(0.13.0)
40
44
 
@@ -43,6 +47,7 @@ Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-wor
43
47
  3. **不会重复弹**:刷新页面后不再出现;把该键删掉再刷新会重新出现。
44
48
  4. **深浅两套主题都正常**:深色下卡片底色 `rgb(44,44,46)`、行内底色 `rgb(21,21,23)`、文字浅色;浅色下卡片白底、行内白底带边框、主按钮深底反白。
45
49
  5. **Star 按钮**:链接指向 `https://github.com/jiahui-huang1/dsh-linked-workspace`(新标签打开)。
50
+ 6. **再次查看**:设置 → 联动工作区 顶部点「再次查看欢迎卡片」→ 设置面板关闭、欢迎卡片重新出现;再点「知道了」关闭后刷新不再自动出现。
46
51
 
47
52
  ## 侧边栏入口与可选依赖(0.11.0)
48
53
 
@@ -128,7 +133,11 @@ Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-wor
128
133
  3. 展开工作区 → 目录树懒加载;文件行有按类型区分的彩色图标(.py/.ts/.json/.md/.png 等)。
129
134
  4. **单击**文件夹立即展开/折叠;**单击**文件在中间内容面板打开;单击另一个文件会替换未固定的预览标签。**双击**文件固定标签,之后单击其他文件不会覆盖;双击文件夹保持展开。目录面板保持最右侧可见。本地文件标签不显示图标,并且可在内容面板中编辑保存。
130
135
  5. 工具栏「切换文件树」:所有文件 / 已更改的文件 / 所有更改;远端仓库(如 nsl-wp)应列出 `git status` 修改与未跟踪文件,本地非 git 目录提示「该目录不是 Git 仓库」。
131
- 6. 工具栏「在文件中搜索」:输入 `paradis` → 结果按「远程目录/本地目录」分组,点击结果打开文件;清空/关闭后回到原树。
136
+ 6. 工具栏「在文件中搜索」:切到「内容」→ 输入 `paradis` → 结果按「远程目录/本地目录」分组,**每行给出 `路径 :行号` 和命中的片段**;点击任意一条打开文件并把光标停在该行(Markdown 会切到代码编辑器);被截断时提示写明原因(文件数 / 体积 / 时间 / 结果上限)。清空/关闭后回到原树。
137
+ 6b. 搜索栏三枚开关:`Aa` 关掉后大小写不敏感(`ALPHA` 能命中 `alpha`),`.*` 打开后按正则匹配(输入 `(` 应提示正则无效),文件夹 chip 只扫描当前选中的目录。
138
+ 6c. 键盘:在树里按 `↑`/`↓` 移动焦点,`→` 展开、`←` 收起(在文件上按 `←` 回到父目录),`Enter` 打开;在搜索框按 `↓` 进入结果列表,`Home`/`End` 跳到首尾。
139
+ 6d. 悬停任一文件行:提示里路径下面多一行「修改于 …」和大小;5 秒内再次悬停不会重复请求。
140
+ 6e. 多选 3 个文件 → 右键「批量重命名所选的 3 项…」→ 序号模式填前缀 `img-`、起始 1、位数 2,预览应是 `img-01.txt`…;点「重命名 3 项」后磁盘上文件名确实改变;把两个条目改成同名时「重命名」按钮应被禁用。
132
141
  7. 工具栏「打开选项菜单」:编辑器 / 系统默认应用(远端文件下载到临时目录并用本机默认应用打开)/ 复制路径(剪贴板得到远端绝对路径)。
133
142
  8. 刷新按钮:目录、git 状态与搜索重新加载。
134
143
  9. **多标签/固定**:单击文件 A → 预览标签;单击文件 B → A 被替换为 B;双击 B → B 固定;再单击文件 C → B 保留且新增 C 标签。重复点击已打开文件聚焦原标签;关闭一个标签后其槽位可复用(最多 12 个)。
@@ -137,6 +146,7 @@ Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-wor
137
146
  12. **终端按钮**:远程树工具栏的终端按钮打开外部终端并自动 `cd` 到当前远程根目录;联动工作区的本地按钮打开本地终端并 `cd` 到本地目录。远程终端需使用系统 `ssh`,首次可能要求确认主机指纹/输入密码。
138
147
  13. **自动保存**:设置 → 联动工作区 →「编辑器行为」开启自动保存 → 修改文件后停止输入约 1 秒应自动写盘、灰点消失;关闭自动保存后再修改,不应自动写盘,`Ctrl+S` 才保存。设置重载后开关状态保持。
139
148
  14. **传输按钮**:在树中选中远端文件/文件夹(行高亮),点工具栏传输按钮 → `.remote/` 出现对应文件;右键「队列」可看到排队/传输中/完成状态。
149
+ 14b. **进度与取消**:一次传输大量文件(例如 100 MB 级目录),队列对话框应显示「已传 N 个 · X MB」并持续刷新;传输中点「取消」→ 状态先变「正在取消…」再变「已取消(已传 N 个)」,已经落地的文件保留在目标目录。
140
150
  15. **显示隐藏文件**:打开目录时默认显示 `.git`、`.gitignore`、`.local`/`.remote` 等隐藏项;点眼睛按钮可隐藏,再点恢复。目录面板默认开启。
141
151
  16. **右键菜单**:文件/文件夹/根节点右击 → 传输、下载到默认文件夹、队列、打开、用记事本编辑、复制、粘贴、复制路径、重命名、删除、更改权限、新建(文件夹/文件)、属性;在远端与本地两侧各验证一次重命名/删除/新建/属性。
142
152
  17. **运行中图标**:在该联动工作区的会话里发起一轮对话,运行期间左侧工作区的链环图标应变蓝;结束后(约 5 秒内)恢复原色。
@@ -238,7 +248,15 @@ Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-wor
238
248
  8. **注册工作区**:联动记录的 `workspaceId` 为空时,设置页应显示「注册为工作区」,点击后变为正常的工作区信息。
239
249
  9. **拖拽提示**:拖本地目录到远端、拖远端目录到本地:应分别给出「暂不支持把本地目录拖拽到远端…」「暂不支持把远程目录拖拽到本地…」(同一棵树内拖拽是移动,见下一节)。
240
250
  10. **悬停展开**:拖拽停在折叠目录行 700 ms:该目录应自动展开。
241
- 11. **host-api**:`node test/host-api.mjs` 应为 28 步全部通过。
251
+ 11. **host-api**:`node test/host-api.mjs` 应为 33 步全部通过(0.15.0 起含 `meta.info`)。
252
+
253
+ ## 旧 Host 自检(0.15.0)
254
+
255
+ 1. **正常时不打扰**:插件已重启过后打开任意目录树,顶部**不应**出现任何黄色提示条。
256
+ 2. **旧进程会被指出来**:把 `lib/index.js` 的 `const API_REVISION` 临时改成比客户端 `HOST_API_REVISION`(`src/client.js`)小的值,`npm run build` 后重启实例、打开目录树:顶部出现黄色提示「DSH 的插件进程仍在运行旧版代码,请完全退出并重启 DSH 后再试」。改回原值并重启后提示消失。
257
+ 3. **方法缺失同样算旧**:让 Host 不提供 `meta.info`(例如回退到 0.14.0 的 `lib/index.js`)时,客户端收到 `unknown method`,同样显示上面那条提示,而不是把后续操作失败暴露成 `ENOENT` 之类的原始错误。
258
+ 4. **接口自检**:`curl` 或 Debug 面板调用 `meta.info` 应返回 `{ version, apiRevision, startedAt }`,`apiRevision` 与客户端常量一致。
259
+ 5. **host-api**:`node test/host-api.mjs` 应包含并通过 `meta.info` 一步(33 步全部通过)。
242
260
 
243
261
  ## 批量拖拽与移动(0.13.0)
244
262