dsh-linked-workspace 0.14.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,12 @@
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
+
5
11
  ## 0.14.0 — 2026-11-14
6
12
 
7
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”.
package/README.en.md CHANGED
@@ -89,8 +89,10 @@ Selecting several rows (`Ctrl/Cmd`-click toggles, `Shift`-click selects a range)
89
89
  Appears automatically for sessions that belong to a remote workspace (and can be opened any time from the settings card):
90
90
 
91
91
  - A **single remote tree** with no local pane; it is rooted at “All files” and the header shows `user@host · Remote`.
92
- - 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.
93
- - 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)”).
94
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.
95
97
 
96
98
  ### Transfer, comparison and conflicts
@@ -206,7 +208,10 @@ Web browsers do not expose dropped file paths; the notice tells you to use the d
206
208
  `Ctrl+W` and `Ctrl+Tab` are taken by the browser; use the DSH desktop app for those shortcuts.
207
209
 
208
210
  **Changed the code but the UI is unchanged?**
209
- 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.
210
215
 
211
216
  ## Architecture and development
212
217
 
package/README.md CHANGED
@@ -89,8 +89,10 @@
89
89
  会话属于某个远程工作区时自动出现(设置页的「打开目录树」也能随时打开):
90
90
 
91
91
  - 只有**一棵远端树**,不显示本地分栏;根节点同样是「所有文件」,标题栏显示 `用户名@主机 · 远程`。
92
- - 文件以**只读**方式在内部编辑器打开(显示编码、换行符、行数与大小),不会写回本地。
93
- - 右键菜单、搜索(文件名 / 内容)、隐藏文件开关、刷新节流(15 秒)与联动工作区的远端树一致;传输、双向对比、本地相关操作在该模式下不可用。
92
+ - 文件可在内部编辑器里**直接编辑并保存回远端**(`Ctrl/Cmd+S`、自动保存、保存冲突提示、查找替换、按命中行跳转都与联动工作区一致);只读保护仍按文件本身生效:二进制文件、超过 2 MB 或读取被截断时显示「只读」且不可输入。
93
+ - Markdown、Word、Excel、PowerPoint、PDF 等文档走各自的文档面板打开,编辑后同样保存回远端。
94
+ - 右键菜单、搜索(文件名 / 内容,含大小写、正则、限定当前目录)、隐藏文件开关、刷新节流(15 秒)与联动工作区的远端树完全一致:打开、用记事本编辑、复制 / 粘贴、复制路径、移动到…、重命名、删除、更改权限、在此打开终端、新建文件 / 文件夹、属性、下载,以及批量的「删除所选」「移动所选」「批量重命名所选」。
95
+ - 只有依赖本地目录的四项仍然只对联动工作区开放:**传输到本地镜像、传输队列、与本地目录对比、本地终端 / 本地分栏**(远程工作区里传输按钮为禁用态,悬停提示「传输只在联动工作区可用(远端 → 本地)」)。
94
96
  - 两个目录标签(联动 / 远程)都常驻注册,因此当前会话属于联动工作区时也能从设置页打开远程工作区目录树。
95
97
 
96
98
  ### 传输、对比与冲突处理
@@ -206,7 +208,10 @@ Web 端浏览器不暴露拖入文件的真实路径,会提示改用桌面端
206
208
  `Ctrl+W`、`Ctrl+Tab` 会被浏览器占用,请在 DSH 桌面端使用这些快捷键。
207
209
 
208
210
  **改了代码但界面没变?**
