dsh-linked-workspace 0.17.0 → 0.19.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 +18 -0
- package/README.en.md +13 -0
- package/README.md +13 -0
- package/docs/API.md +16 -4
- package/docs/VERIFY.md +20 -0
- package/lib/client.js +421 -3
- package/lib/index.js +810 -37
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
English · [简体中文](CHANGELOG.zh.md)
|
|
4
4
|
|
|
5
|
+
## 0.19.0 — 2026-11-19
|
|
6
|
+
|
|
7
|
+
- **Push local edits back.** `linked.plan` compares the local directory with the remote one file by file against the hash remembered from the last push, and classifies each file as added / changed / conflict / gone-upstream; the tree toolbar gained a sync button with a diff preview, and the row menu gained "push this to the remote side".
|
|
8
|
+
- `linked.push` writes the planned files back with a temporary file + rename per file, a `dryRun` switch, and `conflict: 'skip' | 'overwrite' | 'newer'`; a file that moved on both sides is never clobbered unless you ask for it. `linked.pushCancel { jobId }` stops a running push after the current file.
|
|
9
|
+
- **Opt-in autoPush**: `autoPushEnabled` (off by default, first enable asks for confirmation in place), `autoPushDebounceMs` (default 1500, 300–60000), plus `autoPushInclude`/`autoPushExclude` globs. It always pushes with `conflict: 'skip'`, so a formatter on this side never overwrites a remote edit.
|
|
10
|
+
- `fs.transfer` accepts `paths: string[]`, so a multi-selection becomes one request instead of N.
|
|
11
|
+
- `transfer.history` returns the last 50 transfers and pushes (`transfer-history.json`).
|
|
12
|
+
- `apiRevision` 4 → 5.
|
|
13
|
+
|
|
14
|
+
## 0.18.0 — 2026-11-19
|
|
15
|
+
|
|
16
|
+
- New `fs.references` and a `references` action on `linked_workspace`: case-insensitive path completion with the **best match first** (exact name → prefix → substring) and directories flagged `dir`; it stops after 20000 entries or 3 s and reports `truncated`. The model can now resolve a remote path you mention by name.
|
|
17
|
+
- The sidebar context menu gained “Copy as @ reference”, which puts `@relative/path` (for example `@src/app.py`) on the clipboard, ready to paste into the chat.
|
|
18
|
+
- Content search options: a “search usually ignored folders” switch (`includeIgnored` — `node_modules`/`.venv`/`dist` … are searched too while `.git`/`.hg`/`.svn` stay out), a files-only mode (`resultMode: 'files'`), and adjustable `maxFiles`/`maxFileBytes`/`timeoutMs` (5 s by default, 10 s at most). The search bar has two more chips for these.
|
|
19
|
+
- Content search now reports what it walked (`scannedFiles`/`scannedBytes`/`skippedFiles`) and shows “Scanned N files · X” above the results, and it can be **stopped midway**: new `fs.grepCancel { jobId }` backs a “Stop” button in the search bar, and a cancelled sweep reports `truncatedReason: 'cancelled'`.
|
|
20
|
+
- Known limitation (0.18.0): DSH's `@` completion popup cannot be extended by a plugin — the Host `fileReferences` service only exposes `list(agent, query, signal)` with no provider registration — so remote paths do not appear in that popup; use the `references` action or “Copy as @ reference”.
|
|
21
|
+
- Host API revision is now `apiRevision: 4`.
|
|
22
|
+
|
|
5
23
|
## 0.17.0 — 2026-11-19
|
|
6
24
|
|
|
7
25
|
- New `hosts.exec`: let the model run **one** non-interactive command on the remote host (builds, tests, logs) instead of composing `ssh`. Off by default and gated three ways: the `execEnabled` switch, the host allow-list `execHostIds`, and the optional workspace allow-list `execWorkspaceIds` (empty means no restriction). Refusals are audited too.
|
package/README.en.md
CHANGED
|
@@ -127,6 +127,13 @@ The workspace resolves automatically when the session cwd falls inside a linked
|
|
|
127
127
|
|
|
128
128
|
Every attempt — including refused ones — appends a line to `$DSH_HOME/linked-workspace/exec-audit.jsonl` (command, exit code, duration, first 4 KB of output, refusal reason), rotated to `.1` past 5 MB; the settings block has an “Open audit log” button. Output is clipped per stream to `execMaxOutputChars` (200000 by default), timeouts come from `execTimeoutMs` (60 s by default, 600 s per call at most), and `cwd` may not escape the workspace root.
|
|
129
129
|
|
|
130
|
+
### @ references and finer search (0.18.0)
|
|
131
|
+
|
|
132
|
+
- 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.
|
|
133
|
+
- Right-click a file or folder → “Copy as @ reference” to put `@relative/path` (e.g. `@src/app.py`) on the clipboard.
|
|
134
|
+
- 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.
|
|
135
|
+
- 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.
|
|
136
|
+
|
|
130
137
|
### Running icon / local skills
|
|
131
138
|
|
|
132
139
|
- While a linked workspace has a running session, its link icon turns **blue** (refreshed about every 5 seconds).
|
|
@@ -141,6 +148,12 @@ Every attempt — including refused ones — appends a line to `$DSH_HOME/linked
|
|
|
141
148
|
.remote/ # optional: mirrored remote files (written on read/save, full sync on demand)
|
|
142
149
|
```
|
|
143
150
|
|
|
151
|
+
### Push local edits back (0.19.0)
|
|
152
|
+
|
|
153
|
+
The sync button in the tree toolbar compares the local directory with the remote one and lists what is added, changed, in conflict, or gone upstream. "Push (skip conflicts)" writes back only the files you changed locally while the remote side left them alone; a file that moved on both sides stays under conflict until you explicitly choose "Push and overwrite conflicts".
|
|
154
|
+
|
|
155
|
+
To let it happen on its own, enable Settings → "Linked workspaces" → "Push back automatically": the switch asks for confirmation first, and once on, saving locally writes back after about 1.5 s while always skipping conflicts.
|
|
156
|
+
|
|
144
157
|
## Screenshots
|
|
145
158
|
|
|
146
159
|
Settings → “Linked workspaces”: the upper half lists **linked workspaces** (local folder ⇄ remote folder), the lower half lists **remote workspaces** (the session runs inside the remote folder). Each card shows the connection state; linked workspaces also have the mirror switch and the sync button. The host name and the local placeholder path are blurred in this shot.
|
package/README.md
CHANGED
|
@@ -127,6 +127,13 @@
|
|
|
127
127
|
每次尝试——包括被拒绝的——都会写一行到 `$DSH_HOME/linked-workspace/exec-audit.jsonl`(含命令、退出码、耗时、输出的前 4 KB、拒绝原因),超过 5 MB 自动轮转为 `.1`;设置页有「打开审计日志」按钮。输出按 `execMaxOutputChars`(默认 200000 字符/流)截断,超时由 `execTimeoutMs`(默认 60 秒,单次最多 600 秒)控制,`cwd` 不能跑出工作区根目录。
|
|
128
128
|
|
|
129
129
|
|
|
130
|
+
### @ 引用与更细的搜索(0.18.0)
|
|
131
|
+
|
|
132
|
+
- `references` 动作(对应 `fs.references`)按**路径名**做大小写不敏感匹配,最佳匹配排在最前(完全同名 → 前缀 → 包含),目录带 `dir` 标记;模型可以用它把你口头提到的文件名解析成远端真实路径。
|
|
133
|
+
- 右键文件或目录 →「复制为 @ 引用」,把 `@相对路径`(如 `@src/app.py`)复制到剪贴板。
|
|
134
|
+
- 内容搜索多了两枚开关:「包含通常忽略的目录」(`node_modules`/`.venv`/`dist` 也会搜,`.git` 始终排除)、「只列文件名」;搜索中可以点「停止」中途取消,结果上方会显示「扫描 N 个文件 · X」。
|
|
135
|
+
- 已知限制:DSH 的 `@` 补全弹窗没有开放给插件(宿主 `fileReferences` 服务只提供 `list()`,没有注册入口),所以远端路径不会出现在 `@` 下拉里,请用 `references` 动作或右键复制。
|
|
136
|
+
|
|
130
137
|
### 运行中图标 / 本地技能
|
|
131
138
|
|
|
132
139
|
- 联动工作区下若有正在运行的会话(本地会话 turn 进行中),左侧工作区的链环图标会变成**蓝色**;刷新间隔约 5 秒。
|
|
@@ -141,6 +148,12 @@
|
|
|
141
148
|
.remote/ # 可选:远端文件镜像存档(读取/保存时自动归档,可手动全量同步)
|
|
142
149
|
```
|
|
143
150
|
|
|
151
|
+
### 把本地改动推回远端(0.19.0)
|
|
152
|
+
|
|
153
|
+
目录栏的同步按钮会比较本地与远端:新增、修改、冲突、远端已删四类都会列出来。点「推送(跳过冲突)」只写回本地改过、远端没动过的文件;两边都改过的会留在「冲突」里,只有明确选「推送并覆盖冲突」才会用本地版本覆盖。
|
|
154
|
+
|
|
155
|
+
想让它自动发生,可以在设置 →「联动工作区」→「自动推回远端」里开启:开关会先弹一段说明要你确认,开启后本地保存约 1.5 秒就会写回远端,而且始终跳过冲突。
|
|
156
|
+
|
|
144
157
|
## 界面
|
|
145
158
|
|
|
146
159
|
设置 →「联动工作区」:上半部分是**联动工作区**(本地目录 ⇄ 远端目录),下半部分是**远程工作区**(会话直接运行在远端目录)。卡片里能看到连接状态,联动工作区还有镜像开关和同步按钮。图中的主机名与本地占位目录做了模糊处理。
|
package/docs/API.md
CHANGED
|
@@ -96,11 +96,17 @@ scope root, or absolute inside it.
|
|
|
96
96
|
| `skills.read` | `{ linkedId, name }` | `{ name, description, content, path }` |
|
|
97
97
|
| `git.status` | `{ linkedId?/remoteId?, side: 'remote'|'local' }` | `{ ok, repo, root, branch, changes, error? }` (remote workspaces only support `side: 'remote'`) |
|
|
98
98
|
| `fs.search` | `{ linkedId?/remoteId?, side, query, maxResults? }` | `{ ok, query, entries, truncated }` (matches **file names**, not contents; use `fs.grep` for contents) |
|
|
99
|
-
| `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) |
|
|
99
|
+
| `fs.grep` | `{ linkedId?/remoteId?, side, query, maxResults?, path?, ignoreCase?, regex?, includeIgnored?, resultMode?, maxFiles?, maxFileBytes?, timeoutMs?, jobId? }` | `{ ok, query, entries: [{ path, relative, size, line, preview, matches }], truncated, truncatedReason, scannedFiles, scannedBytes, skippedFiles }` (searches file **contents**; `path` narrows the scan to a sub-folder; `ignoreCase` defaults to `true`; `regex` treats `query` as a regular expression; `includeIgnored: true` also walks usually ignored folders such as `node_modules`/`.venv`/`dist` (`.git`/`.hg`/`.svn` always stay out); `resultMode: 'files'` lists file names only (`line: 0`, empty `preview`, `matches` = hit count); `maxFiles` (default 2000), `maxFileBytes` (default 1 MB) and `timeoutMs` (default 5 s, max 10 s) raise or lower the sweep; 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`, `cancelled`; max 1000 rows) |
|
|
100
|
+
| `fs.grepCancel` | `{ jobId }` | `{ cancelled }` (marks the job started by `fs.grep`'s `jobId`; the Host checks it between files and answers `truncatedReason: 'cancelled'`) |
|
|
101
|
+
| `linked.plan` | `{ id, maxFiles? }` | `{ linkedId, localPath, remotePath, added, changed, conflict, removed, unchanged, pending, truncated, skipped, maxFiles }` (each entry carries `relative`, `size`, `localHash`, `remoteHash`; a file that moved on both sides since the last push lands in `conflict`) |
|
|
102
|
+
| `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) |
|
|
103
|
+
| `linked.pushCancel` | `{ jobId }` | `{ cancelled }` (stops after the file being written) |
|
|
104
|
+
| `transfer.history` | `{}` | `{ entries: [{ kind: "transfer" \| "push", direction?, linkedId?, files, bytes, skipped, truncated?, at }] }` (newest first, at most 50) |
|
|
105
|
+
| `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) |
|
|
100
106
|
| `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) |
|
|
101
107
|
| `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`) |
|
|
102
108
|
| `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) |
|
|
103
|
-
| `fs.transfer` | `{ linkedId?/remoteId?, path, jobId? }` | `{ files, bytes, skipped, truncated, dest }` (with `jobId` the run is tracked and can be polled/cancelled) |
|
|
109
|
+
| `fs.transfer` | `{ linkedId?/remoteId?, path, paths?, jobId? }` | `{ files, bytes, skipped, truncated, dest }` (with `jobId` the run is tracked and can be polled/cancelled) |
|
|
104
110
|
| `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) |
|
|
105
111
|
| `fs.transferCancel` | `{ jobId }` | `{ cancelled }` (asks the running transfer to stop; it finishes the file in flight, then reports `CANCELLED`) |
|
|
106
112
|
| `fs.download` | `{ linkedId?/remoteId?, path }` | `{ path, files, bytes, skipped, truncated }` |
|
|
@@ -155,7 +161,7 @@ Under `$DSH_HOME/linked-workspace/`:
|
|
|
155
161
|
|
|
156
162
|
`linked_workspace` (Host tool, JSON-Schema parameters) actions: `list`, `info`,
|
|
157
163
|
`list_dir`, `read`, `write`, `replace`, `stat`, `mkdir`, `rename`, `delete`,
|
|
158
|
-
`sync`, `exec`. It resolves the workspace from the session working directory (a linked
|
|
164
|
+
`sync`, `exec`, `references`. It resolves the workspace from the session working directory (a linked
|
|
159
165
|
local directory or a remote workspace placeholder) or from an explicit
|
|
160
166
|
`workspace` reference (id, local/placeholder path, or name), confines paths to
|
|
161
167
|
the remote root, and mirrors reads/writes into `.remote/` when a linked
|
|
@@ -163,7 +169,13 @@ workspace mirrors. `list` shows both kinds, labelled `(linked)` and `(remote)`;
|
|
|
163
169
|
`info` returns `kind: "linked" | "remote"` and `sync` is rejected for remote
|
|
164
170
|
workspaces. `exec` takes `command` (≤ 8000 characters), an optional `cwd`
|
|
165
171
|
(inside the workspace root) and `timeout_ms`, and refuses unless the switches
|
|
166
|
-
described under `hosts.exec` are on.
|
|
172
|
+
described under `hosts.exec` are on. `references` takes `query` (≤ 200
|
|
173
|
+
characters) and an optional `limit`, and lists matching paths best-match first
|
|
174
|
+
(directories marked `dir`) — that is how the model resolves a remote path a user
|
|
175
|
+
mentioned by name. The `@` completion popup itself is **not** extensible: the
|
|
176
|
+
Host `fileReferences` service only exposes `list(agent, query, signal)` and has
|
|
177
|
+
no provider registration, so remote candidates cannot be injected into it; use
|
|
178
|
+
the action or the sidebar's “Copy as @ reference”.
|
|
167
179
|
|
|
168
180
|
`linked_skills` (Host tool) actions: `list`, `read` — local skills
|
|
169
181
|
(`~/.dsh/skills`, `~/.agents/skills`, `<local>/.dsh/skills`,
|
package/docs/VERIFY.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
Host code (lib/) reloads live with `plugin_manager set_plugin include:linked-workspace-ui`; client changes load with **应用 → 重新加载界面** (a full restart is only needed after re-installing the package). Then verify:
|
|
4
4
|
|
|
5
|
+
## 本地改动推回远端(0.19.0)
|
|
6
|
+
|
|
7
|
+
1. 在联动工作区的**本地**目录里改一个文件、新建一个文件,然后点目录栏的同步按钮:差异预览里能看到「新增 1 · 修改 1」,并列出这两个文件。
|
|
8
|
+
2. 点「推送(跳过冲突)」后提示「已推送 N 个文件」,远端目录刷新后能看到新内容(`ssh … cat` 核对)。
|
|
9
|
+
3. 在**远端**改同一个文件、本地再改一次,重新打开差异预览:该文件出现在「冲突」里;点「推送(跳过冲突)」后远端内容保持不变,提示里带「1 个冲突未处理」;点「推送并覆盖冲突」才会用本地版本覆盖。
|
|
10
|
+
4. 在行菜单上对某个远端文件点「把这个推送到远端」:差异预览只包含该文件。
|
|
11
|
+
5. 设置 → 联动工作区 → 「自动推回远端」:打开开关会先出现黄色说明与「我明白,开启自动推送」,未确认前不会开启;确认后本地保存文件约 1.5 秒后自动出现在远端,同一文件远端也改过时保留远端版本。
|
|
12
|
+
6. 断网或 SSH 断开时推送会失败并显示原因,本地文件不受影响。
|
|
13
|
+
|
|
14
|
+
## @ 引用与搜索增强(0.18.0)
|
|
15
|
+
|
|
16
|
+
1. 内容搜索栏在「内容」模式下有五枚 chip(`Aa`、`.*`、目录范围、`.*/`、文件图标)与一个「停止」按钮(仅在搜索中、且有 jobId 时出现)。
|
|
17
|
+
2. 打开「只列文件名」→ 结果行不再显示命中行与行号,只列文件;打开「包含通常忽略的目录」→ 原本被跳过的 `node_modules`/`.venv`/`dist` 中的文件也会出现(`.git` 始终不出现)。
|
|
18
|
+
3. 搜索一段较大的目录时点「停止」→ 请求 `fs.grepCancel { jobId }`,结果提前结束并在 `truncatedReason` 里给出 `cancelled`。
|
|
19
|
+
4. 结果上方显示「扫描 N 个文件 · X(跳过 M 个)」,数字来自 `scannedFiles`/`scannedBytes`/`skippedFiles`。
|
|
20
|
+
5. 右键任一文件或目录 → 「复制为 @ 引用」→ 剪贴板得到 `@相对路径`(如 `@src/app.py`),提示「已复制 @src/app.py」。
|
|
21
|
+
6. `fs.references { linkedId, query: 'a.txt' }` → `{ candidates: [{ relative, name, kind }], scannedEntries }`,完全同名的排最前;`limit` 生效;空 query 返回空候选而不是报错。
|
|
22
|
+
7. 模型侧:让它「用 linked_workspace 的 references 动作找一下 xxx 文件」→ 工具卡片按「dir/file + 相对路径」列出候选。
|
|
23
|
+
8. 已知限制(需人工确认未变化):`@` 补全弹窗里不会出现远端路径 —— 宿主 `fileReferences` 服务只有 `list(agent, query, signal)`,没有 provider 注册入口。
|
|
24
|
+
|
|
5
25
|
## 远端命令执行(0.17.0)
|
|
6
26
|
|
|
7
27
|
> 注意:本机这套 DSH **Web** 构建里没有可见的设置入口(账号菜单只有「意见反馈 / 退出登录」,`Ctrl+K` 是会话搜索,插件详情页只有「卸载」),所以设置区块的渲染要在**桌面端**确认;Host 侧行为可以直接用下面的 API 命令验证。
|