dsh-linked-workspace 0.33.0 → 0.34.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 +14 -0
- package/docs/API.md +3 -2
- package/docs/VERIFY.md +15 -0
- package/lib/client.js +107 -9
- package/lib/index.js +56 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.34.0 — 2026-12-01
|
|
4
|
+
|
|
5
|
+
- **工作区外下载不会再点出两份**:下载期间按钮变成「下载中…」并禁用,结束后恢复;下载完成的页脚多一个
|
|
6
|
+
「打开所在文件夹」,直接定位到刚保存的文件(Host 新增 `local.reveal`,Windows 用 `explorer /select,`)。
|
|
7
|
+
- **工作区外图片的内联预览上限收到 8 MB**:超过就提示下载,而不是把 24 MB 的 base64 塞进内存;图片数据解不开时
|
|
8
|
+
面板给出「图片数据无法解码,请下载后查看。」,不再是一片空白。
|
|
9
|
+
- **「只在当前目录搜」对额外根目录也成立**:`fs.grep` 的 `includeOutside` 现在把同一个相对目录套到每个额外根,
|
|
10
|
+
某个根没有这个目录就跳过(不再让整次搜索失败);结果回报扫过几个根、丢了几个(超出 5 个上限时面板会说明)。
|
|
11
|
+
- **槽位满的提示不再只在目录面板里**:面板没打开时(例如直接在会话里点链接)改由框架级 toast 说明
|
|
12
|
+
「文件标签位已满(24 个)」。
|
|
13
|
+
- **目录栏头部折叠按钮有了 `aria-label`**,读屏能念出它。
|
|
14
|
+
- **Host**:新增 `local.reveal { path }`;`media.readOutside` 的内联上限改为 8 MB;`fs.grep` 新增
|
|
15
|
+
`outsideRoots`/`outsideDropped`/`outsideSkipped` 三个回报字段。
|
|
16
|
+
|
|
3
17
|
## 0.33.0 — 2026-11-30
|
|
4
18
|
|
|
5
19
|
- **工作区外的文件终于能拿出来、图片也能看了**:只读标签的工具栏多了「下载到默认文件夹」(落到
|
package/docs/API.md
CHANGED
|
@@ -78,7 +78,7 @@ scope root, or absolute inside it.
|
|
|
78
78
|
| `fs.list` | `{ linkedId?/remoteId?, path, limit?, offset? }` | `{ path, entries: RemoteEntry[], total, offset, limit, hasMore }` (default 500, max 5000). Listings are cached for 5 s for `offset > 0`; writes, mkdir, rename, move, delete, copy and transfers invalidate the cache. |
|
|
79
79
|
| `fs.read` | `{ linkedId?/remoteId?, path, maxBytes? }` | `FileRead` |
|
|
80
80
|
| `media.read` | `{ linkedId?/remoteId?, path }` | `{ path, size, mtime, mime, base64 }` (PNG/JPG/GIF/WebP/BMP/ICO/AVIF/SVG, max 24 MB) |
|
|
81
|
-
| `media.readOutside` | `{ linkedId?/remoteId?, path }` | `{ path, size, mtime, mime, base64 }` (same types
|
|
81
|
+
| `media.readOutside` | `{ linkedId?/remoteId?, path }` | `{ path, size, mtime, mime, base64 }` (same types as `media.read`, inline only up to 8 MB; past that it answers `FS_TOO_LARGE` and the viewer offers the download) |
|
|
82
82
|
| `fs.write` | `{ linkedId?/remoteId?, path, content, expectedMtime?, createOnly? }` | `{ path, size, mtime }` (`createOnly: true`: existing target → 409) |
|
|
83
83
|
| `fs.stat` | `{ linkedId?/remoteId?, path }` | `{ path, relative, type, size, mtime, mode }` |
|
|
84
84
|
| `fs.mkdir` | `{ linkedId?/remoteId?, path, createOnly? }` | `{}` (`createOnly: true`: existing target → 409) |
|
|
@@ -101,6 +101,7 @@ scope root, or absolute inside it.
|
|
|
101
101
|
| `local.list` | `{ path, limit?, offset? }` | `{ path, entries: [{ name, path, type, size, mtime }], total, offset, limit, hasMore }` |
|
|
102
102
|
| `local.openExternal` | `{ path }` | `{ opened, path }` |
|
|
103
103
|
| `local.openUrl` | `{ url }` | `{ opened, url }` (only `http:`, `https:`, `mailto:` and `tel:`; the preview hands external links here instead of navigating — anything else is `BAD_REQUEST`) |
|
|
104
|
+
| `local.reveal` | `{ path }` | `{ opened, folder }` (absolute local path; opens the file manager with the file selected, or the folder itself) |
|
|
104
105
|
| `terminal.open` | `{ linkedId?/remoteId?, side: 'remote'\|'local', path? }` | `{ opened, side, path, host? }` (`path` must stay inside the workspace; remote workspaces only support `side: 'remote'`) |
|
|
105
106
|
| `fs.openExternal` | `{ linkedId?/remoteId?, path }` | `{ opened, localPath, size }` |
|
|
106
107
|
| `localWorkspace.create` | `{ path, name? }` | `{ workspaceId, title, path }` |
|
|
@@ -109,7 +110,7 @@ scope root, or absolute inside it.
|
|
|
109
110
|
| `skills.read` | `{ linkedId, name }` | `{ name, description, content, path }` |
|
|
110
111
|
| `git.status` | `{ linkedId?/remoteId?, side: 'remote'|'local' }` | `{ ok, repo, root, branch, changes, error? }` (remote workspaces only support `side: 'remote'`) |
|
|
111
112
|
| `fs.search` | `{ linkedId?/remoteId?, side, query, maxResults? }` | `{ ok, query, entries, truncated }` (matches **file names**, not contents; use `fs.grep` for contents) |
|
|
112
|
-
| `fs.grep` | `{ linkedId?/remoteId?, side, query, maxResults?, path?, ignoreCase?, regex?, includeIgnored?, resultMode?, includeOutside?, 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; `includeOutside: true` also sweeps the extra roots and marks those hits with `outsideRoot`) |
|
|
113
|
+
| `fs.grep` | `{ linkedId?/remoteId?, side, query, maxResults?, path?, ignoreCase?, regex?, includeIgnored?, resultMode?, includeOutside?, 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; `includeOutside: true` also sweeps the extra roots and marks those hits with `outsideRoot`, and the answer carries `outsideRoots` / `outsideDropped` / `outsideSkipped`) |
|
|
113
114
|
| `fs.grepCancel` | `{ jobId }` | `{ cancelled }` (marks the job started by `fs.grep`'s `jobId`; the Host checks it between files and answers `truncatedReason: 'cancelled'`) |
|
|
114
115
|
| `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`) |
|
|
115
116
|
| `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`) |
|
package/docs/VERIFY.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Manual verification checklist
|
|
2
2
|
|
|
3
|
+
## 工作区外:下载、图片与额外根目录搜索(未发布)
|
|
4
|
+
|
|
5
|
+
1. 额外根目录里放一个 3 MB 以上的 `big.txt`,点击它的聊天链接,然后连点两次「下载到默认文件夹」:
|
|
6
|
+
按钮立刻变「下载中…」并禁用,`~/Downloads` 里**只出现一份**文件。
|
|
7
|
+
2. 下载完成后页脚出现「打开所在文件夹」,点它应当用资源管理器定位到该文件。
|
|
8
|
+
3. 额外根目录里放一张 **9 MB** 的 PNG:面板显示「图片超过 8 MB,无法内联预览,请下载后查看」,同排有下载按钮。
|
|
9
|
+
4. 放一张 1 MB 的 PNG:正常内联预览;把文件内容改成非图片字节(保留 .png 后缀)后重开,应显示
|
|
10
|
+
「图片数据无法解码,请下载后查看。」而不是空白。
|
|
11
|
+
5. 额外根目录 A 下有 `sub/x.txt`,B 下没有 `sub/`:打开「+/」并在搜索栏限定到 `sub`,结果只来自 A,
|
|
12
|
+
且不报错;若配置了 6 个额外根目录,结果区多一行「还有 N 个额外根目录没有扫(上限 5 个)」。
|
|
13
|
+
6. 关掉目录面板,在会话里连续点开 25 个不同的聊天文件链接:第 25 个应在页面底部弹出
|
|
14
|
+
「文件标签位已满(24 个)。先关掉一个再点。」(框架级 toast,5 秒后消失)。
|
|
15
|
+
7. 目录栏头部的折叠按钮:读屏应念出「开启/关闭联动工作区目录面板」。
|
|
16
|
+
|
|
17
|
+
|
|
3
18
|
## 工作区外的下载、图片与搜索(未发布)
|
|
4
19
|
|
|
5
20
|
1. 联动工作区根目录在 `/shared_data_ssd1/huangjh`,额外根目录里放 `/shared_data_hdd1/huangjh/x/pic.png`(≥ 1 像素真图)
|
package/lib/client.js
CHANGED
|
@@ -2852,6 +2852,10 @@ function isInsideRoot(root, target) {
|
|
|
2852
2852
|
outsideMtime: '修改于 {{when}}',
|
|
2853
2853
|
outsideCeiling: '已达到 {{size}} 的读取上限,剩下的内容请下载后查看。',
|
|
2854
2854
|
outsideDownload: '下载到默认文件夹',
|
|
2855
|
+
outsideDownloading: '下载中…',
|
|
2856
|
+
outsideReveal: '打开所在文件夹',
|
|
2857
|
+
imageBroken: '图片数据无法解码,请下载后查看。',
|
|
2858
|
+
searchOutsideDropped: '还有 {{count}} 个额外根目录没有扫(上限 5 个)。',
|
|
2855
2859
|
outsideDownloaded: '已下载到 {{path}}',
|
|
2856
2860
|
tabsFull: '文件标签位已满({{count}} 个)。先关掉一个再点。',
|
|
2857
2861
|
linkOutside: '这个链接指向工作区之外,没有打开:{{path}}',
|
|
@@ -3472,6 +3476,10 @@ function isInsideRoot(root, target) {
|
|
|
3472
3476
|
outsideMtime: 'Modified {{when}}',
|
|
3473
3477
|
outsideCeiling: 'Reached the {{size}} reading ceiling; download the file for the rest.',
|
|
3474
3478
|
outsideDownload: 'Download to the default folder',
|
|
3479
|
+
outsideDownloading: 'Downloading…',
|
|
3480
|
+
outsideReveal: 'Open the folder',
|
|
3481
|
+
imageBroken: 'The image data could not be decoded; download it instead.',
|
|
3482
|
+
searchOutsideDropped: '{{count}} more extra roots were left out (the sweep stops at 5).',
|
|
3475
3483
|
outsideDownloaded: 'Saved to {{path}}',
|
|
3476
3484
|
tabsFull: 'Every file tab is in use ({{count}}). Close one and try again.',
|
|
3477
3485
|
linkOutside: 'That link points outside the workspace, so it was left alone: {{path}}',
|
|
@@ -4461,6 +4469,7 @@ function isInsideRoot(root, target) {
|
|
|
4461
4469
|
'.rw-doc-body{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;overflow:auto;padding:10px}',
|
|
4462
4470
|
'.rw-outside-actions{display:flex;flex-direction:column;gap:8px;padding:4px 0}',
|
|
4463
4471
|
'.rw-outside-footer{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:8px 0 2px;border-top:1px solid var(--dsw-alias-border-l1);margin-top:8px;flex:none}',
|
|
4472
|
+
'.rw-toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:70;max-width:70vw;padding:8px 14px;border-radius:8px;background:var(--dsw-alias-bg-layer-3,#2c2c2e);color:var(--dsw-alias-label-primary);box-shadow:0 8px 24px rgba(0,0,0,.28);font-size:12px;line-height:18px}',
|
|
4464
4473
|
'.rw-outside-image{display:block;max-width:100%;max-height:100%;margin:0 auto;object-fit:contain}',
|
|
4465
4474
|
'.rw-outside-text{margin:0;font-family:var(--dsw-alias-font-mono,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:12px;line-height:1.5;white-space:pre-wrap;word-break:break-word;flex:1 1 auto;min-height:0}',
|
|
4466
4475
|
'.rw-doc-textarea{width:100%;min-height:260px;flex:1 1 auto;resize:none;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:10px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:12.5px/18px ui-monospace,"Cascadia Code",Consolas,monospace;outline:none;box-sizing:border-box}',
|
|
@@ -7092,6 +7101,9 @@ function isInsideRoot(root, target) {
|
|
|
7092
7101
|
state.loading ? h('div', { className: 'rw-hint-row' }, Spinner(12), t('loading')) : null,
|
|
7093
7102
|
!state.loading && total === 0 ? h('div', { className: 'rw-hint-row' }, t('searchEmpty')) : null,
|
|
7094
7103
|
!state.loading && state.truncated ? h('div', { className: 'rw-hint-row' }, t(reasonKey)) : null,
|
|
7104
|
+
!state.loading && Number(state.outsideDropped) > 0
|
|
7105
|
+
? h('div', { className: 'rw-hint-row' }, t('searchOutsideDropped', { count: String(state.outsideDropped) }))
|
|
7106
|
+
: null,
|
|
7095
7107
|
groups.map(function (group) {
|
|
7096
7108
|
if (group.entries.length === 0) return null;
|
|
7097
7109
|
return h('div', { key: group.side, className: 'rw-change-group' },
|
|
@@ -7301,6 +7313,17 @@ function isInsideRoot(root, target) {
|
|
|
7301
7313
|
// F6: the settings page can replay the card, so the flag is cleared and an
|
|
7302
7314
|
// event wakes the overlay instead of the user hunting for local storage.
|
|
7303
7315
|
var WELCOME_EVENT = 'dsh-linked-workspace:welcome-open';
|
|
7316
|
+
var TOAST_EVENT = 'dsh-linked-workspace:toast';
|
|
7317
|
+
|
|
7318
|
+
// A one-line message for things that happen outside any panel (a chat link
|
|
7319
|
+
// with every file slot taken, for instance).
|
|
7320
|
+
function notifyToast(key, vars) {
|
|
7321
|
+
try {
|
|
7322
|
+
window.dispatchEvent(new CustomEvent(TOAST_EVENT, { detail: { key: key, vars: vars || {} } }));
|
|
7323
|
+
} catch (error) {
|
|
7324
|
+
/* no window (tests) */
|
|
7325
|
+
}
|
|
7326
|
+
}
|
|
7304
7327
|
var SHOW_HIDDEN_KEY = 'dsh-linked-workspace:show-hidden';
|
|
7305
7328
|
|
|
7306
7329
|
function readShowHidden() {
|
|
@@ -7372,7 +7395,34 @@ function rememberShowHidden(value) {
|
|
|
7372
7395
|
h('div', { className: 'rw-welcome-row-where' }, props.where));
|
|
7373
7396
|
}
|
|
7374
7397
|
|
|
7375
|
-
function
|
|
7398
|
+
function ToastHost(props) {
|
|
7399
|
+
var locale = useLocale(props.ctx);
|
|
7400
|
+
var t = useMemo(function () { return makeT(locale); }, [locale]);
|
|
7401
|
+
var stateRef = useState(null);
|
|
7402
|
+
var toast = stateRef[0];
|
|
7403
|
+
var setToast = stateRef[1];
|
|
7404
|
+
|
|
7405
|
+
useEffect(function () {
|
|
7406
|
+
function onToast(event) {
|
|
7407
|
+
var detail = (event && event.detail) || {};
|
|
7408
|
+
if (!detail.key) return;
|
|
7409
|
+
setToast({ text: t(detail.key, detail.vars || {}), at: Date.now() });
|
|
7410
|
+
}
|
|
7411
|
+
window.addEventListener(TOAST_EVENT, onToast);
|
|
7412
|
+
return function () { window.removeEventListener(TOAST_EVENT, onToast); };
|
|
7413
|
+
}, [t]);
|
|
7414
|
+
|
|
7415
|
+
useEffect(function () {
|
|
7416
|
+
if (!toast) return undefined;
|
|
7417
|
+
var timer = setTimeout(function () { setToast(null); }, 5000);
|
|
7418
|
+
return function () { clearTimeout(timer); };
|
|
7419
|
+
}, [toast && toast.at]);
|
|
7420
|
+
|
|
7421
|
+
if (!toast) return null;
|
|
7422
|
+
return h('div', { className: 'rw-toast', role: 'status', 'aria-live': 'polite' }, toast.text);
|
|
7423
|
+
}
|
|
7424
|
+
|
|
7425
|
+
function WelcomeCard(props) {
|
|
7376
7426
|
var locale = useLocale(props.ctx);
|
|
7377
7427
|
var t = useMemo(function () { return makeT(locale); }, [locale]);
|
|
7378
7428
|
var state = useState(function () { return !welcomeSeen(); });
|
|
@@ -10360,6 +10410,7 @@ function rememberShowHidden(value) {
|
|
|
10360
10410
|
}),
|
|
10361
10411
|
local: results[1] && results[1].entries ? results[1].entries : [],
|
|
10362
10412
|
truncated: Boolean((results[0] && results[0].truncated) || (results[1] && results[1].truncated)),
|
|
10413
|
+
outsideDropped: Number(results[0] && results[0].outsideDropped) || 0,
|
|
10363
10414
|
truncatedReason: (results[0] && results[0].truncatedReason) || (results[1] && results[1].truncatedReason) || '',
|
|
10364
10415
|
error: (results[0] && results[0].error) || (results[1] && results[1].error) || null,
|
|
10365
10416
|
});
|
|
@@ -10786,7 +10837,13 @@ function rememberShowHidden(value) {
|
|
|
10786
10837
|
? h('span', { className: 'rw-autopush-when' }, new Date(autoPush.lastPushAt).toLocaleTimeString())
|
|
10787
10838
|
: null)
|
|
10788
10839
|
: null,
|
|
10789
|
-
h('button', {
|
|
10840
|
+
h('button', {
|
|
10841
|
+
type: 'button',
|
|
10842
|
+
className: 'rw-icon-btn',
|
|
10843
|
+
title: t('toggleDirectory'),
|
|
10844
|
+
'aria-label': t('toggleDirectory'),
|
|
10845
|
+
onClick: function () { setDirectoryOpen(false); },
|
|
10846
|
+
}, IconClose(11))),
|
|
10790
10847
|
h('div', { className: 'rw-directory-body' }, body))
|
|
10791
10848
|
: null),
|
|
10792
10849
|
ctxMenu ? h(ContextMenu, { menu: ctxMenu, items: buildContextItems(ctxMenu), t: t, onClose: closeContextMenu }) : null,
|
|
@@ -10807,6 +10864,12 @@ function rememberShowHidden(value) {
|
|
|
10807
10864
|
var busyRef = useState(false);
|
|
10808
10865
|
var busy = busyRef[0];
|
|
10809
10866
|
var setBusy = busyRef[1];
|
|
10867
|
+
var downloadingRef = useState(false);
|
|
10868
|
+
var downloading = downloadingRef[0];
|
|
10869
|
+
var setDownloading = downloadingRef[1];
|
|
10870
|
+
var savedRef = useState('');
|
|
10871
|
+
var savedPath = savedRef[0];
|
|
10872
|
+
var setSavedPath = savedRef[1];
|
|
10810
10873
|
var noteRef = useState('');
|
|
10811
10874
|
var note = noteRef[0];
|
|
10812
10875
|
var setNote = noteRef[1];
|
|
@@ -10875,21 +10938,27 @@ function rememberShowHidden(value) {
|
|
|
10875
10938
|
}
|
|
10876
10939
|
|
|
10877
10940
|
function download() {
|
|
10878
|
-
if (
|
|
10879
|
-
|
|
10941
|
+
if (downloading) return;
|
|
10942
|
+
setDownloading(true);
|
|
10880
10943
|
setNote('');
|
|
10881
10944
|
apiCall('fs.downloadOutside', Object.assign({ path: filePath }, scopeParams(scope))).then(function (result) {
|
|
10882
|
-
|
|
10945
|
+
setDownloading(false);
|
|
10883
10946
|
var saved = result && result.path ? String(result.path) : '';
|
|
10947
|
+
setSavedPath(saved);
|
|
10884
10948
|
setNote(t('outsideDownloaded', { path: saved }));
|
|
10885
10949
|
}, function (error) {
|
|
10886
|
-
|
|
10950
|
+
setDownloading(false);
|
|
10887
10951
|
setLoad(function (previous) {
|
|
10888
10952
|
return { loading: false, more: false, error: error, data: previous.data };
|
|
10889
10953
|
});
|
|
10890
10954
|
});
|
|
10891
10955
|
}
|
|
10892
10956
|
|
|
10957
|
+
function revealSaved() {
|
|
10958
|
+
if (savedPath === '') return;
|
|
10959
|
+
apiCall('local.reveal', { path: savedPath }).catch(function () { /* the file manager may refuse */ });
|
|
10960
|
+
}
|
|
10961
|
+
|
|
10893
10962
|
function addRoot() {
|
|
10894
10963
|
if (busy) return;
|
|
10895
10964
|
setBusy(true);
|
|
@@ -10921,8 +10990,9 @@ function rememberShowHidden(value) {
|
|
|
10921
10990
|
className: 'rw-btn rw-btn-sm',
|
|
10922
10991
|
title: t('outsideDownload'),
|
|
10923
10992
|
'aria-label': t('outsideDownload'),
|
|
10993
|
+
disabled: downloading,
|
|
10924
10994
|
onClick: download,
|
|
10925
|
-
}, t('outsideDownload')),
|
|
10995
|
+
}, t(downloading ? 'outsideDownloading' : 'outsideDownload')),
|
|
10926
10996
|
h('button', {
|
|
10927
10997
|
className: 'rw-btn rw-btn-sm',
|
|
10928
10998
|
title: t('outsideReload'),
|
|
@@ -10957,6 +11027,12 @@ function rememberShowHidden(value) {
|
|
|
10957
11027
|
? h('span', { className: 'rw-hint' }, t('outsideMtime', { when: new Date(data.mtime).toLocaleString() }))
|
|
10958
11028
|
: null,
|
|
10959
11029
|
note ? h('span', { className: 'rw-hint' }, note) : null,
|
|
11030
|
+
savedPath !== '' ? h('button', {
|
|
11031
|
+
className: 'rw-btn rw-btn-sm rw-btn-ghost',
|
|
11032
|
+
title: t('outsideReveal'),
|
|
11033
|
+
'aria-label': t('outsideReveal'),
|
|
11034
|
+
onClick: revealSaved,
|
|
11035
|
+
}, t('outsideReveal')) : null,
|
|
10960
11036
|
canMore
|
|
10961
11037
|
? h('button', { className: 'rw-btn rw-btn-sm', disabled: load.more, onClick: loadMore },
|
|
10962
11038
|
load.more ? t('loading') : t('outsideLoadMore'))
|
|
@@ -10972,6 +11048,9 @@ function rememberShowHidden(value) {
|
|
|
10972
11048
|
className: 'rw-outside-image',
|
|
10973
11049
|
alt: basename(filePath),
|
|
10974
11050
|
src: 'data:' + String(image.data.mime || 'application/octet-stream') + ';base64,' + String(image.data.base64 || ''),
|
|
11051
|
+
onError: function () {
|
|
11052
|
+
setImage({ loading: false, error: { code: 'FS_DECODE', message: t('imageBroken') }, data: null });
|
|
11053
|
+
},
|
|
10975
11054
|
})
|
|
10976
11055
|
: h('div', { className: 'rw-doc-loading' }, h('div', { className: 'rw-spinner' }), h('span', null, t('loading')));
|
|
10977
11056
|
body = h('div', { className: 'rw-doc-body' }, picture, footer);
|
|
@@ -14192,8 +14271,12 @@ function rememberShowHidden(value) {
|
|
|
14192
14271
|
// With every slot busy the click is claimed but has nowhere to land: the
|
|
14193
14272
|
// native viewer would only show "file not found", so report it as handled
|
|
14194
14273
|
// and let the panel say why nothing opened.
|
|
14195
|
-
if (!opened && slotFull === true
|
|
14196
|
-
|
|
14274
|
+
if (!opened && slotFull === true) {
|
|
14275
|
+
if (typeof slotFullNotice === 'function') {
|
|
14276
|
+
try { slotFullNotice(); } catch (error) { /* the panel may be gone */ }
|
|
14277
|
+
} else {
|
|
14278
|
+
notifyToast('tabsFull', { count: String(FILE_SLOT_COUNT) });
|
|
14279
|
+
}
|
|
14197
14280
|
}
|
|
14198
14281
|
return opened || slotFull === true;
|
|
14199
14282
|
}
|
|
@@ -14487,6 +14570,21 @@ function rememberShowHidden(value) {
|
|
|
14487
14570
|
console.error('[dsh-linked-workspace] welcome card registration failed', error && error.message ? error.message : error);
|
|
14488
14571
|
}
|
|
14489
14572
|
|
|
14573
|
+
try {
|
|
14574
|
+
ctx.slots.inject('shell.overlay', function () {
|
|
14575
|
+
return ctx.slots.register({
|
|
14576
|
+
name: 'shell.overlay',
|
|
14577
|
+
id: 'linked-workspace-toast',
|
|
14578
|
+
order: 81,
|
|
14579
|
+
label: function () { return makeT(readLocale(ctx))('tabsFull'); },
|
|
14580
|
+
}, function (props) {
|
|
14581
|
+
return h(ToastHost, Object.assign({}, props, { ctx: ctx }));
|
|
14582
|
+
});
|
|
14583
|
+
});
|
|
14584
|
+
} catch (error) {
|
|
14585
|
+
console.error('[dsh-linked-workspace] toast registration failed', error && error.message ? error.message : error);
|
|
14586
|
+
}
|
|
14587
|
+
|
|
14490
14588
|
try {
|
|
14491
14589
|
ctx.slots.inject('settings.section', function () {
|
|
14492
14590
|
return ctx.slots.register({
|
package/lib/index.js
CHANGED
|
@@ -147,6 +147,9 @@ const PEEK_LIMIT = 512 * 1024
|
|
|
147
147
|
const READ_CAP = 8 * 1024 * 1024
|
|
148
148
|
const MAX_WRITE_BYTES = 8 * 1024 * 1024
|
|
149
149
|
const MAX_MEDIA_BYTES = 24 * 1024 * 1024
|
|
150
|
+
// Inline previews carry a base64 copy inside a JS string, so they are capped
|
|
151
|
+
// well below the hard media limit; past this the viewer points at the download.
|
|
152
|
+
const MAX_INLINE_IMAGE_BYTES = 8 * 1024 * 1024
|
|
150
153
|
// ── remote command execution (0.17.0) ───────────────────────────────────────/** Longest command line accepted; anything longer is almost always a paste error. */
|
|
151
154
|
const EXEC_MAX_COMMAND = 8000
|
|
152
155
|
const EXEC_TIMEOUT_DEFAULT = 60_000
|
|
@@ -2856,7 +2859,9 @@ export function apply(ctx) {
|
|
|
2856
2859
|
const GREP_DEADLINE_MS = 5000
|
|
2857
2860
|
const GREP_DEADLINE_MAX = 10000
|
|
2858
2861
|
const GREP_PREVIEW_CHARS = 120
|
|
2859
|
-
|
|
2862
|
+
// How many extra roots one content search may sweep.
|
|
2863
|
+
const OUTSIDE_GREP_ROOTS = 5
|
|
2864
|
+
const GREP_MAX_QUERY = 200
|
|
2860
2865
|
|
|
2861
2866
|
// Path completion (`fs.references`) is about names, not contents, so it walks
|
|
2862
2867
|
// more entries but reads no files.
|
|
@@ -4281,8 +4286,8 @@ export function apply(ctx) {
|
|
|
4281
4286
|
if (!mime) throw new ApiError('BAD_REQUEST', '该文件不是支持的图片格式')
|
|
4282
4287
|
const stat = await scope.remote.stat(target)
|
|
4283
4288
|
if (stat.type === 'dir') throw new ApiError('FS_IS_DIR', '目标是目录,无法预览')
|
|
4284
|
-
if (stat.size >
|
|
4285
|
-
const read = await scope.remote.readFile(target, { maxBytes:
|
|
4289
|
+
if (stat.size > MAX_INLINE_IMAGE_BYTES) throw new ApiError('FS_TOO_LARGE', '图片超过 8 MB,无法内联预览,请下载后查看')
|
|
4290
|
+
const read = await scope.remote.readFile(target, { maxBytes: MAX_INLINE_IMAGE_BYTES })
|
|
4286
4291
|
return { path: target, size: stat.size, mtime: stat.mtime, mime, base64: read.data.toString('base64') }
|
|
4287
4292
|
},
|
|
4288
4293
|
|
|
@@ -4734,6 +4739,31 @@ export function apply(ctx) {
|
|
|
4734
4739
|
// A link inside a remote document cannot be followed by the window that
|
|
4735
4740
|
// shows the preview: the SPA has no route for it and goes blank. External
|
|
4736
4741
|
// links are handed to the system browser instead.
|
|
4742
|
+
async 'local.reveal'(params = {}) {
|
|
4743
|
+
const rawPath = typeof params.path === 'string' ? params.path.trim() : ''
|
|
4744
|
+
if (rawPath === '' || !isAbsolute(rawPath)) throw new ApiError('BAD_REQUEST', '本地路径必须是绝对路径')
|
|
4745
|
+
const target = resolve(rawPath)
|
|
4746
|
+
let info
|
|
4747
|
+
try {
|
|
4748
|
+
info = await fsStat(target)
|
|
4749
|
+
} catch (error) {
|
|
4750
|
+
throw mapLocalFsError(error)
|
|
4751
|
+
}
|
|
4752
|
+
const folder = info.isDirectory() ? target : dirname(target)
|
|
4753
|
+
const command = process.platform === 'win32' ? 'explorer.exe' : process.platform === 'darwin' ? 'open' : 'xdg-open'
|
|
4754
|
+
const args = process.platform === 'win32' && !info.isDirectory() ? ['/select,', target] : [info.isDirectory() ? target : folder]
|
|
4755
|
+
let started = false
|
|
4756
|
+
try {
|
|
4757
|
+
const child = spawn(command, args, { detached: true, stdio: 'ignore', windowsHide: true })
|
|
4758
|
+
child.unref()
|
|
4759
|
+
started = true
|
|
4760
|
+
} catch (error) {
|
|
4761
|
+
started = false
|
|
4762
|
+
}
|
|
4763
|
+
if (!started) throw new ApiError('INTERNAL', '无法打开文件管理器')
|
|
4764
|
+
return { opened: true, folder }
|
|
4765
|
+
},
|
|
4766
|
+
|
|
4737
4767
|
async 'local.openUrl'(params = {}) {
|
|
4738
4768
|
const raw = typeof params.url === 'string' ? params.url.trim() : ''
|
|
4739
4769
|
if (!/^(?:https?|mailto|tel):/i.test(raw)) throw new ApiError('BAD_REQUEST', '只支持 http、https、mailto 与 tel 链接')
|
|
@@ -4861,16 +4891,34 @@ export function apply(ctx) {
|
|
|
4861
4891
|
if (side === 'remote') {
|
|
4862
4892
|
const found = await contentSearchRemote(scope.remote, scope.root, query, maxResults, options)
|
|
4863
4893
|
if (params.includeOutside !== true) return found
|
|
4864
|
-
const
|
|
4865
|
-
if (
|
|
4894
|
+
const allRoots = extraRoots()
|
|
4895
|
+
if (allRoots.length === 0) return found
|
|
4896
|
+
// "Only this folder" has to mean the same relative folder under every
|
|
4897
|
+
// extra root; a root that has no such folder is skipped, not failed.
|
|
4898
|
+
const relative = typeof options.path === 'string' ? options.path.trim().replace(/^\/+/, '') : ''
|
|
4899
|
+
const roots = allRoots.slice(0, OUTSIDE_GREP_ROOTS)
|
|
4866
4900
|
const merged = found.entries.slice()
|
|
4867
4901
|
let truncated = found.truncated
|
|
4868
4902
|
let scanned = found.scannedFiles
|
|
4903
|
+
let outsideSkipped = 0
|
|
4869
4904
|
for (const root of roots) {
|
|
4870
4905
|
if (merged.length >= maxResults) {
|
|
4871
4906
|
truncated = true
|
|
4872
4907
|
break
|
|
4873
4908
|
}
|
|
4909
|
+
if (relative !== '') {
|
|
4910
|
+
let info
|
|
4911
|
+
try {
|
|
4912
|
+
info = await scope.remote.stat(posix.join(root, relative))
|
|
4913
|
+
} catch (error) {
|
|
4914
|
+
outsideSkipped += 1
|
|
4915
|
+
continue
|
|
4916
|
+
}
|
|
4917
|
+
if (info.type !== 'dir') {
|
|
4918
|
+
outsideSkipped += 1
|
|
4919
|
+
continue
|
|
4920
|
+
}
|
|
4921
|
+
}
|
|
4874
4922
|
const part = await contentSearchRemote(scope.remote, root, query, maxResults - merged.length, options)
|
|
4875
4923
|
scanned += part.scannedFiles
|
|
4876
4924
|
if (part.truncated) truncated = true
|
|
@@ -4890,6 +4938,9 @@ export function apply(ctx) {
|
|
|
4890
4938
|
scannedFiles: scanned,
|
|
4891
4939
|
scannedBytes: found.scannedBytes,
|
|
4892
4940
|
skippedFiles: found.skippedFiles,
|
|
4941
|
+
outsideRoots: roots.length,
|
|
4942
|
+
outsideDropped: Math.max(0, allRoots.length - roots.length),
|
|
4943
|
+
outsideSkipped,
|
|
4893
4944
|
}
|
|
4894
4945
|
}
|
|
4895
4946
|
if (scope.kind !== 'linked') throw new ApiError('BAD_REQUEST', '只有联动工作区有本地目录')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-linked-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.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",
|