209
- 先 `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 版本,正常时不会出现这条提示。
210
215
 
211
216
  ## 架构与开发
212
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
 
@@ -71,6 +71,7 @@ scope root, or absolute inside it.
71
71
  | `fs.move` | `{ linkedId?/remoteId?, path, targetDir? }` | `{ path }` (same remote tree; collision → 409) |
72
72
  | `fs.delete` | `{ linkedId?/remoteId?, path }` | `{}` |
73
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) |
74
75
  | `settings.get` | `{}` | `{ editorTheme, editorThemeFamily, editorThemeMode, fileOpenMode, autoSave }` |
75
76
  | `settings.update` | `{ editorTheme?, editorThemeFamily?, editorThemeMode?, fileOpenMode?, autoSave? }` | `{ editorTheme, editorThemeFamily, editorThemeMode, fileOpenMode, autoSave }` |
76
77
  | `local.browse` | `{ path? }` | `{ path, parent, home, entries: [{ name, path }] }` |
package/docs/VERIFY.md CHANGED
@@ -27,16 +27,18 @@ Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-wor
27
27
  7. 远程页签:`1. 选择 SSH 连接 / 2. 远程目录 / 3. 工作区名称`(编号连续、无本地目录步骤)→ 创建后左侧出现占位目录工作区。
28
28
  8. 已有旧工作区若标题仍带 `⇄ `:Host 启动约 1 s 内自动去掉前缀(`linked.list` 的 `workspaceTitle` 同步更新)。
29
29
 
30
- ## 远程工作区(0.11.0)
30
+ ## 远程工作区(0.11.0,0.15.0 起可编辑)
31
31
 
32
32
  1. **设置页分组**:设置 → 联动工作区 →「远程工作区」组显示计数与说明「会话运行在远端目录:DSH 不在本地创建项目文件,模型通过 remote_workspace 与 linked_workspace 工具读写远端。」;无记录时显示「还没有远程工作区…」。
33
33
  2. **创建**:顶部「创建远程工作区」→ 选主机、填已存在的远端目录、名称 → 卡片出现,左侧工作区列表同步新增同名 DSH 工作区。
34
34
  3. **卡片操作**:打开工作区(跳转并关闭设置)、打开目录树(新标签页出现并关闭设置对话框)、测试连接(Banner「连接正常」)、重命名(卡片与左侧工作区同步改名)、移除远程工作区(两步确认,文案「只移除记录与占位目录,不会删除远端文件。」)。
35
- 4. **目录树**:点「打开目录树」→ 右侧栏出现「远程工作区目录」标签,只有「远程目录」一棵树,根节点「所有文件」;点文件以只读方式打开(状态栏显示 UTF-8 / LF / 行数 / 大小 / 只读)。
36
- 5. **会话链路**:切到该工作区新建会话,让模型 `linked_workspace` `list` / `list_dir` → 能确认 workspaceId、占位目录与远端根目录,并列出远端顶层内容。
37
- 6. **移除清理**:移除后卡片消失、计数归零、左侧工作区消失;`$DSH_HOME/linked-workspace/remote-placeholders/` 下不再有该占位目录,`remote-workspaces.json` 中记录被删除。
38
- 7. **远端目录必须已存在**:填一个不存在的路径 → 报错 `FS_NOT_FOUND`(不会自动创建)。
39
- 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 才注册标签)。
40
42
 
41
43
  ## 首次运行欢迎卡片(0.13.0)
42
44
 
@@ -246,7 +248,15 @@ Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-wor
246
248
  8. **注册工作区**:联动记录的 `workspaceId` 为空时,设置页应显示「注册为工作区」,点击后变为正常的工作区信息。
247
249
  9. **拖拽提示**:拖本地目录到远端、拖远端目录到本地:应分别给出「暂不支持把本地目录拖拽到远端…」「暂不支持把远程目录拖拽到本地…」(同一棵树内拖拽是移动,见下一节)。
248
250
  10. **悬停展开**:拖拽停在折叠目录行 700 ms:该目录应自动展开。
249
- 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 步全部通过)。
250
260
 
251
261
  ## 批量拖拽与移动(0.13.0)
252
262
 
package/lib/client.js CHANGED
@@ -2566,6 +2566,7 @@ function attributeViolation(name, value, tagName) {
2566
2566
  queueClear: '清空已完成',
2567
2567
  tooManyTabs: '同时打开的文件标签已达上限(12 个),请先关闭一些标签。',
2568
2568
  transferSelected: '传输所选文件/文件夹',
2569
+ transferNeedsLinked: '传输只在联动工作区可用(远端 → 本地)',
2569
2570
  selectFirst: '先在目录树中选择一个远端文件或文件夹。',
2570
2571
  showHidden: '显示隐藏的文件',
2571
2572
  hideHidden: '隐藏隐藏的文件',
@@ -3026,6 +3027,7 @@ function attributeViolation(name, value, tagName) {
3026
3027
  queueClear: 'Clear finished',
3027
3028
  tooManyTabs: 'At most 12 file tabs can be open at once; close one first.',
3028
3029
  transferSelected: 'Transfer the selected file/folder',
3030
+ transferNeedsLinked: 'Transfer needs a linked workspace (remote → local)',
3029
3031
  selectFirst: 'Select a remote file or folder in the tree first.',
3030
3032
  showHidden: 'Show hidden files',
3031
3033
  hideHidden: 'Hide hidden files',
@@ -3113,6 +3115,27 @@ function attributeViolation(name, value, tagName) {
3113
3115
  });
3114
3116
  }
3115
3117
 
3118
+ /**
3119
+ * Keep in sync with `API_REVISION` in lib/index.js. When this build needs
3120
+ * Host methods the running DSH process does not have yet, the directory
3121
+ * pane says so instead of surfacing an unrelated error.
3122
+ */
3123
+ var HOST_API_REVISION = 2;
3124
+ var hostInfoProbe = null;
3125
+
3126
+ function probeHostInfo() {
3127
+ if (hostInfoProbe) return hostInfoProbe;
3128
+ hostInfoProbe = apiCall('meta.info', {}).then(function (info) {
3129
+ var revision = Number(info && info.apiRevision) || 0;
3130
+ return { stale: revision < HOST_API_REVISION, info: info || null };
3131
+ }, function (error) {
3132
+ var message = error && typeof error.message === 'string' ? error.message : '';
3133
+ // No such method: the running Host predates this Client.
3134
+ return { stale: message.indexOf('unknown method:') === 0, info: null };
3135
+ });
3136
+ return hostInfoProbe;
3137
+ }
3138
+
3116
3139
  var CODE_TEXT = {
3117
3140
  zh: {
3118
3141
  NOT_FOUND: '远端对象不存在',
@@ -5036,7 +5059,6 @@ function attributeViolation(name, value, tagName) {
5036
5059
  var locale = props.locale;
5037
5060
  var scope = props.scope;
5038
5061
  var local = props.local === true;
5039
- var readOnly = props.readOnly === true;
5040
5062
  var filePath = props.path;
5041
5063
  var sidebar = sidebarService(ctx);
5042
5064
  var settings = useRuntimeSettings();
@@ -5064,7 +5086,7 @@ function attributeViolation(name, value, tagName) {
5064
5086
  var gutterRef = useRef(null);
5065
5087
  var baseTitle = basename(filePath) || t('fileTabTitle');
5066
5088
  var params = scopeParams(scope);
5067
- var editable = Boolean(load.file && load.file.editable) && !readOnly;
5089
+ var editable = Boolean(load.file && load.file.editable);
5068
5090
 
5069
5091
  var loadFile = useCallback(function () {
5070
5092
  if (!filePath || (!local && !scope)) {
@@ -5136,7 +5158,7 @@ function attributeViolation(name, value, tagName) {
5136
5158
  }, [dirty, baseTitle]);
5137
5159
 
5138
5160
  function saveFile(force) {
5139
- if (readOnly || !load.file || load.file.binary || load.file.tooLarge || save.saving) return Promise.resolve(false);
5161
+ if (!load.file || load.file.binary || load.file.tooLarge || save.saving) return Promise.resolve(false);
5140
5162
  setSave({ saving: true, conflict: false, error: '', ok: false });
5141
5163
  var payload = local ? { path: filePath, content: content } : Object.assign({ path: filePath, content: content }, params);
5142
5164
  if (!force && load.file && typeof load.file.mtime === 'number') payload.expectedMtime = load.file.mtime;
@@ -5461,7 +5483,7 @@ function attributeViolation(name, value, tagName) {
5461
5483
  h('textarea', {
5462
5484
  ref: textareaRef,
5463
5485
  className: 'rw-textarea',
5464
- readOnly: readOnly || !editable,
5486
+ readOnly: !editable,
5465
5487
  value: content,
5466
5488
  spellCheck: false,
5467
5489
  wrap: 'off',
@@ -5502,9 +5524,7 @@ function attributeViolation(name, value, tagName) {
5502
5524
  h('span', { className: 'rw-status-chip' }, formatBytes(file.size)),
5503
5525
  dirty
5504
5526
  ? h('span', { className: 'rw-status-chip rw-status-warn' }, t('dirty'))
5505
- : readOnly
5506
- ? h('span', { className: 'rw-status-chip rw-status-error' }, t('readOnly'))
5507
- : file.tooLarge || file.truncated || file.binary
5527
+ : file.tooLarge || file.truncated || file.binary
5508
5528
  ? h('span', { className: 'rw-status-chip rw-status-error' }, t('readOnly'))
5509
5529
  : h('span', { className: 'rw-status-chip rw-status-ok' }, theme.label ? (locale === 'zh' ? theme.label.zh : theme.label.en) : theme.id),
5510
5530
  h('span', { className: 'rw-fill', style: { flex: '1 1 auto' } })));
@@ -5853,7 +5873,7 @@ function attributeViolation(name, value, tagName) {
5853
5873
  h('button', {
5854
5874
  type: 'button',
5855
5875
  className: 'rw-icon-btn',
5856
- title: t('transferSelected'),
5876
+ title: props.transferTitle || t('transferSelected'),
5857
5877
  disabled: !props.transferEnabled,
5858
5878
  style: props.transferEnabled ? undefined : { opacity: 0.42, cursor: 'default' },
5859
5879
  onClick: props.transferSelected,
@@ -6925,6 +6945,17 @@ function attributeViolation(name, value, tagName) {
6925
6945
  var showHiddenState = useState(true);
6926
6946
  var showHidden = showHiddenState[0];
6927
6947
  var setShowHidden = showHiddenState[1];
6948
+ // A refresh only reloads this bundle, so the running Host may be older.
6949
+ var hostStaleState = useState(false);
6950
+ var hostStale = hostStaleState[0];
6951
+ var setHostStale = hostStaleState[1];
6952
+ useEffect(function () {
6953
+ var alive = true;
6954
+ probeHostInfo().then(function (result) {
6955
+ if (alive && result && result.stale) setHostStale(true);
6956
+ });
6957
+ return function () { alive = false; };
6958
+ }, []);
6928
6959
 
6929
6960
  // Rename tabs persisted before 0.3.0 (type alias keeps the title "远程目录").
6930
6961
  useEffect(function () {
@@ -7818,23 +7849,19 @@ function attributeViolation(name, value, tagName) {
7818
7849
 
7819
7850
  function buildContextItems(menu) {
7820
7851
  var isRemote = menu.side === 'remote';
7821
- if (remoteOnly) {
7822
- var readOnlyItems = [];
7823
- if (isRemote) readOnlyItems.push({ label: t('ctxDownload'), onSelect: function () { downloadEntry(menu); } });
7824
- if (!menu.isDir) readOnlyItems.push({ label: t('ctxOpen'), onSelect: function () { openByMode(menu.side, menu.path); } });
7825
- readOnlyItems.push({ separator: true });
7826
- readOnlyItems.push({ label: t('ctxCopyPath'), onSelect: function () { copyPathToClipboard(menu.path); } });
7827
- readOnlyItems.push({ separator: true });
7828
- readOnlyItems.push({ label: t('ctxProperties'), onSelect: function () { showProperties(menu.side, menu.path); } });
7829
- return readOnlyItems;
7830
- }
7852
+ // Transfer, compare and the local terminal need a local directory, so
7853
+ // they only show up for a linked workspace; everything else works on
7854
+ // both kinds (a remote workspace just has the remote side).
7855
+ var hasLocal = Boolean(selected && selected.kind === 'linked');
7831
7856
  var canPaste = clipboard !== null && clipboard.side === menu.side && menu.isDir;
7832
7857
  var items = [];
7833
7858
  var batch = multi.filter(function (item) { return item.side === menu.side; });
7834
7859
  if (batch.length > 1) {
7835
- items.push({ label: t('ctxTransferSelected', { count: batch.length }), onSelect: function () {
7836
- batch.forEach(function (item) { enqueueTransfer(item.side, item.path, item.name); });
7837
- } });
7860
+ if (hasLocal) {
7861
+ items.push({ label: t('ctxTransferSelected', { count: batch.length }), onSelect: function () {
7862
+ batch.forEach(function (item) { enqueueTransfer(item.side, item.path, item.name); });
7863
+ } });
7864
+ }
7838
7865
  items.push({ label: t('ctxDeleteSelected', { count: batch.length }), onSelect: deleteSelection });
7839
7866
  if (batch.some(function (item) { return item.path === menu.path; })) {
7840
7867
  items.push({ label: t('ctxMoveSelected', { count: batch.length }), onSelect: function () {
@@ -7850,9 +7877,13 @@ function attributeViolation(name, value, tagName) {
7850
7877
  items.push({ separator: true });
7851
7878
  }
7852
7879
  if (isRemote) {
7853
- items.push({ label: t('ctxTransfer'), onSelect: function () { enqueueTransfer('remote', menu.path, menu.name); } });
7880
+ if (hasLocal) {
7881
+ items.push({ label: t('ctxTransfer'), onSelect: function () { enqueueTransfer('remote', menu.path, menu.name); } });
7882
+ }
7854
7883
  items.push({ label: t('ctxDownload'), onSelect: function () { downloadEntry(menu); } });
7855
- items.push({ label: t('ctxQueue'), onSelect: function () { setDialog({ kind: 'queue' }); } });
7884
+ if (hasLocal) {
7885
+ items.push({ label: t('ctxQueue'), onSelect: function () { setDialog({ kind: 'queue' }); } });
7886
+ }
7856
7887
  items.push({ separator: true });
7857
7888
  } else {
7858
7889
  items.push({ label: t('ctxTransferLocal'), onSelect: function () { enqueueTransfer('local', menu.path, menu.name); } });
@@ -7895,7 +7926,7 @@ function attributeViolation(name, value, tagName) {
7895
7926
  items.push({ label: t('ctxTerminalHere'), onSelect: function () { openTerminal(menu.side, menu.path); } });
7896
7927
  items = items.concat(newEntryMenuItems(menu, t, setDialog));
7897
7928
  }
7898
- if (menu.isDir && menu.side === 'remote' && selected && selected.kind === 'linked') {
7929
+ if (menu.isDir && menu.side === 'remote' && hasLocal) {
7899
7930
  items.push({ label: t('ctxCompare'), onSelect: function () { openCompare(menu.path); } });
7900
7931
  }
7901
7932
  items.push({ separator: true });
@@ -8138,6 +8169,10 @@ function attributeViolation(name, value, tagName) {
8138
8169
  var info = null;
8139
8170
  if (notice) info = h('div', { className: 'rw-linked-notice' }, h(Banner, { kind: notice.kind }, notice.text));
8140
8171
  else if (data.data.error) info = h('div', { className: 'rw-linked-notice' }, h(Banner, { kind: 'error' }, t('workspacesFailed') + ':' + messageOf(data.data.error, t, locale)));
8172
+ if (hostStale) {
8173
+ var staleNotice = h('div', { className: 'rw-linked-notice' }, h(Banner, { kind: 'warn' }, t('staleHost')));
8174
+ info = info ? h('div', null, staleNotice, info) : staleNotice;
8175
+ }
8141
8176
 
8142
8177
  var body;
8143
8178
  if (searchOpen && searchQuery.trim().length >= 2) {
@@ -8253,7 +8288,6 @@ function attributeViolation(name, value, tagName) {
8253
8288
  scope: activeFile.side === 'remote' ? sourceScopeOf(selected) : undefined,
8254
8289
  path: activeFile.path,
8255
8290
  local: activeFile.side === 'local',
8256
- readOnly: remoteOnly,
8257
8291
  hideHeader: true,
8258
8292
  focusLine: activeFile.line || 0,
8259
8293
  onSaveReady: function (handler) {
@@ -8287,7 +8321,8 @@ function attributeViolation(name, value, tagName) {
8287
8321
  localEnabled: !remoteOnly && selected.kind === 'linked',
8288
8322
  showHidden: showHidden,
8289
8323
  onToggleHidden: function () { setShowHidden(!showHidden); },
8290
- transferEnabled: !remoteOnly && (multi.length > 0 || Boolean(selectedEntry)),
8324
+ transferEnabled: selected.kind === 'linked' && (multi.length > 0 || Boolean(selectedEntry)),
8325
+ transferTitle: selected.kind === 'linked' ? undefined : t('transferNeedsLinked'),
8291
8326
  transferSelected: function () {
8292
8327
  if (multi.length === 0 && !selectedEntry) {
8293
8328
  showNotice('info', t('selectFirst'));
package/lib/index.js CHANGED
@@ -32,6 +32,27 @@ export const name = 'dsh-linked-workspace'
32
32
  /** The web server carries the JSON API; the rest are the linked-workspace tool faces. */
33
33
  export const inject = ['webServer', 'tools', 'systemPrompt', 'workingDirectory']
34
34
 
35
+ /**
36
+ * Bumped whenever the Client half starts relying on a newer Host method table.
37
+ * The Client compares this number with its own and warns when the DSH process
38
+ * is still running an older copy of the Host — refreshing the page only swaps
39
+ * the browser bundle, so the two halves can drift by one restart.
40
+ */
41
+ const API_REVISION = 2
42
+
43
+ /** When this copy of the Host was loaded; shown by `meta.info`. */
44
+ const STARTED_AT = new Date().toISOString()
45
+
46
+ /** The published plugin version, read once so `meta.info` can report it. */
47
+ const PACKAGE_VERSION = (() => {
48
+ try {
49
+ const file = fileURLToPath(new URL('../package.json', import.meta.url))
50
+ return JSON.parse(readFileSync(file, 'utf8')).version || ''
51
+ } catch {
52
+ return ''
53
+ }
54
+ })()
55
+
35
56
  const DATA_VERSION = 1
36
57
  const SETTINGS_VERSION = 1
37
58
  const SETTINGS_DEFAULTS = Object.freeze({ editorTheme: 'github-light', editorThemeFamily: 'github', editorThemeMode: 'system', fileOpenMode: 'editor', autoSave: false })
@@ -1827,7 +1848,7 @@ export function apply(ctx) {
1827
1848
  }
1828
1849
 
1829
1850
  async function docTarget(params) {
1830
- if (params.linkedId || params.workspaceId) {
1851
+ if (params.linkedId || params.remoteId || params.workspaceId) {
1831
1852
  const scope = await requireScope(params)
1832
1853
  const target = scopeTarget(scope, params.path)
1833
1854
  return { remote: true, scope, path: target }
@@ -2650,6 +2671,17 @@ export function apply(ctx) {
2650
2671
  return { home: await scope.remote.homeDir() }
2651
2672
  },
2652
2673
 
2674
+ // ── build info ─────────────────────────────────────────────────────────
2675
+
2676
+ /**
2677
+ * Lets the Client detect a Host that predates the code on disk: the method
2678
+ * itself is missing on old builds, and the revision is lower once a Client
2679
+ * needs newer methods.
2680
+ */
2681
+ async 'meta.info'() {
2682
+ return { version: PACKAGE_VERSION, apiRevision: API_REVISION, startedAt: STARTED_AT }
2683
+ },
2684
+
2653
2685
  // ── settings ───────────────────────────────────────────────────────────
2654
2686
 
2655
2687
  async 'settings.get'() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-linked-workspace",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Linked local ⇄ remote workspaces and remote workspaces for DeepSeek Harness: theme-aware split editor, file-type icons, and agent tools that edit remote files directly.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",