dsh-ws-recency 0.12.2 → 0.13.1
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 +3 -3
- package/client.js +81 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,11 +61,11 @@ 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
|
- 「彻底删除」:真正删掉这份日志(二次确认);
|
|
68
|
-
- 恢复/扫描/移动之后宿主会广播 `api-session/added
|
|
68
|
+
- 恢复/扫描/移动之后宿主会广播 `api-session/added`;面板与「扫描并刷新」都能重载页面(不重启应用)让侧栏立刻看到改动;
|
|
69
69
|
- 移动操作留下的旧副本会标成「移动时的旧副本」,只允许彻底删除。
|
|
70
70
|
|
|
71
71
|
## 六、Token 消耗统计
|
|
@@ -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.
|
|
138
|
+
dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.13.1/dsh-ws-recency-0.13.1.tgz
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
装完把 `dsh-ws-recency` 加进 `~/.hypers-work/profiles/<profile>/package.json` 的 `dsh.profile.bundles`,重启应用。
|
package/client.js
CHANGED
|
@@ -132,8 +132,14 @@
|
|
|
132
132
|
".wsr-move-title{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
133
133
|
".wsr-move-path{font-size:11px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
134
134
|
".wsr-move-badge{font-size:11px;color:var(--dsw-alias-label-tertiary)}",
|
|
135
|
-
".wsr-trash-row{display:flex;align-items:
|
|
136
|
-
".wsr-
|
|
135
|
+
".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%;border:none;background:0 0;color:var(--dsw-alias-label-primary,#e6e6e6);font:inherit;cursor:pointer;padding:6px 8px;border-radius:8px;text-align:left}",
|
|
137
|
+
".wsr-footer-action:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08));color:var(--dsw-alias-label-primary)}",
|
|
138
|
+
".wsr-footer-label{font-size:inherit;line-height:inherit;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
139
|
+
".wsr-trash-actions{display:flex;gap:6px;flex:none;align-items:center;white-space:nowrap}",
|
|
140
|
+
".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
|
+
".wsr-btn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}",
|
|
142
|
+
".wsr-btn-danger{border-color:var(--dsw-alias-state-error-primary,#d9534f);color:var(--dsw-alias-state-error-primary,#d9534f)}",
|
|
137
143
|
".wsr-danger{border-color:var(--dsw-alias-state-error-primary,#d9534f);color:var(--dsw-alias-state-error-primary,#d9534f)}",
|
|
138
144
|
".wsr-chart{display:flex;flex-direction:column;gap:6px}",
|
|
139
145
|
".wsr-chart-title{font-size:11px;color:var(--dsw-alias-label-tertiary)}",
|
|
@@ -219,7 +225,7 @@
|
|
|
219
225
|
"move.repaired": "已补登记到「{workspace}」:上一次移动只搬了日志、没登记工作区,这次把它补上了。",
|
|
220
226
|
"adopt.title": "补登记游离会话",
|
|
221
227
|
"adopt.description": "修复会话归属:把“目录属于某工作区却不在任何分组”的会话挂回去,并把仍挂在旧工作区分组里的重复归属清掉。",
|
|
222
|
-
"adopt.action": "
|
|
228
|
+
"adopt.action": "扫描并刷新",
|
|
223
229
|
"adopt.working": "扫描中…",
|
|
224
230
|
"adopt.done": "已补登记 {n} 个会话。",
|
|
225
231
|
"adopt.cleaned": "清理了 {n} 处重复/失效的工作区归属。",
|
|
@@ -236,7 +242,7 @@
|
|
|
236
242
|
"trash.purge": "彻底删除",
|
|
237
243
|
"trash.confirmRestore": "恢复到原来的工作区?",
|
|
238
244
|
"trash.confirmPurge": "彻底删除这份日志?不可恢复。",
|
|
239
|
-
"trash.restored": "
|
|
245
|
+
"trash.restored": "已恢复,并重新挂回原工作区。若侧栏还没出现,点下面的「刷新界面」(或去「补登记游离会话」点「扫描并刷新」)。",
|
|
240
246
|
"trash.purged": "已彻底删除。",
|
|
241
247
|
"trash.working": "处理中…",
|
|
242
248
|
"trash.failed": "操作失败:",
|
|
@@ -298,7 +304,7 @@
|
|
|
298
304
|
"move.repaired": "Registered in \"{workspace}\": the previous attempt moved the log without the bookkeeping, and this repaired it.",
|
|
299
305
|
"adopt.title": "Adopt unlisted sessions",
|
|
300
306
|
"adopt.description": "Repairs session membership: re-attaches sessions whose directory belongs to a workspace but are listed nowhere, and clears stale memberships that make one session appear twice.",
|
|
301
|
-
"adopt.action": "Scan",
|
|
307
|
+
"adopt.action": "Scan and reload",
|
|
302
308
|
"adopt.working": "Scanning\u2026",
|
|
303
309
|
"adopt.done": "Re-attached {n} session(s).",
|
|
304
310
|
"adopt.cleaned": " Cleared {n} stale membership(s).",
|
|
@@ -315,7 +321,7 @@
|
|
|
315
321
|
"trash.purge": "Delete for good",
|
|
316
322
|
"trash.confirmRestore": "Restore it to its original workspace?",
|
|
317
323
|
"trash.confirmPurge": "Delete this log for good? This cannot be undone.",
|
|
318
|
-
"trash.restored": "Restored and re-attached to its workspace. If the sidebar has not picked it up,
|
|
324
|
+
"trash.restored": "Restored and re-attached to its workspace. If the sidebar has not picked it up, press \"Reload UI\" below (or run \"Scan and reload\").",
|
|
319
325
|
"trash.purged": "Deleted for good.",
|
|
320
326
|
"trash.working": "Working\u2026",
|
|
321
327
|
"trash.failed": "Action failed: ",
|
|
@@ -912,6 +918,39 @@
|
|
|
912
918
|
return typeof id === "string" && id !== "" ? id : null;
|
|
913
919
|
}
|
|
914
920
|
|
|
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
|
+
*/
|
|
928
|
+
function decorateFooterAction() {
|
|
929
|
+
if (typeof document === "undefined") return;
|
|
930
|
+
var mine = document.querySelector('[data-wsr-footer="true"]');
|
|
931
|
+
if (mine === null || typeof mine.getAttribute !== "function") return;
|
|
932
|
+
var container = mine.parentElement;
|
|
933
|
+
if (container === null || typeof container.querySelectorAll !== "function") return;
|
|
934
|
+
if (typeof window === "undefined" || typeof window.getComputedStyle !== "function") return;
|
|
935
|
+
var candidates = container.querySelectorAll("button");
|
|
936
|
+
var template = null;
|
|
937
|
+
for (var i = 0; i < candidates.length; i += 1) {
|
|
938
|
+
var candidate = candidates[i];
|
|
939
|
+
if (candidate === mine) continue;
|
|
940
|
+
if (typeof candidate.getAttribute === "function" && candidate.getAttribute("data-wsr-footer") !== null) continue;
|
|
941
|
+
template = candidate;
|
|
942
|
+
break;
|
|
943
|
+
}
|
|
944
|
+
if (template === null) return;
|
|
945
|
+
var metrics = ["font-size", "font-family", "font-weight", "line-height", "padding", "gap", "width", "height", "justify-content", "color", "border-radius", "margin"];
|
|
946
|
+
for (var k = 0; k < metrics.length; k += 1) {
|
|
947
|
+
var value = "";
|
|
948
|
+
try { value = window.getComputedStyle(template).getPropertyValue(metrics[k]) || ""; } catch (error) { value = ""; }
|
|
949
|
+
if (value === "" || value === "auto") continue;
|
|
950
|
+
mine.style[metrics[k]] = value;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
915
954
|
/** The nearest horizontal flex row above the stats: the whole footer dock. */
|
|
916
955
|
function composerDockOf(row) {
|
|
917
956
|
var node = row;
|
|
@@ -1040,12 +1079,14 @@
|
|
|
1040
1079
|
var settings = settingsOf();
|
|
1041
1080
|
if (!ready(sessions) || !ready(workspaces)) {
|
|
1042
1081
|
decorateComposerStats();
|
|
1082
|
+
decorateFooterAction();
|
|
1043
1083
|
return;
|
|
1044
1084
|
}
|
|
1045
1085
|
|
|
1046
1086
|
var entries = collect();
|
|
1047
1087
|
if (entries.length === 0) {
|
|
1048
1088
|
decorateComposerStats();
|
|
1089
|
+
decorateFooterAction();
|
|
1049
1090
|
return;
|
|
1050
1091
|
}
|
|
1051
1092
|
|
|
@@ -1054,6 +1095,7 @@
|
|
|
1054
1095
|
renderPinned(entries, sessions, workspaces, settings);
|
|
1055
1096
|
if (settings.colors) decorateRows(entries, sessions, data.statuses, settings);
|
|
1056
1097
|
decorateComposerStats();
|
|
1098
|
+
decorateFooterAction();
|
|
1057
1099
|
}
|
|
1058
1100
|
|
|
1059
1101
|
function schedule() {
|
|
@@ -1734,7 +1776,7 @@
|
|
|
1734
1776
|
if (entry.restorable === true) {
|
|
1735
1777
|
var restore = document.createElement("button");
|
|
1736
1778
|
restore.type = "button";
|
|
1737
|
-
restore.className = "wsr-
|
|
1779
|
+
restore.className = "wsr-btn";
|
|
1738
1780
|
restore.textContent = t("trash.restore");
|
|
1739
1781
|
restore.addEventListener("click", function () {
|
|
1740
1782
|
if (typeof window.confirm === "function" && !window.confirm(t("trash.confirmRestore"))) return;
|
|
@@ -1750,7 +1792,7 @@
|
|
|
1750
1792
|
}
|
|
1751
1793
|
var purge = document.createElement("button");
|
|
1752
1794
|
purge.type = "button";
|
|
1753
|
-
purge.className = "wsr-
|
|
1795
|
+
purge.className = "wsr-btn wsr-btn-danger";
|
|
1754
1796
|
purge.textContent = t("trash.purge");
|
|
1755
1797
|
purge.addEventListener("click", function () {
|
|
1756
1798
|
if (typeof window.confirm === "function" && !window.confirm(t("trash.confirmPurge"))) return;
|
|
@@ -1776,17 +1818,21 @@
|
|
|
1776
1818
|
load("");
|
|
1777
1819
|
}
|
|
1778
1820
|
|
|
1779
|
-
/**
|
|
1780
|
-
function
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1821
|
+
/** Sidebar footer action: the trash, one click away from the account area. */
|
|
1822
|
+
function TrashFooterAction(props) {
|
|
1823
|
+
var wide = props === undefined || props === null || props.wide !== false;
|
|
1824
|
+
var label = t("trash.title");
|
|
1825
|
+
var Icon = ui.IconTrashOutlineRegular;
|
|
1826
|
+
return h("button", {
|
|
1827
|
+
type: "button",
|
|
1828
|
+
className: "wsr-footer-action",
|
|
1829
|
+
"data-wsr-footer": "true",
|
|
1830
|
+
title: label,
|
|
1831
|
+
"aria-label": label,
|
|
1832
|
+
onClick: function () { openTrashPanel(); },
|
|
1833
|
+
},
|
|
1834
|
+
typeof Icon === "function" ? h(Icon, {}) : null,
|
|
1835
|
+
wide ? h("span", { className: "wsr-footer-label" }, label) : null);
|
|
1790
1836
|
}
|
|
1791
1837
|
|
|
1792
1838
|
/** Settings -> General: re-attach sessions that belong to no workspace. */
|
|
@@ -1811,6 +1857,16 @@
|
|
|
1811
1857
|
var text = t("adopt.done", { n: count });
|
|
1812
1858
|
if (cleaned > 0) text += t("adopt.cleaned", { n: cleaned });
|
|
1813
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
|
+
}
|
|
1814
1870
|
return;
|
|
1815
1871
|
}
|
|
1816
1872
|
setMessage(t("adopt.failed") + (answer.json && answer.json.error ? answer.json.error : answer.text.slice(0, 120)));
|
|
@@ -1825,8 +1881,7 @@
|
|
|
1825
1881
|
h("div", { className: "wsr-setDesc" }, message === "" ? t("adopt.description") : message),
|
|
1826
1882
|
),
|
|
1827
1883
|
h("div", { className: "wsr-controls" },
|
|
1828
|
-
h("button", { type: "button", className: "wsr-
|
|
1829
|
-
h("button", { type: "button", className: "wsr-step", onClick: function () { reloadButton().click(); } }, t("ui.reload")),
|
|
1884
|
+
h("button", { type: "button", className: "wsr-btn", onClick: run }, t("adopt.action")),
|
|
1830
1885
|
),
|
|
1831
1886
|
);
|
|
1832
1887
|
}
|
|
@@ -1969,14 +2024,13 @@
|
|
|
1969
2024
|
}, ColorsRow);
|
|
1970
2025
|
});
|
|
1971
2026
|
|
|
1972
|
-
ctx.slots.inject("
|
|
2027
|
+
ctx.slots.inject("sidebar.footer.action", function () {
|
|
1973
2028
|
return ctx.slots.register({
|
|
1974
|
-
name: "
|
|
1975
|
-
id: "ws-recency-trash-
|
|
1976
|
-
order:
|
|
1977
|
-
store: prefs,
|
|
2029
|
+
name: "sidebar.footer.action",
|
|
2030
|
+
id: "ws-recency-trash-footer",
|
|
2031
|
+
order: 30,
|
|
1978
2032
|
locale: NS,
|
|
1979
|
-
},
|
|
2033
|
+
}, TrashFooterAction);
|
|
1980
2034
|
});
|
|
1981
2035
|
|
|
1982
2036
|
ctx.slots.inject("settings.general.item", function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ws-recency",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
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",
|