dsh-linked-workspace 0.32.0 → 0.33.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
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.33.0 — 2026-11-30
4
+
5
+ - **工作区外的文件终于能拿出来、图片也能看了**:只读标签的工具栏多了「下载到默认文件夹」(落到
6
+ `~/Downloads`,文件名重名自动加序号),工作区外的 PNG/JPEG/GIF/WebP 等直接在面板里内联预览 ——
7
+ 这两条正是原先「文件过大请下载」「二进制文件无法预览」两句提示指向、却无处可去的死路。
8
+ - **读取上限与二进制的说明不再指向空气**:到达 4 MB 上限或遇到不支持的类型时,同一排按钮里就有下载。
9
+ - **一页 1 MB**:4.6 MB 的文件从「14 次点击」变成 5 次;上限仍是 4 MB,DOM 不会失控。
10
+ - **标签位排满会说明原因**:24 个位置全被占用时给一条提示,不再让点击无声消失。
11
+ - **内容搜索可以覆盖额外根目录**:搜索栏多一个「+/」开关(最多 5 个前缀),命中行以根目录名作前缀,
12
+ 点一下照样落进工作区外的只读标签。默认关闭,不开就不影响原有搜索速度。
13
+ - **Host**:新增 `fs.downloadOutside`、`media.readOutside`;`fs.grep` 新增 `includeOutside`,
14
+ 结果条目带 `outsideRoot`。
15
+
3
16
  ## 0.32.0 — 2026-11-29
4
17
 
5
18
  - **Working outside the workspace is now readable, not truncated**: the read-only tab pages through a file
package/docs/API.md CHANGED
@@ -60,6 +60,7 @@ scope root, or absolute inside it.
60
60
  | `hosts.forgetHostKey` | `{ hostId?/authority? }` | `{ authority, removed }` — drops the stored key (and the live connection) so the next connect trusts the host again; `settings.hostKeyPolicy` decides whether an unknown key is accepted (`tofu`, default) or refused (`strict`) |
61
61
  | `hosts.status` | `{ hostIds? }` | `{ statuses: { [hostId]: { state, reason?, message?, latencyMs?, checkedAt? } } }` (in-memory snapshot of the pool, never dials; an `error` older than 60 s is reported as `idle`; defaults to every known host of the host list plus every workspace's host id) |
62
62
  | `fs.readOutside` | `{ linkedId?, remoteId?, path, maxBytes?, offset? }` | `{ path, size, mtime, binary, offset, returned, truncated, content }` (`offset` pages through a large file; `returned` is how many bytes this call read) |
63
+ | `fs.downloadOutside` | `{ linkedId?/remoteId?, path }` | `{ path, files, bytes, skipped, truncated }` (copies into `~/Downloads`; the same 64 MB per-file limit as the tree) |
63
64
  | `fs.writeOutside` | `{ linkedId?, remoteId?, path, content, ifModifiedSince? }` | `{ path, size, mtime, created }` (8 MB limit; only under an `extraRoots` prefix; audited) |
64
65
  | `fs.listOutside` | `{ linkedId?, remoteId?, path }` | `{ path, entries }` (only under an `extraRoots` prefix; audited) |
65
66
  | `hosts.forward` | `{ hostId, remotePort, remoteHost?, localPort? }` | `{ forward: { id, hostId, hostName, remoteHost, remotePort, localPort, startedAt, url } }` (localhost TCP tunnel; reuses an identical one; the definition is written to `forwards.json`, so a restarted Host re-binds the same port) |
@@ -77,6 +78,7 @@ scope root, or absolute inside it.
77
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. |
78
79
  | `fs.read` | `{ linkedId?/remoteId?, path, maxBytes? }` | `FileRead` |
79
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 and 24 MB cap as `media.read`, read through the extra-roots gate) |
80
82
  | `fs.write` | `{ linkedId?/remoteId?, path, content, expectedMtime?, createOnly? }` | `{ path, size, mtime }` (`createOnly: true`: existing target → 409) |
