dsh-linked-workspace 0.27.1 → 0.28.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 +11 -0
- package/README.en.md +2 -0
- package/README.md +2 -0
- package/docs/API.md +1 -1
- package/docs/VERIFY.md +9 -0
- package/lib/client.js +143 -3
- package/lib/index.js +10 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.28.0 — 2026-11-26
|
|
4
|
+
|
|
5
|
+
- The directory tree now follows renames and deletions instead of waiting for a page reload. Every
|
|
6
|
+
mutation made through the plugin bumps a Host-side `listings` counter that the panel polls every
|
|
7
|
+
five seconds, a quiet refresh no longer keeps rows the listing stopped returning, the remote tree
|
|
8
|
+
refreshes on the same tick as the local one, and the refresh button forces a real re-list instead of
|
|
9
|
+
remounting a panel that restored its cached rows.
|
|
10
|
+
- An open file tab no longer outlives its file: pane tabs re-check their path with `fs.stat` /
|
|
11
|
+
`local.stat` whenever the trees refresh, sidebar file tabs probe it every ten seconds, and a tab
|
|
12
|
+
whose file disappeared closes itself, re-lists the tree and says why.
|
|
13
|
+
|
|
3
14
|
## 0.27.1 — 2026-11-26
|
|
4
15
|
|
|
5
16
|
- Markdown previews **refuse documents above 512 Ki characters** instead of rendering them
|
package/README.en.md
CHANGED
|
@@ -77,6 +77,8 @@ Settings → Linked workspaces → *Where the last artifact opens* picks the def
|
|
|
77
77
|
The heading shows the free space of the remote volume that holds the workspace;
|
|
78
78
|
hover it for the total size and the used percentage.
|
|
79
79
|
|
|
80
|
+
The tree follows the remote side on its own: a file renamed or deleted in a session is relisted within seconds (the old name never lingers as a clickable ghost), the panel asks the Host for a change counter every five seconds, both trees share one four-second tick, and the refresh button really re-lists. A file tab whose target was renamed or deleted closes itself and says “that file is gone from the remote side”.
|
|
81
|
+
|
|
80
82
|
- Fixed on the far right of the sidebar: **remote tree on top, local tree below**, both rooted at “All files”; the plugin's `.local`/`.remote` internal folders are hidden from the local tree.
|
|
81
83
|
- **Single-click opens, double-click pins**: single-click a folder to expand/collapse; single-click a file to open it in the content panel, replacing the current unpinned preview. Double-click a file to pin it so later single clicks do not replace it; double-clicking a folder only keeps it expanded.
|
|
82
84
|
- Toolbar (top right of the sidebar):
|
package/README.md
CHANGED
|
@@ -78,6 +78,8 @@
|
|
|
78
78
|
|
|
79
79
|
目录栏标题右侧显示该工作区所在远端卷的可用空间,悬停可看到总量与已用百分比。
|
|
80
80
|
|
|
81
|
+
目录树跟着远端走,不用手动刷新:会话里改名或删除的文件,几秒内从树里换成新名字(旧名不会残留成可点的幽灵条目);面板打开时每 5 秒问一次 Host 的改动计数,远端树与本地树共用同一个 4 秒刷新节拍,「刷新目录」按钮是真正的重新列举。已经打开的文件标签在文件被改名/删除后会自己关闭,并提示「这个文件已不在远端」。
|
|
82
|
+
|
|
81
83
|
- 面板固定在右侧栏最右边:**上方远端树,下方本地树**,两棵树根部都显示「所有文件」;本地树自动隐藏插件的 `.local`/`.remote` 内部目录。
|
|
82
84
|
- **单击打开,双击固定**:单击文件夹立即展开/折叠;单击文件直接在文件内容面板打开,再次单击其他文件会替换当前未固定的预览标签。双击文件可固定该标签,之后单击其他文件不会覆盖它;双击文件夹只保持展开。
|
|
83
85
|
- 工具栏(右侧栏右上角):
|
package/docs/API.md
CHANGED
|
@@ -84,7 +84,7 @@ scope root, or absolute inside it.
|
|
|
84
84
|
| `fs.move` | `{ linkedId?/remoteId?, path, targetDir? }` | `{ path }` (same remote tree; collision → 409) |
|
|
85
85
|
| `fs.delete` | `{ linkedId?/remoteId?, path }` | `{}` |
|
|
86
86
|
| `fs.home` | `{ linkedId?/remoteId? }` | `{ home }` |
|
|
87
|
-
| `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) |
|
|
87
|
+
| `meta.info` | `{}` | `{ version, apiRevision, startedAt, listings }` (the client warns when `apiRevision` is older than its own, i.e. DSH still runs an older copy of this plugin; `listings` is a counter that every mutation bumps, so the panel can notice changes made elsewhere) |
|
|
88
88
|
| `settings.get` | `{}` | `{ editorTheme, editorThemeFamily, editorThemeMode, fileOpenMode, autoSave }` |
|
|
89
89
|
| `settings.update` | `{ editorTheme?, editorThemeFamily?, editorThemeMode?, fileOpenMode?, autoSave? }` | `{ editorTheme, editorThemeFamily, editorThemeMode, fileOpenMode, autoSave }` |
|
|
90
90
|
| `local.browse` | `{ path? }` | `{ path, parent, home, entries: [{ name, path }] }` |
|
package/docs/VERIFY.md
CHANGED
|
@@ -439,6 +439,15 @@ DSH_HOME/linked-workspace/exec-audit.jsonl` 追加一行 JSON,含 `auditId`、
|
|
|
439
439
|
4. 占位目录下带子目录的路径(例如 `…\remote-placeholders\<uuid>\sub\notes.md`)同样转交成功;目录与无扩展名的路径不转交。
|
|
440
440
|
5. 关闭并重启 DSH 后再点一次这样的链接:行为不变(首次轮询就能转交,不需要刷新页面);新建一个远程工作区后不刷新页面也能转交。
|
|
441
441
|
|
|
442
|
+
## 目录同步与陈旧条目(Unreleased)
|
|
443
|
+
|
|
444
|
+
1. 在会话里让 Agent 重命名或删除一个已打开的文件:5 秒内该文件的标签自己关闭,顶部提示「这个文件已不在远端(可能被重命名或删除),已关闭它的标签并刷新目录。」,目录树里旧名字消失、新名字出现,不需要手动刷新。
|
|
445
|
+
2. 用插件之外的手段(例如另开一个 SSH 会话 `mv a.txt b.txt`)改名:不点任何按钮,目录树在 15 秒内自动换成新名字,旧行不会残留成可点的幽灵条目。
|
|
446
|
+
3. 展开的目录里删掉一个文件后点「刷新目录」:立即重新列举(不走 15 秒节流),被删的行立刻消失。
|
|
447
|
+
4. 打开一个文件后,在另一个会话里改名,再切回本会话:面板里的旧标签已关闭、树是新名字,不会出现「点开就报 `lstat … No such file`」的死标签。
|
|
448
|
+
5. 侧边栏的独立文件标签(`远程文件`)在文件被改名后 10 秒内自动关闭。
|
|
449
|
+
6. 目录树没有打开的标签页时,不会因为刷新而产生任何多余请求(关掉面板后 `listings` 轮询应停止)。
|
|
450
|
+
|
|
442
451
|
## 预览体积、文件标签与刷新(Unreleased)
|
|
443
452
|
|
|
444
453
|
1. 在目录树里点开一个**超过 51.2 万字符**的 Markdown(例如几 MB 的计划文档):面板顶部出现黄色提示「这个文件太大(N 字符,上限 524288),没有生成预览…」,正文退回编辑器(可编辑、可保存),不出现空白预览。
|
package/lib/client.js
CHANGED
|
@@ -2659,6 +2659,7 @@ function katexStyleViolation(value) {
|
|
|
2659
2659
|
docPreviewFailed: '预览失败',
|
|
2660
2660
|
previewTooLarge: '这个文件太大({{chars}} 字符,上限 {{limit}}),没有生成预览;可以在编辑器里查看,或下载后用别的工具打开。',
|
|
2661
2661
|
previewTooLargeBytes: '这个文件太大({{bytes}}),没有生成预览;可以在编辑器里查看,或下载后用别的工具打开。',
|
|
2662
|
+
fileGone: '这个文件已不在远端(可能被重命名或删除),已关闭它的标签并刷新目录。',
|
|
2662
2663
|
linkedTitle: '联动工作区',
|
|
2663
2664
|
linkedHint: '本地目录与远端目录成对出现:DSH 会话在该本地目录中工作,并通过 linked_workspace 工具直接编辑远端文件。',
|
|
2664
2665
|
localFlow: '本地目录',
|
|
@@ -3262,6 +3263,7 @@ function katexStyleViolation(value) {
|
|
|
3262
3263
|
docPreviewFailed: 'Preview failed',
|
|
3263
3264
|
previewTooLarge: 'Too large to preview ({{chars}} characters, the ceiling is {{limit}}). Read it in the editor, or download it and open it elsewhere.',
|
|
3264
3265
|
previewTooLargeBytes: 'Too large to preview ({{bytes}}). Read it in the editor, or download it and open it elsewhere.',
|
|
3266
|
+
fileGone: 'That file is gone from the remote side (renamed or deleted). Closed its tab and refreshed the tree.',
|
|
3265
3267
|
linkedTitle: 'Linked workspaces',
|
|
3266
3268
|
linkedHint: 'A local folder paired with a remote folder: DSH sessions work in the local folder and edit remote files through the linked_workspace tool.',
|
|
3267
3269
|
localFlow: 'Local folder',
|
|
@@ -3646,7 +3648,7 @@ function katexStyleViolation(value) {
|
|
|
3646
3648
|
* Host methods the running DSH process does not have yet, the directory
|
|
3647
3649
|
* pane says so instead of surfacing an unrelated error.
|
|
3648
3650
|
*/
|
|
3649
|
-
var HOST_API_REVISION =
|
|
3651
|
+
var HOST_API_REVISION = 15;
|
|
3650
3652
|
var hostInfoProbe = null;
|
|
3651
3653
|
|
|
3652
3654
|
function probeHostInfo() {
|
|
@@ -5875,6 +5877,7 @@ function katexStyleViolation(value) {
|
|
|
5875
5877
|
setSave({ saving: false, conflict: false, error: '', ok: false });
|
|
5876
5878
|
}).catch(function (error) {
|
|
5877
5879
|
setLoad({ loading: false, error: error, file: null });
|
|
5880
|
+
if (error && error.code === 'FS_NOT_FOUND' && typeof props.onMissing === 'function') props.onMissing(props.path);
|
|
5878
5881
|
});
|
|
5879
5882
|
}, [scopeKeyOf(scope), filePath, local]);
|
|
5880
5883
|
|
|
@@ -6430,6 +6433,17 @@ function katexStyleViolation(value) {
|
|
|
6430
6433
|
});
|
|
6431
6434
|
}, [props.refreshTick]);
|
|
6432
6435
|
|
|
6436
|
+
// An explicit refresh (the toolbar button, or a mutation this panel did
|
|
6437
|
+
// not make) must not trust the listing remembered from a previous mount:
|
|
6438
|
+
// the cache is dropped and every expanded directory is read again,
|
|
6439
|
+
// bypassing the REFRESH_MIN_INTERVAL_MS throttle the background tick obeys.
|
|
6440
|
+
useEffect(function () {
|
|
6441
|
+
if (!props.forceTick) return;
|
|
6442
|
+
pending.current.clear();
|
|
6443
|
+
lastRefreshAt.current.clear();
|
|
6444
|
+
setCache({ entries: new Map() });
|
|
6445
|
+
}, [props.forceTick]);
|
|
6446
|
+
|
|
6433
6447
|
function toggle(path) {
|
|
6434
6448
|
setExpanded(function (previous) {
|
|
6435
6449
|
var next = new Set(previous);
|
|
@@ -6476,7 +6490,13 @@ function katexStyleViolation(value) {
|
|
|
6476
6490
|
var freshPaths = new Set(fresh.map(function (entry) { return entry.path; }));
|
|
6477
6491
|
// Keep rows beyond the refreshed page so a silent refresh cannot
|
|
6478
6492
|
// shrink a list the user scrolled many pages into.
|
|
6479
|
-
|
|
6493
|
+
// A silent refresh asks for at least as many rows as were already
|
|
6494
|
+
// loaded, so the page it gets back is authoritative: a row that
|
|
6495
|
+
// disappeared because the file was renamed or deleted elsewhere has
|
|
6496
|
+
// to go, or it lingers as a phantom that fails with ENOENT when the
|
|
6497
|
+
// user clicks it.
|
|
6498
|
+
var previousRaw = Number(existing.raw) || 0;
|
|
6499
|
+
var retained = silent && previousRaw > pageRaw
|
|
6480
6500
|
? (existing.entries || []).filter(function (entry) { return !freshPaths.has(entry.path); })
|
|
6481
6501
|
: [];
|
|
6482
6502
|
var pageRaw = (result.entries || []).length;
|
|
@@ -7775,6 +7795,9 @@ function rememberShowHidden(value) {
|
|
|
7775
7795
|
});
|
|
7776
7796
|
}).catch(function (error) {
|
|
7777
7797
|
patch({ loading: false, error: messageOf(error, t, locale) });
|
|
7798
|
+
// The path no longer exists: say so once and let the panel drop the tab
|
|
7799
|
+
// rather than reopening it on every mount.
|
|
7800
|
+
if (error && error.code === 'FS_NOT_FOUND' && typeof props.onMissing === 'function') props.onMissing(path);
|
|
7778
7801
|
});
|
|
7779
7802
|
}
|
|
7780
7803
|
|
|
@@ -8444,6 +8467,9 @@ function rememberShowHidden(value) {
|
|
|
8444
8467
|
var localTickState = useState(0);
|
|
8445
8468
|
var localTick = localTickState[0];
|
|
8446
8469
|
var setLocalTick = localTickState[1];
|
|
8470
|
+
var treeForceState = useState(0);
|
|
8471
|
+
var treeForceTick = treeForceState[0];
|
|
8472
|
+
var setTreeForceTick = treeForceState[1];
|
|
8447
8473
|
var fileDirtyState = useState({});
|
|
8448
8474
|
var fileDirty = fileDirtyState[0];
|
|
8449
8475
|
var setFileDirty = fileDirtyState[1];
|
|
@@ -8484,6 +8510,25 @@ function rememberShowHidden(value) {
|
|
|
8484
8510
|
};
|
|
8485
8511
|
}, [directoryOpen, selectedKey]);
|
|
8486
8512
|
|
|
8513
|
+
// A rename or delete made anywhere else (an agent session, another window)
|
|
8514
|
+
// bumps the Host's listings counter. Following it keeps the tree honest
|
|
8515
|
+
// without polling every directory: meta.info answers from memory, no SSH.
|
|
8516
|
+
useEffect(function () {
|
|
8517
|
+
if (!directoryOpen) return undefined;
|
|
8518
|
+
var last = null;
|
|
8519
|
+
var timer = setInterval(function () {
|
|
8520
|
+
if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;
|
|
8521
|
+
apiCall('meta.info', {}).then(function (info) {
|
|
8522
|
+
var value = info && typeof info.listings === 'number' ? info.listings : null;
|
|
8523
|
+
if (value === null) return; // older Host without the counter
|
|
8524
|
+
if (last === null) { last = value; return; }
|
|
8525
|
+
if (value !== last) { last = value; forceRefreshTrees(); }
|
|
8526
|
+
}).catch(function () { /* meta.info is best effort */ });
|
|
8527
|
+
}, 5000);
|
|
8528
|
+
if (timer && typeof timer.unref === 'function') timer.unref();
|
|
8529
|
+
return function () { clearInterval(timer); };
|
|
8530
|
+
}, [directoryOpen]);
|
|
8531
|
+
|
|
8487
8532
|
function beginResize(event) {
|
|
8488
8533
|
if (event.button !== undefined && event.button !== 0) return;
|
|
8489
8534
|
event.preventDefault();
|
|
@@ -8528,13 +8573,23 @@ function rememberShowHidden(value) {
|
|
|
8528
8573
|
noticeTimer.current = setTimeout(function () { setNotice(null); }, 4200);
|
|
8529
8574
|
}
|
|
8530
8575
|
|
|
8576
|
+
// Everything that changes the tree comes through here: the toolbar button,
|
|
8577
|
+
// every mutation this panel makes, and the listings counter below. Bumping
|
|
8578
|
+
// the tree epoch drops the remembered listings first, so a rename made in
|
|
8579
|
+
// another session cannot leave a phantom row behind.
|
|
8580
|
+
function forceRefreshTrees() {
|
|
8581
|
+
setTreeForceTick(function (value) { return value + 1; });
|
|
8582
|
+
}
|
|
8583
|
+
|
|
8531
8584
|
function refreshAll() {
|
|
8585
|
+
forceRefreshTrees();
|
|
8532
8586
|
bumpVersion(function (value) { return value + 1; });
|
|
8533
8587
|
data.reload();
|
|
8534
8588
|
}
|
|
8535
8589
|
|
|
8536
8590
|
function refreshTree() {
|
|
8537
8591
|
clearStaleError();
|
|
8592
|
+
forceRefreshTrees();
|
|
8538
8593
|
bumpVersion(function (value) { return value + 1; });
|
|
8539
8594
|
data.reload();
|
|
8540
8595
|
}
|
|
@@ -8650,6 +8705,62 @@ function rememberShowHidden(value) {
|
|
|
8650
8705
|
setDirectoryOpen(true);
|
|
8651
8706
|
}
|
|
8652
8707
|
|
|
8708
|
+
// A file read came back FS_NOT_FOUND: the tab was restored from a listing
|
|
8709
|
+
// that has since changed. Close it and re-read the tree instead of leaving
|
|
8710
|
+
// a tab that can only fail.
|
|
8711
|
+
function dropOpenFile(side, filePath) {
|
|
8712
|
+
var key = side + ':' + (side === 'remote' ? scopeKeyOf(scopeRef) : 'local') + ':' + filePath;
|
|
8713
|
+
setOpenFiles(function (previous) {
|
|
8714
|
+
return previous.filter(function (file) { return file.key !== key; });
|
|
8715
|
+
});
|
|
8716
|
+
setFileDirty(function (dirtyMap) {
|
|
8717
|
+
if (!dirtyMap[key]) return dirtyMap;
|
|
8718
|
+
var copy = Object.assign({}, dirtyMap);
|
|
8719
|
+
delete copy[key];
|
|
8720
|
+
return copy;
|
|
8721
|
+
});
|
|
8722
|
+
showNotice('info', t('fileGone'));
|
|
8723
|
+
forceRefreshTrees();
|
|
8724
|
+
}
|
|
8725
|
+
|
|
8726
|
+
// A pane tab keeps its file open for the whole session, so a rename on the
|
|
8727
|
+
// other side leaves it pointing at a path that no longer exists (the
|
|
8728
|
+
// 0.27.1 report: the tree still listed the old name and clicking it opened
|
|
8729
|
+
// a tab that could only fail with lstat). Re-stat the open pane files
|
|
8730
|
+
// whenever the trees are force-refreshed and drop the ones that are gone,
|
|
8731
|
+
// so the panel heals itself instead of waiting for a read to fail.
|
|
8732
|
+
var openFileKeys = openFiles.map(function (file) { return file.key; }).join('|');
|
|
8733
|
+
var staleProbeRef = useRef(0);
|
|
8734
|
+
function probeOpenFiles() {
|
|
8735
|
+
var cancelled = false;
|
|
8736
|
+
openFiles.forEach(function (file) {
|
|
8737
|
+
var probe = file.side === 'local'
|
|
8738
|
+
? apiCall('local.stat', { path: file.path })
|
|
8739
|
+
: (selected ? apiCall('fs.stat', Object.assign({}, scopeParams(selected), { path: file.path })) : null);
|
|
8740
|
+
if (!probe) return;
|
|
8741
|
+
probe.then(function () { return null; }, function (error) {
|
|
8742
|
+
if (cancelled || !error || error.code !== 'FS_NOT_FOUND') return;
|
|
8743
|
+
dropOpenFile(file.side, file.path);
|
|
8744
|
+
});
|
|
8745
|
+
});
|
|
8746
|
+
return function () { cancelled = true; };
|
|
8747
|
+
}
|
|
8748
|
+
// A mutation made through the plugin (or the refresh button) is worth an
|
|
8749
|
+
// immediate check; an outside change only needs to be caught eventually, so
|
|
8750
|
+
// the periodic tree tick is throttled to keep the host quiet.
|
|
8751
|
+
useEffect(function () {
|
|
8752
|
+
if (!treeForceTick || openFiles.length === 0) return undefined;
|
|
8753
|
+
staleProbeRef.current = Date.now();
|
|
8754
|
+
return probeOpenFiles();
|
|
8755
|
+
}, [treeForceTick, openFileKeys]);
|
|
8756
|
+
useEffect(function () {
|
|
8757
|
+
if (!localTick || openFiles.length === 0) return undefined;
|
|
8758
|
+
var now = Date.now();
|
|
8759
|
+
if (now - staleProbeRef.current < 10000) return undefined;
|
|
8760
|
+
staleProbeRef.current = now;
|
|
8761
|
+
return probeOpenFiles();
|
|
8762
|
+
}, [localTick, openFileKeys]);
|
|
8763
|
+
|
|
8653
8764
|
function closeInternalFile(key) {
|
|
8654
8765
|
setOpenFiles(function (previous) {
|
|
8655
8766
|
var next = previous.filter(function (file) { return file.key !== key; });
|
|
@@ -9911,6 +10022,8 @@ function rememberShowHidden(value) {
|
|
|
9911
10022
|
onDropOnPath: dropOnPath,
|
|
9912
10023
|
onSelect: function (filePath) { openByMode('remote', filePath, { pinned: false, preview: true }); },
|
|
9913
10024
|
onPin: function (filePath) { pinByMode('remote', filePath); },
|
|
10025
|
+
refreshTick: localTick,
|
|
10026
|
+
forceTick: treeForceTick,
|
|
9914
10027
|
onContextMenu: function (info) { setSelectedEntry(Object.assign({ side: 'remote' }, info)); openContextMenu('remote', info); },
|
|
9915
10028
|
})),
|
|
9916
10029
|
selected.kind === 'linked'
|
|
@@ -9937,6 +10050,7 @@ function rememberShowHidden(value) {
|
|
|
9937
10050
|
onSelect: function (filePath) { openByMode('local', filePath, { pinned: false, preview: true }); },
|
|
9938
10051
|
onPin: function (filePath) { pinByMode('local', filePath); },
|
|
9939
10052
|
refreshTick: localTick,
|
|
10053
|
+
forceTick: treeForceTick,
|
|
9940
10054
|
onContextMenu: function (info) { setSelectedEntry(Object.assign({ side: 'local' }, info)); openContextMenu('local', info); },
|
|
9941
10055
|
}))
|
|
9942
10056
|
: null);
|
|
@@ -9970,6 +10084,7 @@ function rememberShowHidden(value) {
|
|
|
9970
10084
|
path: activeFile.path,
|
|
9971
10085
|
local: activeFile.side === 'local',
|
|
9972
10086
|
onSaved: refreshTree,
|
|
10087
|
+
onMissing: function (filePath) { dropOpenFile(activeFile.side, filePath); },
|
|
9973
10088
|
onSaveReady: function (handler) {
|
|
9974
10089
|
if (handler) saveHandlersRef.current[activeFile.key] = handler;
|
|
9975
10090
|
else delete saveHandlersRef.current[activeFile.key];
|
|
@@ -9991,6 +10106,7 @@ function rememberShowHidden(value) {
|
|
|
9991
10106
|
hideHeader: true,
|
|
9992
10107
|
focusLine: activeFile.line || 0,
|
|
9993
10108
|
hitQuery: searchQuery,
|
|
10109
|
+
onMissing: function (filePath) { dropOpenFile(activeFile.side, filePath); },
|
|
9994
10110
|
onSaveReady: function (handler) {
|
|
9995
10111
|
if (handler) saveHandlersRef.current[activeFile.key] = handler;
|
|
9996
10112
|
else delete saveHandlersRef.current[activeFile.key];
|
|
@@ -10256,12 +10372,35 @@ function rememberShowHidden(value) {
|
|
|
10256
10372
|
// opened here (placeholder paths, references) had no preview while the
|
|
10257
10373
|
// very same file opened in the directory panel did. Mirror that dispatch.
|
|
10258
10374
|
var docKind = documentKindOf(filePath);
|
|
10375
|
+
// A file tab whose target vanished closes itself; the panel that opened it
|
|
10376
|
+
// is gone, so the sidebar is the only thing that can reclaim the tab.
|
|
10377
|
+
function closeSelf() {
|
|
10378
|
+
try {
|
|
10379
|
+
var service = sidebarService(ctx);
|
|
10380
|
+
if (service && typeof service.closeTab === 'function' && tab && tab.id) service.closeTab(tab.id, props.scope);
|
|
10381
|
+
} catch (error) { /* no sidebar attached */ }
|
|
10382
|
+
}
|
|
10383
|
+
// A sidebar tab outlives the panel that opened it, so nothing else ever
|
|
10384
|
+
// re-reads this file: probe it now and then and reclaim the tab once the
|
|
10385
|
+
// path is gone (a rename inside a session is the usual cause).
|
|
10386
|
+
useEffect(function () {
|
|
10387
|
+
var cancelled = false;
|
|
10388
|
+
var timer = setInterval(function () {
|
|
10389
|
+
if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;
|
|
10390
|
+
apiCall('fs.stat', Object.assign({ path: filePath }, scopeParams(scope))).then(function () { return null; }, function (error) {
|
|
10391
|
+
if (cancelled || !error || error.code !== 'FS_NOT_FOUND') return;
|
|
10392
|
+
closeSelf();
|
|
10393
|
+
});
|
|
10394
|
+
}, 10000);
|
|
10395
|
+
return function () { cancelled = true; clearInterval(timer); };
|
|
10396
|
+
}, [filePath, scope.kind, scope.id]);
|
|
10397
|
+
|
|
10259
10398
|
var pane = docKind === 'image'
|
|
10260
10399
|
? h(ImagePreview, { ctx: ctx, t: t, locale: locale, scope: scope, path: filePath, local: false })
|
|
10261
10400
|
: docKind === 'html'
|
|
10262
10401
|
? h(HtmlPreview, { ctx: ctx, t: t, locale: locale, scope: scope, path: filePath, local: false })
|
|
10263
10402
|
: docKind && docKind !== 'csv'
|
|
10264
|
-
? h(DocumentPane, { ctx: ctx, t: t, locale: locale, scope: scope, path: filePath, local: false, visible: visible })
|
|
10403
|
+
? h(DocumentPane, { ctx: ctx, t: t, locale: locale, scope: scope, path: filePath, local: false, visible: visible, onMissing: closeSelf })
|
|
10265
10404
|
: h(RemoteFileEditor, {
|
|
10266
10405
|
ctx: ctx, t: t, locale: locale,
|
|
10267
10406
|
scope: scope,
|
|
@@ -10269,6 +10408,7 @@ function rememberShowHidden(value) {
|
|
|
10269
10408
|
visible: visible,
|
|
10270
10409
|
tabId: tab ? tab.id : undefined,
|
|
10271
10410
|
sessionId: props.scope ? props.scope.sessionId : undefined,
|
|
10411
|
+
onMissing: closeSelf,
|
|
10272
10412
|
});
|
|
10273
10413
|
return h('div', { className: 'rw-editor-pane' }, pane);
|
|
10274
10414
|
}
|
package/lib/index.js
CHANGED
|
@@ -41,7 +41,7 @@ export const inject = ['webServer', 'tools', 'systemPrompt', 'workingDirectory']
|
|
|
41
41
|
* is still running an older copy of the Host — refreshing the page only swaps
|
|
42
42
|
* the browser bundle, so the two halves can drift by one restart.
|
|
43
43
|
*/
|
|
44
|
-
const API_REVISION =
|
|
44
|
+
const API_REVISION = 15
|
|
45
45
|
|
|
46
46
|
/** When this copy of the Host was loaded; shown by `meta.info`. */
|
|
47
47
|
const STARTED_AT = new Date().toISOString()
|
|
@@ -195,7 +195,14 @@ const rememberListing = (key, listing) => {
|
|
|
195
195
|
listingCache.delete(listingCache.keys().next().value)
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
// Every mutation clears the cache; the counter lets the client notice that a
|
|
199
|
+
// listing changed underneath it (a rename made by an agent session, an upload
|
|
200
|
+
// from another window) without having to poll the tree itself.
|
|
201
|
+
let listingsGeneration = 0
|
|
202
|
+
const forgetListings = () => {
|
|
203
|
+
listingsGeneration += 1
|
|
204
|
+
listingCache.clear()
|
|
205
|
+
}
|
|
199
206
|
|
|
200
207
|
/** Clamp a requested page window to the listing limits. */
|
|
201
208
|
const pageWindow = (params = {}, total = 0) => {
|
|
@@ -4300,6 +4307,7 @@ export function apply(ctx) {
|
|
|
4300
4307
|
apiRevision: API_REVISION,
|
|
4301
4308
|
startedAt: STARTED_AT,
|
|
4302
4309
|
execAuditFile: join(dir, EXEC_AUDIT_NAME),
|
|
4310
|
+
listings: listingsGeneration,
|
|
4303
4311
|
}
|
|
4304
4312
|
},
|
|
4305
4313
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-linked-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.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",
|