dsh-ws-recency 0.13.1 → 0.13.3
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/README.md +2 -2
- package/client.js +123 -87
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
|
|
|
61
61
|
5. 把日志目录移动到 `~/.hypers-work/.trash/ws-recency/<sessionId>-<时间戳>/`;
|
|
62
62
|
6. 广播 `api-session/removed`,浏览器立即移除该行。
|
|
63
63
|
|
|
64
|
-
**不是物理删除**:目录只是被改名搬走。每个条目在 `.trash/ws-recency/` 下带一份 `.wsr-trash.json`(会话 id、原 cwd
|
|
64
|
+
**不是物理删除**:目录只是被改名搬走。每个条目在 `.trash/ws-recency/` 下带一份 `.wsr-trash.json`(会话 id、原 cwd、时间、来源),界面里的**回收站**(侧栏底部「回收站」;它克隆相邻官方条目渲染,图标与文字才能对齐)会列出它们:
|
|
65
65
|
|
|
66
66
|
- 「恢复」:按记录的 cwd 算回 `sessions/<project>/<id>/`,并重新挂到对应工作区;
|
|
67
67
|
- 「彻底删除」:真正删掉这份日志(二次确认);
|
|
@@ -135,7 +135,7 @@ dsh plugin --profile <profile> add github:chyxhtc/dsh-ws-recency
|
|
|
135
135
|
或固定版本的预构建包:
|
|
136
136
|
|
|
137
137
|
```powershell
|
|
138
|
-
dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.13.
|
|
138
|
+
dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.13.3/dsh-ws-recency-0.13.3.tgz
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
装完把 `dsh-ws-recency` 加进 `~/.hypers-work/profiles/<profile>/package.json` 的 `dsh.profile.bundles`,重启应用。
|
package/client.js
CHANGED
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
".wsr-modal-title{font-size:14px;font-weight:600}",
|
|
114
114
|
".wsr-modal-close{border:none;background:transparent;color:var(--dsw-alias-label-tertiary,#9aa0a6);font-size:18px;line-height:1;cursor:pointer;padding:2px 6px;border-radius:4px}",
|
|
115
115
|
".wsr-modal-close:hover{color:var(--dsw-alias-label-primary,#e8e8e8)}",
|
|
116
|
+
".wsr-modal-tools{display:flex;align-items:center;gap:8px;flex:none}",
|
|
116
117
|
".wsr-modal-body{padding:14px;overflow:auto;display:flex;flex-direction:column;gap:12px;font-size:12px}",
|
|
117
118
|
".wsr-stats-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}",
|
|
118
119
|
".wsr-stats-card{background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));border-radius:8px;padding:8px 10px}",
|
|
@@ -133,9 +134,14 @@
|
|
|
133
134
|
".wsr-move-path{font-size:11px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
134
135
|
".wsr-move-badge{font-size:11px;color:var(--dsw-alias-label-tertiary)}",
|
|
135
136
|
".wsr-trash-row{display:flex;align-items:flex-start;gap:8px;padding:8px 10px;border-radius:8px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04))}",
|
|
136
|
-
".wsr-footer-action{display:flex;align-items:center;justify-content:flex-start;gap:8px;width:100
|
|
137
|
-
".wsr-footer-action:hover{background:var(--dsw-alias-interactive-bg-hover
|
|
138
|
-
".wsr-footer-
|
|
137
|
+
".wsr-footer-action{display:flex;box-sizing:border-box;flex:none;align-items:center;justify-content:flex-start;gap:8px;width:calc(100% + 4px);min-width:0;height:42px;margin:4px -2px;padding:0 10px 0 8px;border:0;border-radius:12px;background:transparent;color:var(--dsw-alias-label-primary);font-family:inherit;font-size:14px;line-height:22px;text-align:left;cursor:pointer}",
|
|
138
|
+
".wsr-footer-action:hover{background:var(--dsw-alias-interactive-bg-hover)}",
|
|
139
|
+
".wsr-footer-action:active{background:var(--dsw-alias-interactive-bg-active)}",
|
|
140
|
+
".wsr-footer-action:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}",
|
|
141
|
+
'.wsr-footer-action[data-wide="false"]{width:36px;height:36px;margin:8px 0 10px;padding:0;gap:0;border-radius:50%;justify-content:center}',
|
|
142
|
+
".wsr-footer-glyph{display:inline-flex;align-items:center;justify-content:center;flex:none;width:16px;height:16px}",
|
|
143
|
+
'.wsr-footer-action[data-wide="false"] .wsr-footer-glyph{width:18px;height:18px}',
|
|
144
|
+
".wsr-footer-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
139
145
|
".wsr-trash-actions{display:flex;gap:6px;flex:none;align-items:center;white-space:nowrap}",
|
|
140
146
|
".wsr-btn{border:.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.16));background:0 0;color:var(--dsw-alias-label-primary,#e6e6e6);font:inherit;font-size:12px;line-height:1.6;padding:3px 10px;border-radius:6px;cursor:pointer;white-space:nowrap;flex:none}",
|
|
141
147
|
".wsr-btn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}",
|
|
@@ -242,7 +248,7 @@
|
|
|
242
248
|
"trash.purge": "彻底删除",
|
|
243
249
|
"trash.confirmRestore": "恢复到原来的工作区?",
|
|
244
250
|
"trash.confirmPurge": "彻底删除这份日志?不可恢复。",
|
|
245
|
-
"trash.restored": "
|
|
251
|
+
"trash.restored": "已恢复,并重新挂回原工作区。若侧栏还没出现,点下面的「刷新界面」,或在本页右上角点「扫描并刷新」。",
|
|
246
252
|
"trash.purged": "已彻底删除。",
|
|
247
253
|
"trash.working": "处理中…",
|
|
248
254
|
"trash.failed": "操作失败:",
|
|
@@ -321,7 +327,7 @@
|
|
|
321
327
|
"trash.purge": "Delete for good",
|
|
322
328
|
"trash.confirmRestore": "Restore it to its original workspace?",
|
|
323
329
|
"trash.confirmPurge": "Delete this log for good? This cannot be undone.",
|
|
324
|
-
"trash.restored": "Restored and re-attached to its workspace. If the sidebar has not picked it up, press \"Reload UI\" below
|
|
330
|
+
"trash.restored": "Restored and re-attached to its workspace. If the sidebar has not picked it up, press \"Reload UI\" below, or use \"Scan and reload\" at the top right of this panel.",
|
|
325
331
|
"trash.purged": "Deleted for good.",
|
|
326
332
|
"trash.working": "Working\u2026",
|
|
327
333
|
"trash.failed": "Action failed: ",
|
|
@@ -918,37 +924,69 @@
|
|
|
918
924
|
return typeof id === "string" && id !== "" ? id : null;
|
|
919
925
|
}
|
|
920
926
|
|
|
921
|
-
/**
|
|
922
|
-
* Match the footer action to its neighbours.
|
|
923
|
-
*
|
|
924
|
-
* The footer slot stacks actions, but each shell entry carries its own
|
|
925
|
-
* sizing; copying the metrics of the first real sibling keeps our row on
|
|
926
|
-
* the same baseline, font size and width instead of centring a smaller one.
|
|
927
|
-
*/
|
|
927
|
+
/** Clone one real footer entry into the slot so the icon box and text line up. */
|
|
928
928
|
function decorateFooterAction() {
|
|
929
929
|
if (typeof document === "undefined") return;
|
|
930
930
|
var mine = document.querySelector('[data-wsr-footer="true"]');
|
|
931
|
-
if (mine === null || typeof mine.
|
|
931
|
+
if (mine === null || typeof mine.parentElement === "undefined" || mine.parentElement === null) return;
|
|
932
932
|
var container = mine.parentElement;
|
|
933
|
-
if (container
|
|
934
|
-
if (
|
|
935
|
-
var candidates = container.querySelectorAll("button");
|
|
933
|
+
if (typeof container.querySelectorAll !== "function" || typeof container.insertBefore !== "function") return;
|
|
934
|
+
if (container.querySelector("[data-wsr-clone]") !== null || typeof mine.style === "undefined") return;
|
|
936
935
|
var template = null;
|
|
937
|
-
|
|
938
|
-
|
|
936
|
+
var buttons = container.querySelectorAll("button");
|
|
937
|
+
for (var i = 0; i < buttons.length; i += 1) {
|
|
938
|
+
var candidate = buttons[i];
|
|
939
939
|
if (candidate === mine) continue;
|
|
940
|
-
if (typeof candidate.
|
|
940
|
+
if (typeof candidate.closest === "function" && candidate.closest("[data-wsr-footer]") !== null) continue;
|
|
941
|
+
if (typeof candidate.querySelector !== "function" || candidate.querySelector("svg") === null) continue;
|
|
941
942
|
template = candidate;
|
|
942
943
|
break;
|
|
943
944
|
}
|
|
944
|
-
if (template === null) return;
|
|
945
|
-
var
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
945
|
+
if (template === null || typeof template.cloneNode !== "function") return;
|
|
946
|
+
var clone;
|
|
947
|
+
try {
|
|
948
|
+
clone = template.cloneNode(true);
|
|
949
|
+
} catch (error) {
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
var icon = typeof clone.querySelector === "function" ? clone.querySelector("svg") : null;
|
|
953
|
+
var labelClass = "";
|
|
954
|
+
if (typeof clone.querySelector === "function") {
|
|
955
|
+
var labelTemplate = clone.querySelector("span");
|
|
956
|
+
if (labelTemplate !== null && typeof labelTemplate.className === "string") labelClass = labelTemplate.className;
|
|
951
957
|
}
|
|
958
|
+
/* Keep the wrapper that holds the icon (it owns the size and baseline) and
|
|
959
|
+
drop only the template's text. */
|
|
960
|
+
var iconChild = icon;
|
|
961
|
+
while (iconChild !== null && iconChild.parentElement !== null && iconChild.parentElement !== undefined && iconChild.parentElement !== clone) {
|
|
962
|
+
iconChild = iconChild.parentElement;
|
|
963
|
+
}
|
|
964
|
+
var kids = Array.prototype.slice.call(clone.children || []);
|
|
965
|
+
for (var k = 0; k < kids.length; k += 1) {
|
|
966
|
+
if (kids[k] !== iconChild) clone.removeChild(kids[k]);
|
|
967
|
+
}
|
|
968
|
+
var label = document.createElement("span");
|
|
969
|
+
if (labelClass !== "") label.className = labelClass;
|
|
970
|
+
label.textContent = t("trash.title");
|
|
971
|
+
clone.appendChild(label);
|
|
972
|
+
clone.setAttribute("data-wsr-clone", "true");
|
|
973
|
+
clone.setAttribute("aria-label", t("trash.title"));
|
|
974
|
+
clone.addEventListener("click", function (event) {
|
|
975
|
+
if (event !== undefined && typeof event.preventDefault === "function") event.preventDefault();
|
|
976
|
+
openTrashPanel();
|
|
977
|
+
});
|
|
978
|
+
/* Keep the template's icon box (it owns the size and the baseline) but put
|
|
979
|
+
our own trash glyph inside it. */
|
|
980
|
+
var ourSvg = typeof mine.querySelector === "function" ? mine.querySelector("svg") : null;
|
|
981
|
+
if (icon !== null && ourSvg !== null && icon.parentElement !== null && icon.parentElement !== undefined) {
|
|
982
|
+
try {
|
|
983
|
+
icon.parentElement.replaceChild(ourSvg, icon);
|
|
984
|
+
} catch (error) {
|
|
985
|
+
/* keep the template icon */
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
container.insertBefore(clone, mine);
|
|
989
|
+
mine.style.display = "none";
|
|
952
990
|
}
|
|
953
991
|
|
|
954
992
|
/** The nearest horizontal flex row above the stats: the whole footer dock. */
|
|
@@ -1703,12 +1741,20 @@
|
|
|
1703
1741
|
backdrop.appendChild(panel);
|
|
1704
1742
|
var head = statsDiv("wsr-modal-head");
|
|
1705
1743
|
head.appendChild(statsDiv("wsr-modal-title", t("trash.title")));
|
|
1744
|
+
var tools = statsDiv("wsr-modal-tools");
|
|
1745
|
+
var adopt = document.createElement("button");
|
|
1746
|
+
adopt.type = "button";
|
|
1747
|
+
adopt.className = "wsr-btn";
|
|
1748
|
+
adopt.title = t("adopt.description");
|
|
1749
|
+
adopt.textContent = t("adopt.action");
|
|
1750
|
+
tools.appendChild(adopt);
|
|
1706
1751
|
var close = document.createElement("button");
|
|
1707
1752
|
close.type = "button";
|
|
1708
1753
|
close.className = "wsr-modal-close";
|
|
1709
1754
|
close.textContent = "\u00d7";
|
|
1710
1755
|
close.addEventListener("click", closeStatsPanel);
|
|
1711
|
-
|
|
1756
|
+
tools.appendChild(close);
|
|
1757
|
+
head.appendChild(tools);
|
|
1712
1758
|
panel.appendChild(head);
|
|
1713
1759
|
var body = statsDiv("wsr-modal-body");
|
|
1714
1760
|
panel.appendChild(body);
|
|
@@ -1815,10 +1861,26 @@
|
|
|
1815
1861
|
body.textContent = t("trash.failed") + (error && error.message ? error.message : error);
|
|
1816
1862
|
});
|
|
1817
1863
|
};
|
|
1864
|
+
adopt.addEventListener("click", function () {
|
|
1865
|
+
adopt.disabled = true;
|
|
1866
|
+
adopt.textContent = t("adopt.working");
|
|
1867
|
+
adoptUnlistedSessions(function (message) {
|
|
1868
|
+
adopt.disabled = false;
|
|
1869
|
+
adopt.textContent = t("adopt.action");
|
|
1870
|
+
load(message);
|
|
1871
|
+
});
|
|
1872
|
+
});
|
|
1818
1873
|
load("");
|
|
1819
1874
|
}
|
|
1820
1875
|
|
|
1821
|
-
/**
|
|
1876
|
+
/**
|
|
1877
|
+
* Sidebar footer action: the trash, one click away from the account area.
|
|
1878
|
+
*
|
|
1879
|
+
* Geometry is the same house rule the official launchers follow
|
|
1880
|
+
* (`dshUpdateLauncher` / `dshMarketLauncher`): full-width seat bled 2px
|
|
1881
|
+
* per side, 42px tall, 12px radius. `wide` comes from the slot, so the
|
|
1882
|
+
* narrow rail keeps its 36px circle instead of a stretched row.
|
|
1883
|
+
*/
|
|
1822
1884
|
function TrashFooterAction(props) {
|
|
1823
1885
|
var wide = props === undefined || props === null || props.wide !== false;
|
|
1824
1886
|
var label = t("trash.title");
|
|
@@ -1827,63 +1889,47 @@
|
|
|
1827
1889
|
type: "button",
|
|
1828
1890
|
className: "wsr-footer-action",
|
|
1829
1891
|
"data-wsr-footer": "true",
|
|
1892
|
+
"data-wide": wide ? "true" : "false",
|
|
1830
1893
|
title: label,
|
|
1831
1894
|
"aria-label": label,
|
|
1895
|
+
"aria-haspopup": "dialog",
|
|
1832
1896
|
onClick: function () { openTrashPanel(); },
|
|
1833
1897
|
},
|
|
1834
|
-
typeof Icon === "function"
|
|
1898
|
+
typeof Icon === "function"
|
|
1899
|
+
? h("span", { className: "wsr-footer-glyph", "aria-hidden": "true" }, h(Icon, { size: wide ? 16 : 18 }))
|
|
1900
|
+
: null,
|
|
1835
1901
|
wide ? h("span", { className: "wsr-footer-label" }, label) : null);
|
|
1836
1902
|
}
|
|
1837
1903
|
|
|
1838
|
-
/**
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
});
|
|
1852
|
-
})
|
|
1853
|
-
.then(function (answer) {
|
|
1854
|
-
if (answer.json !== null && answer.json.ok === true) {
|
|
1855
|
-
var count = Array.isArray(answer.json.adopted) ? answer.json.adopted.length : 0;
|
|
1856
|
-
var cleaned = typeof answer.json.cleaned === "number" ? answer.json.cleaned : 0;
|
|
1857
|
-
var text = t("adopt.done", { n: count });
|
|
1858
|
-
if (cleaned > 0) text += t("adopt.cleaned", { n: cleaned });
|
|
1859
|
-
setMessage(text);
|
|
1860
|
-
/* The scan is the refresh: reload once it has changed something. */
|
|
1861
|
-
if (count > 0 || cleaned > 0) {
|
|
1862
|
-
window.setTimeout(function () {
|
|
1863
|
-
try {
|
|
1864
|
-
if (window.location !== undefined && typeof window.location.reload === "function") window.location.reload();
|
|
1865
|
-
} catch (error) {
|
|
1866
|
-
/* nothing to do */
|
|
1867
|
-
}
|
|
1868
|
-
}, 900);
|
|
1869
|
-
}
|
|
1870
|
-
return;
|
|
1871
|
-
}
|
|
1872
|
-
setMessage(t("adopt.failed") + (answer.json && answer.json.error ? answer.json.error : answer.text.slice(0, 120)));
|
|
1873
|
-
})
|
|
1874
|
-
.catch(function (error) {
|
|
1875
|
-
setMessage(t("adopt.failed") + (error && error.message ? error.message : error));
|
|
1904
|
+
/**
|
|
1905
|
+
* Re-attach sessions that belong to no workspace.
|
|
1906
|
+
*
|
|
1907
|
+
* General Settings is the host's own page, so this repair action lives in
|
|
1908
|
+
* our trash panel instead of posing as a shell preference there.
|
|
1909
|
+
*/
|
|
1910
|
+
function adoptUnlistedSessions(done) {
|
|
1911
|
+
fetch("/ws-recency/session-adopt", { method: "POST", headers: { "content-type": "application/json" }, body: "{}" })
|
|
1912
|
+
.then(function (response) {
|
|
1913
|
+
return response.text().then(function (text) {
|
|
1914
|
+
var parsed = null;
|
|
1915
|
+
try { parsed = JSON.parse(text); } catch (error) { parsed = null; }
|
|
1916
|
+
return { status: response.status, text: text, json: parsed };
|
|
1876
1917
|
});
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1918
|
+
})
|
|
1919
|
+
.then(function (answer) {
|
|
1920
|
+
if (answer.json !== null && answer.json.ok === true) {
|
|
1921
|
+
var count = Array.isArray(answer.json.adopted) ? answer.json.adopted.length : 0;
|
|
1922
|
+
var cleaned = typeof answer.json.cleaned === "number" ? answer.json.cleaned : 0;
|
|
1923
|
+
var text = t("adopt.done", { n: count });
|
|
1924
|
+
if (cleaned > 0) text += t("adopt.cleaned", { n: cleaned });
|
|
1925
|
+
done(text);
|
|
1926
|
+
return;
|
|
1927
|
+
}
|
|
1928
|
+
done(t("adopt.failed") + (answer.json && answer.json.error ? answer.json.error : answer.text.slice(0, 120)));
|
|
1929
|
+
})
|
|
1930
|
+
.catch(function (error) {
|
|
1931
|
+
done(t("adopt.failed") + (error && error.message ? error.message : error));
|
|
1932
|
+
});
|
|
1887
1933
|
}
|
|
1888
1934
|
|
|
1889
1935
|
/** Settings -> General row: the global pinned section on/off. */
|
|
@@ -2033,16 +2079,6 @@
|
|
|
2033
2079
|
}, TrashFooterAction);
|
|
2034
2080
|
});
|
|
2035
2081
|
|
|
2036
|
-
ctx.slots.inject("settings.general.item", function () {
|
|
2037
|
-
return ctx.slots.register({
|
|
2038
|
-
name: "settings.general.item",
|
|
2039
|
-
id: "ws-recency-adopt",
|
|
2040
|
-
order: 49,
|
|
2041
|
-
store: prefs,
|
|
2042
|
-
locale: NS,
|
|
2043
|
-
}, AdoptRow);
|
|
2044
|
-
});
|
|
2045
|
-
|
|
2046
2082
|
ctx.slots.inject("settings.general.item", function () {
|
|
2047
2083
|
return ctx.slots.register({
|
|
2048
2084
|
name: "settings.general.item",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ws-recency",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"description": "Sidebar session management for DeepSeek Harness: workspace groups sorted by latest activity, stale history folded, a global pinned section, follow-up marks, session delete into a recoverable trash, per-session token statistics split by tool, and moving a session to another workspace.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "chyxhtc",
|