81
83
  | `fs.stat` | `{ linkedId?/remoteId?, path }` | `{ path, relative, type, size, mtime, mode }` |
82
84
  | `fs.mkdir` | `{ linkedId?/remoteId?, path, createOnly? }` | `{}` (`createOnly: true`: existing target → 409) |
@@ -107,7 +109,7 @@ scope root, or absolute inside it.
107
109
  | `skills.read` | `{ linkedId, name }` | `{ name, description, content, path }` |
108
110
  | `git.status` | `{ linkedId?/remoteId?, side: 'remote'|'local' }` | `{ ok, repo, root, branch, changes, error? }` (remote workspaces only support `side: 'remote'`) |
109
111
  | `fs.search` | `{ linkedId?/remoteId?, side, query, maxResults? }` | `{ ok, query, entries, truncated }` (matches **file names**, not contents; use `fs.grep` for contents) |
110
- | `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) |
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`) |
111
113
  | `fs.grepCancel` | `{ jobId }` | `{ cancelled }` (marks the job started by `fs.grep`'s `jobId`; the Host checks it between files and answers `truncatedReason: 'cancelled'`) |
112
114
  | `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`) |
113
115
  | `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,19 @@
1
1
  # Manual verification checklist
2
2
 
3
+ ## 工作区外的下载、图片与搜索(未发布)
4
+
5
+ 1. 联动工作区根目录在 `/shared_data_ssd1/huangjh`,额外根目录里放 `/shared_data_hdd1/huangjh/x/pic.png`(≥ 1 像素真图)
6
+ 与 `big.txt`(≥ 4.5 MB),并在设置里允许该前缀。点击两个文件的聊天链接。
7
+ 2. `pic.png`:面板里直接显示图片(不是「二进制文件」字样),工具栏有「下载到默认文件夹」。
8
+ 3. `big.txt`:首屏约 1 MB,页脚「已显示 1.0 MB,共 4.6 MB」;点「加载更多」5 次左右到 4 MB 后提示已达上限。
9
+ 4. 点「下载到默认文件夹」:页脚出现「已下载到 …\\Downloads\\big.txt」,本地文件大小与远端一致。
10
+ 5. 内容搜索里打开「+/」(连额外根目录一起搜),搜 `needle-outside`:命中行以根目录名作前缀,
11
+ 点一下打开的是带「工作区外」徽标的只读标签,不出现原生「文件不存在」。
12
+ 6. 关掉该开关再搜一次:额外根目录里的文件不再出现。
13
+ 7. 连续用聊天链接打开 25 个不同的工作区外文件:第 25 个给一条「文件标签位已满(24 个)」提示,
14
+ 不出现原生报错页(需要先清掉已有标签再试)。
15
+
16
+
3
17
  ## 工作区外的只读视图与标签位(未发布)
4
18
 
5
19
  1. 联动工作区根目录在 `/shared_data_ssd1/huangjh`,准备一个 `/shared_data_hdd1/huangjh/big.jsonl`(≥ 300 KB,
package/lib/client.js CHANGED
@@ -2357,6 +2357,8 @@ function isInsideRoot(root, target) {
2357
2357
  // screen). A full table is therefore reported as "full" and the caller
2358
2358
  // falls back, instead of showing the wrong file under a new title.
2359
2359
  var slotFull = false;
2360
+ // Set by the directory panel so a swallowed click can explain itself.
2361
+ var slotFullNotice = null;
2360
2362
 
2361
2363
  function remoteFileSlotFor(key) {
2362
2364
  slotFull = false;
@@ -2690,6 +2692,7 @@ function isInsideRoot(root, target) {
2690
2692
  searchScopeHere: '只搜当前目录',
2691
2693
  searchIncludeIgnored: '连通常忽略的目录一起搜(.git 仍然排除)',
2692
2694
  searchFilesOnly: '只列文件名(不显示命中行)',
2695
+ searchOutside: '连额外根目录一起搜(最多 5 个)',
2693
2696
  searchStop: '停止',
2694
2697
  searchStats: '扫描 {{files}} 个文件 · {{size}}',
2695
2698
  searchStatsSkipped: '跳过 {{count}} 个',
@@ -2848,6 +2851,9 @@ function isInsideRoot(root, target) {
2848
2851
  outsideShown: '已显示 {{shown}},共 {{total}}',
2849
2852
  outsideMtime: '修改于 {{when}}',
2850
2853
  outsideCeiling: '已达到 {{size}} 的读取上限,剩下的内容请下载后查看。',
2854
+ outsideDownload: '下载到默认文件夹',
2855
+ outsideDownloaded: '已下载到 {{path}}',
2856
+ tabsFull: '文件标签位已满({{count}} 个)。先关掉一个再点。',
2851
2857
  linkOutside: '这个链接指向工作区之外,没有打开:{{path}}',
2852
2858
  linkFolder: '这是文件夹链接,这里只打开文件:{{path}}',
2853
2859
  linkedTitle: '联动工作区',
@@ -3306,6 +3312,7 @@ function isInsideRoot(root, target) {
3306
3312
  searchScopeHere: 'Current folder only',
3307
3313
  searchIncludeIgnored: 'Also search usually ignored folders (.git stays out)',
3308
3314
  searchFilesOnly: 'List file names only (no matching lines)',
3315
+ searchOutside: 'Also search the extra roots (up to 5)',
3309
3316
  searchStop: 'Stop',
3310
3317
  searchStats: 'Scanned {{files}} files · {{size}}',
3311
3318
  searchStatsSkipped: '{{count}} skipped',
@@ -3464,6 +3471,9 @@ function isInsideRoot(root, target) {
3464
3471
  outsideShown: 'Showing {{shown}} of {{total}}',
3465
3472
  outsideMtime: 'Modified {{when}}',
3466
3473
  outsideCeiling: 'Reached the {{size}} reading ceiling; download the file for the rest.',
3474
+ outsideDownload: 'Download to the default folder',
3475
+ outsideDownloaded: 'Saved to {{path}}',
3476
+ tabsFull: 'Every file tab is in use ({{count}}). Close one and try again.',
3467
3477
  linkOutside: 'That link points outside the workspace, so it was left alone: {{path}}',
3468
3478
  linkFolder: 'That link is a folder; only files open here: {{path}}',
3469
3479
  linkedTitle: 'Linked workspaces',
@@ -4451,6 +4461,7 @@ function isInsideRoot(root, target) {
4451
4461
  '.rw-doc-body{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;overflow:auto;padding:10px}',
4452
4462
  '.rw-outside-actions{display:flex;flex-direction:column;gap:8px;padding:4px 0}',
4453
4463
  '.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}',
4464
+ '.rw-outside-image{display:block;max-width:100%;max-height:100%;margin:0 auto;object-fit:contain}',
4454
4465
  '.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}',
4455
4466
  '.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}',
4456
4467
  '.rw-doc-preview{max-width:920px;margin:0 auto;color:var(--dsw-alias-label-primary);font-size:14px;line-height:1.65;overflow-wrap:anywhere}',
@@ -8519,6 +8530,9 @@ function rememberShowHidden(value) {
8519
8530
  var searchFilesOnlyState = useState(false);
8520
8531
  var searchFilesOnly = searchFilesOnlyState[0];
8521
8532
  var setSearchFilesOnly = searchFilesOnlyState[1];
8533
+ var searchOutsideState = useState(false);
8534
+ var searchOutside = searchOutsideState[0];
8535
+ var setSearchOutside = searchOutsideState[1];
8522
8536
  var searchStatsState = useState(null);
8523
8537
  var searchStats = searchStatsState[0];
8524
8538
  var setSearchStats = searchStatsState[1];
@@ -9113,6 +9127,13 @@ function rememberShowHidden(value) {
9113
9127
  // a tab that could only fail with lstat). Re-stat the open pane files
9114
9128
  // whenever the trees are force-refreshed and drop the ones that are gone,
9115
9129
  // so the panel heals itself instead of waiting for a read to fail.
9130
+ useEffect(function () {
9131
+ slotFullNotice = function () {
9132
+ showNotice('info', t('tabsFull', { count: String(FILE_SLOT_COUNT) }));
9133
+ };
9134
+ return function () { slotFullNotice = null; };
9135
+ }, [t, locale]);
9136
+
9116
9137
  var openFileKeys = openFiles.map(function (file) { return file.key; }).join('|');
9117
9138
  var staleProbeRef = useRef(0);
9118
9139
  function probeOpenFiles() {
@@ -10296,6 +10317,7 @@ function rememberShowHidden(value) {
10296
10317
  extra.ignoreCase = !searchCase;
10297
10318
  extra.regex = searchRegex;
10298
10319
  extra.includeIgnored = searchIncludeIgnored;
10320
+ extra.includeOutside = searchOutside;
10299
10321
  extra.resultMode = searchFilesOnly ? 'files' : 'lines';
10300
10322
  // One job id per sweep so 「停止」 can cancel it on the Host.
10301
10323
  jobId = 'grep-' + Date.now() + '-' + Math.random().toString(36).slice(2, 8);
@@ -10328,7 +10350,14 @@ function rememberShowHidden(value) {
10328
10350
  if (contentMode) setSearchStats(stats);
10329
10351
  setSearch({
10330
10352
  loading: false,
10331
- remote: results[0] && results[0].entries ? results[0].entries : [],
10353
+ // A hit outside the workspace gets its root as a prefix: otherwise
10354
+ // two files with the same name are indistinguishable, and the row
10355
+ // is the only place the user can see where it came from.
10356
+ remote: (results[0] && results[0].entries ? results[0].entries : []).map(function (entry) {
10357
+ if (!entry || !entry.outsideRoot) return entry;
10358
+ var tail = String(entry.outsideRoot).replace(/\/+$/, '').split('/').pop() || entry.outsideRoot;
10359
+ return Object.assign({}, entry, { relative: tail + '/' + String(entry.relative || '') });
10360
+ }),
10332
10361
  local: results[1] && results[1].entries ? results[1].entries : [],
10333
10362
  truncated: Boolean((results[0] && results[0].truncated) || (results[1] && results[1].truncated)),
10334
10363
  truncatedReason: (results[0] && results[0].truncatedReason) || (results[1] && results[1].truncatedReason) || '',
@@ -10337,7 +10366,7 @@ function rememberShowHidden(value) {
10337
10366
  });
10338
10367
  }, 320);
10339
10368
  return function () { alive = false; clearTimeout(timer); };
10340
- }, [searchOpen, searchQuery, selectedKey, version, searchMode, searchCase, searchRegex, searchHere, searchIncludeIgnored, searchFilesOnly]);
10369
+ }, [searchOpen, searchQuery, selectedKey, version, searchMode, searchCase, searchRegex, searchHere, searchIncludeIgnored, searchFilesOnly, searchOutside]);
10341
10370
 
10342
10371
  if (!selected) {
10343
10372
  return h('div', { className: 'rw-workbench rw-workspace', ref: workbenchRef },
@@ -10375,6 +10404,19 @@ function rememberShowHidden(value) {
10375
10404
  hasLocal: selected.kind === 'linked',
10376
10405
  showHidden: showHidden,
10377
10406
  onOpen: function (side, filePath, entry) {
10407
+ if (entry && entry.outsideRoot) {
10408
+ // Outside the workspace: the claim turns this into the read-only
10409
+ // outside tab, the only view that can show such a path.
10410
+ var service = sidebarService(ctx);
10411
+ if (service && typeof service.openTab === 'function') {
10412
+ var snapshot = typeof service.getSnapshot === 'function' ? service.getSnapshot() : null;
10413
+ service.openTab(
10414
+ { type: 'editor', path: filePath, title: basename(filePath) },
10415
+ snapshot && snapshot.sessionId ? { sessionId: snapshot.sessionId } : {},
10416
+ );
10417
+ }
10418
+ return;
10419
+ }
10378
10420
  var line = entry && Number(entry.line) ? Number(entry.line) : 0;
10379
10421
  openByMode(side, filePath, line > 0 ? { pinned: true, line: line } : undefined);
10380
10422
  },
@@ -10638,6 +10680,13 @@ function rememberShowHidden(value) {
10638
10680
  'aria-pressed': searchFilesOnly ? 'true' : 'false',
10639
10681
  onClick: function () { setSearchFilesOnly(!searchFilesOnly); },
10640
10682
  }, IconFile(11)),
10683
+ h('button', {
10684
+ type: 'button',
10685
+ className: 'rw-chip-btn' + (searchOutside ? ' is-on' : ''),
10686
+ title: t('searchOutside'),
10687
+ 'aria-pressed': searchOutside ? 'true' : 'false',
10688
+ onClick: function () { setSearchOutside(!searchOutside); },
10689
+ }, '+/'),
10641
10690
  search.loading && searchJobRef.current !== ''
10642
10691
  ? h('button', {
10643
10692
  type: 'button',
@@ -10763,8 +10812,12 @@ function rememberShowHidden(value) {
10763
10812
  var setNote = noteRef[1];
10764
10813
  // One page per click keeps a 200 MB log from freezing the tab, and the
10765
10814
  // ceiling keeps the DOM bounded even if someone keeps clicking.
10766
- var PAGE_BYTES = 256 * 1024;
10815
+ var PAGE_BYTES = 1024 * 1024;
10767
10816
  var CEILING_BYTES = 4 * 1024 * 1024;
10817
+ var isImage = /\.(?:png|jpe?g|gif|webp|bmp|ico|avif|svg)$/i.test(filePath);
10818
+ var imageState = useState({ loading: isImage, error: null, data: null });
10819
+ var image = imageState[0];
10820
+ var setImage = imageState[1];
10768
10821
 
10769
10822
  function read(from, append) {
10770
10823
  var start = Math.max(0, Number(from) || 0);
@@ -10792,6 +10845,19 @@ function rememberShowHidden(value) {
10792
10845
 
10793
10846
  useEffect(function () { read(0, false); }, [filePath, scope.kind, scope.id]);
10794
10847
 
10848
+ useEffect(function () {
10849
+ if (!isImage) return undefined;
10850
+ var alive = true;
10851
+ setImage({ loading: true, error: null, data: null });
10852
+ apiCall('media.readOutside', Object.assign({ path: filePath }, scopeParams(scope)))
10853
+ .then(function (result) {
10854
+ if (alive) setImage({ loading: false, error: null, data: result });
10855
+ }, function (error) {
10856
+ if (alive) setImage({ loading: false, error: error, data: null });
10857
+ });
10858
+ return function () { alive = false; };
10859
+ }, [filePath, scope.kind, scope.id, isImage]);
10860
+
10795
10861
  function loadMore() {
10796
10862
  if (!load.data || load.more) return;
10797
10863
  read(Number(load.data.next) || 0, true);
@@ -10808,6 +10874,22 @@ function rememberShowHidden(value) {
10808
10874
  } catch (error) { /* clipboard unavailable */ }
10809
10875
  }
10810
10876
 
10877
+ function download() {
10878
+ if (busy) return;
10879
+ setBusy(true);
10880
+ setNote('');
10881
+ apiCall('fs.downloadOutside', Object.assign({ path: filePath }, scopeParams(scope))).then(function (result) {
10882
+ setBusy(false);
10883
+ var saved = result && result.path ? String(result.path) : '';
10884
+ setNote(t('outsideDownloaded', { path: saved }));
10885
+ }, function (error) {
10886
+ setBusy(false);
10887
+ setLoad(function (previous) {
10888
+ return { loading: false, more: false, error: error, data: previous.data };
10889
+ });
10890
+ });
10891
+ }
10892
+
10811
10893
  function addRoot() {
10812
10894
  if (busy) return;
10813
10895
  setBusy(true);
@@ -10835,6 +10917,12 @@ function rememberShowHidden(value) {
10835
10917
  'aria-label': t('outsideCopyPath'),
10836
10918
  onClick: copyPath,
10837
10919
  }, t('outsideCopyPath')),
10920
+ h('button', {
10921
+ className: 'rw-btn rw-btn-sm',
10922
+ title: t('outsideDownload'),
10923
+ 'aria-label': t('outsideDownload'),
10924
+ onClick: download,
10925
+ }, t('outsideDownload')),
10838
10926
  h('button', {
10839
10927
  className: 'rw-btn rw-btn-sm',
10840
10928
  title: t('outsideReload'),
@@ -10876,11 +10964,24 @@ function rememberShowHidden(value) {
10876
10964
  Boolean(data.truncated) && !canMore
10877
10965
  ? h('span', { className: 'rw-hint' }, t('outsideCeiling', { size: formatBytes(CEILING_BYTES) }))
10878
10966
  : null);
10879
- body = h('div', { className: 'rw-doc-body' },
10880
- data.binary
10881
- ? h('div', { className: 'rw-outside-actions' }, h('div', { className: 'rw-hint' }, t('outsideBinary', { size: formatBytes(total) })))
10882
- : h('pre', { className: 'rw-outside-text' }, typeof data.content === 'string' ? data.content : ''),
10883
- footer);
10967
+ if (isImage) {
10968
+ var picture = image.error
10969
+ ? h('div', { className: 'rw-outside-actions' }, h(Banner, { kind: 'warn' }, messageOf(image.error, t, locale)))
10970
+ : image.data
10971
+ ? h('img', {
10972
+ className: 'rw-outside-image',
10973
+ alt: basename(filePath),
10974
+ src: 'data:' + String(image.data.mime || 'application/octet-stream') + ';base64,' + String(image.data.base64 || ''),
10975
+ })
10976
+ : h('div', { className: 'rw-doc-loading' }, h('div', { className: 'rw-spinner' }), h('span', null, t('loading')));
10977
+ body = h('div', { className: 'rw-doc-body' }, picture, footer);
10978
+ } else {
10979
+ body = h('div', { className: 'rw-doc-body' },
10980
+ data.binary
10981
+ ? h('div', { className: 'rw-outside-actions' }, h('div', { className: 'rw-hint' }, t('outsideBinary', { size: formatBytes(total) })))
10982
+ : h('pre', { className: 'rw-outside-text' }, typeof data.content === 'string' ? data.content : ''),
10983
+ footer);
10984
+ }
10884
10985
  }
10885
10986
  return h('div', { className: 'rw-editor-pane' }, toolbar, body);
10886
10987
  }
@@ -14089,7 +14190,11 @@ function rememberShowHidden(value) {
14089
14190
  var scope = sessionId !== '' ? { sessionId: sessionId } : {};
14090
14191
  var opened = openOutsideFileTab(sidebar, scope, scoped, absolute) === true;
14091
14192
  // With every slot busy the click is claimed but has nowhere to land: the
14092
- // native viewer would only show "file not found", so report it as handled.
14193
+ // native viewer would only show "file not found", so report it as handled
14194
+ // and let the panel say why nothing opened.
14195
+ if (!opened && slotFull === true && typeof slotFullNotice === 'function') {
14196
+ try { slotFullNotice(); } catch (error) { /* the panel may be gone */ }
14197
+ }
14093
14198
  return opened || slotFull === true;
14094
14199
  }
14095
14200
 
package/lib/index.js CHANGED
@@ -4265,6 +4265,27 @@ export function apply(ctx) {
4265
4265
  }
4266
4266
  },
4267
4267
 
4268
+ // Outside files were readable but not retrievable: the viewer says "download
4269
+ // it" at the ceiling and for binary files, so give it the same download the
4270
+ // workspace tree has.
4271
+ async 'fs.downloadOutside'(params = {}) {
4272
+ const { scope, target } = await extraTarget(params, 'downloadOutside')
4273
+ return await downloadRemotePath(scope.remote, target, downloadsFolder())
4274
+ },
4275
+
4276
+ // An image outside the workspace used to fall through to "binary file";
4277
+ // this is the same read the workspace preview uses, through the extra roots.
4278
+ async 'media.readOutside'(params = {}) {
4279
+ const { scope, target } = await extraTarget(params, 'readOutside')
4280
+ const mime = imageMimeOf(target)
4281
+ if (!mime) throw new ApiError('BAD_REQUEST', '该文件不是支持的图片格式')
4282
+ const stat = await scope.remote.stat(target)
4283
+ if (stat.type === 'dir') throw new ApiError('FS_IS_DIR', '目标是目录,无法预览')
4284
+ if (stat.size > MAX_MEDIA_BYTES) throw new ApiError('FS_TOO_LARGE', '图片超过 24 MB,无法预览')
4285
+ const read = await scope.remote.readFile(target, { maxBytes: MAX_MEDIA_BYTES })
4286
+ return { path: target, size: stat.size, mtime: stat.mtime, mime, base64: read.data.toString('base64') }
4287
+ },
4288
+
4268
4289
  async 'fs.writeOutside'(params = {}) {
4269
4290
  const { scope, target } = await extraTarget(params, 'writeOutside')
4270
4291
  if (typeof params.content !== 'string') throw new ApiError('BAD_REQUEST', 'content is required')
@@ -4837,7 +4858,40 @@ export function apply(ctx) {
4837
4858
  timeoutMs: params.timeoutMs,
4838
4859
  job: beginGrepJob(params.jobId),
4839
4860
  }
4840
- if (side === 'remote') return await contentSearchRemote(scope.remote, scope.root, query, maxResults, options)
4861
+ if (side === 'remote') {
4862
+ const found = await contentSearchRemote(scope.remote, scope.root, query, maxResults, options)
4863
+ if (params.includeOutside !== true) return found
4864
+ const roots = extraRoots().slice(0, 5)
4865
+ if (roots.length === 0) return found
4866
+ const merged = found.entries.slice()
4867
+ let truncated = found.truncated
4868
+ let scanned = found.scannedFiles
4869
+ for (const root of roots) {
4870
+ if (merged.length >= maxResults) {
4871
+ truncated = true
4872
+ break
4873
+ }
4874
+ const part = await contentSearchRemote(scope.remote, root, query, maxResults - merged.length, options)
4875
+ scanned += part.scannedFiles
4876
+ if (part.truncated) truncated = true
4877
+ for (const entry of part.entries) {
4878
+ merged.push(Object.assign({}, entry, {
4879
+ relative: entry.path.startsWith(root + '/') ? entry.path.slice(root.length + 1) : entry.relative,
4880
+ outsideRoot: root,
4881
+ }))
4882
+ }
4883
+ }
4884
+ return {
4885
+ ok: true,
4886
+ query,
4887
+ entries: merged.slice(0, maxResults),
4888
+ truncated,
4889
+ truncatedReason: truncated ? (found.truncatedReason || 'results') : '',
4890
+ scannedFiles: scanned,
4891
+ scannedBytes: found.scannedBytes,
4892
+ skippedFiles: found.skippedFiles,
4893
+ }
4894
+ }
4841
4895
  if (scope.kind !== 'linked') throw new ApiError('BAD_REQUEST', '只有联动工作区有本地目录')
4842
4896
  return contentSearchLocal(scope.record.localPath, query, maxResults, options)
4843
4897
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-linked-workspace",
3
- "version": "0.32.0",
3
+ "version": "0.33.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",