dsh-ws-recency 0.35.1 → 0.35.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.
Files changed (4) hide show
  1. package/README.md +2 -0
  2. package/client.js +120 -36
  3. package/index.js +1 -1
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -223,6 +223,8 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
223
223
 
224
224
  面板底部有「全部启用」一键恢复。开关状态和别的偏好一起存在本地,重装升级不丢。
225
225
 
226
+ **搜索与回收站这两项需要重启才生效**:侧栏那一行由宿主按注册渲染,中途反复注册/注销会让第二次关闭失效,所以它们只在启动时按当前设置注册一次,页面上的说明会注明「改动需要重启应用后生效」。其余开关当场生效。
227
+
226
228
  ## 已知边界
227
229
 
228
230
  - 依赖宿主 DOM:分组容器带 `_groupSection`、分组头带 `data-row-key="workspace:<id>"`、行带 `data-row-key="session:<id>"`、溢出按钮类名含 `sessionOverflowButton`。宿主改结构就要跟着改。
package/client.js CHANGED
@@ -572,6 +572,7 @@
572
572
  "features.on": "已启用",
573
573
  "features.off": "已关闭",
574
574
  "features.reset": "全部启用",
575
+ "features.restart": "改动需要重启应用后生效。",
575
576
  "features.note": "只关掉你不需要的部分:关掉的入口会从界面上消失,相关的后台逻辑也会停下。",
576
577
  "features.takesEffect": "当前启用 {on} / {all} 项。",
577
578
  "features.sidebar.title": "侧栏会话管理",
@@ -809,6 +810,7 @@
809
810
  "features.on": "On",
810
811
  "features.off": "Off",
811
812
  "features.reset": "Enable all",
813
+ "features.restart": "the change takes effect after a restart.",
812
814
  "features.note": "Turn off only what you do not need: the entry disappears from the interface and its background work stops.",
813
815
  "features.takesEffect": "{on} of {all} features are on.",
814
816
  "features.sidebar.title": "Sidebar session management",
@@ -2022,6 +2024,11 @@
2022
2024
 
2023
2025
  function schedule() {
2024
2026
  if (disposed || timer !== null) return;
2027
+ /* The interval keeps calling us; a switched-off half must not paint. */
2028
+ if (!featureOn(data.settings, "sidebar")) {
2029
+ unpaintSidebar();
2030
+ return;
2031
+ }
2025
2032
  sidebarAncestors = null;
2026
2033
  if (passesSuspended()) {
2027
2034
  /* One pass, once the host has finished mounting. */
@@ -2049,10 +2056,15 @@
2049
2056
  function unpaintSidebar() {
2050
2057
  if (typeof document === "undefined") return;
2051
2058
  try {
2052
- var painted = document.querySelectorAll("[data-wsr-rank],[data-wsr-dot]");
2059
+ var pinned = document.querySelectorAll('[data-wsr-pin="true"]');
2060
+ for (var k = 0; k < pinned.length; k += 1) pinned[k].remove();
2061
+ pinHost = null;
2062
+ var painted = document.querySelectorAll("[data-wsr-rank],[data-wsr-dot],[data-wsr-state],[data-wsr-pin-hidden]");
2053
2063
  for (var i = 0; i < painted.length; i += 1) {
2054
2064
  painted[i].removeAttribute("data-wsr-rank");
2055
2065
  painted[i].removeAttribute("data-wsr-dot");
2066
+ painted[i].removeAttribute("data-wsr-state");
2067
+ painted[i].removeAttribute("data-wsr-pin-hidden");
2056
2068
  painted[i].style.removeProperty("order");
2057
2069
  }
2058
2070
  var hidden = document.querySelectorAll(".wsr-hidden");
@@ -2079,6 +2091,7 @@
2079
2091
  if (typeof props.t === "function") data.t = props.t;
2080
2092
  /* With the sidebar half off, drop our paint and stop the timer. */
2081
2093
  var sidebarOn = featureOn(data.settings, "sidebar");
2094
+ if (typeof syncPanelsExposed === "function") syncPanelsExposed(data.settings);
2082
2095
  react.useEffect(function () {
2083
2096
  if (sidebarOn) {
2084
2097
  schedule();
@@ -2178,6 +2191,12 @@
2178
2191
  * never take the window's focus away.
2179
2192
  * ------------------------------------------------------------------- */
2180
2193
 
2194
+ /** Set by apply(): keeps gated panel registrations in step with the store. */
2195
+ var syncPanelsExposed = null;
2196
+
2197
+ /** What was registered at startup, so the page can say "restart to apply". */
2198
+ var panelBootExposed = null;
2199
+
2181
2200
  var confirmBackdrop = null;
2182
2201
  var confirmPrevious = null;
2183
2202
  var confirmKey = null;
@@ -5328,28 +5347,39 @@
5328
5347
  return h(Icon, { size: size });
5329
5348
  }
5330
5349
 
5331
- /** One switch: a title, what it costs to turn off, and a toggle. */
5350
+ /** One switch: a title, what it costs to turn off, and the host's own toggle. */
5332
5351
  function FeatureRow(props) {
5333
5352
  var on = props.on === true;
5353
+ var Switch = ui.Switch;
5354
+ var control;
5355
+ if (typeof Switch === "function") {
5356
+ control = h(Switch, {
5357
+ checked: on,
5358
+ label: props.title,
5359
+ onChange: function () {
5360
+ if (typeof props.onToggle === "function") props.onToggle(props.id);
5361
+ },
5362
+ });
5363
+ } else {
5364
+ /* Older hosts without the primitive fall back to a plain button. */
5365
+ control = h("button", {
5366
+ type: "button",
5367
+ className: on ? "wsr-toggle wsr-toggle-on" : "wsr-toggle",
5368
+ "aria-pressed": on ? "true" : "false",
5369
+ "data-wsr-feature-toggle": props.id,
5370
+ onClick: function () {
5371
+ if (typeof props.onToggle === "function") props.onToggle(props.id);
5372
+ },
5373
+ }, t(on ? "features.on" : "features.off"));
5374
+ }
5334
5375
  return h("div", { className: "wsr-setRow", "data-wsr-feature": props.id },
5335
5376
  h("div", { className: "wsr-setText" },
5336
5377
  h("div", { className: "wsr-setTitle" }, props.title),
5337
5378
  h("div", { className: "wsr-setDesc" }, props.description),
5338
5379
  ),
5339
- h("div", { className: "wsr-controls" },
5340
- h("button", {
5341
- type: "button",
5342
- className: on ? "wsr-toggle wsr-toggle-on" : "wsr-toggle",
5343
- "aria-pressed": on ? "true" : "false",
5344
- "data-wsr-feature-toggle": props.id,
5345
- onClick: function () {
5346
- if (typeof props.onToggle === "function") props.onToggle(props.id);
5347
- },
5348
- }, t(on ? "features.on" : "features.off")),
5349
- ),
5380
+ h("div", { className: "wsr-controls", "data-wsr-feature-toggle": props.id }, control),
5350
5381
  );
5351
- }
5352
- /** The package this section belongs to, as the plugin page names it. */
5382
+ } /** The package this section belongs to, as the plugin page names it. */
5353
5383
  var OUR_PACKAGE = "dsh-ws-recency";
5354
5384
 
5355
5385
  /** The package name a detail subject stands for, whichever shape it takes. */
@@ -5399,16 +5429,26 @@
5399
5429
  if (props.actions !== undefined) props.actions.resetFeatures();
5400
5430
  };
5401
5431
 
5432
+ /* These two own a sidebar row, and a row is fixed at startup. */
5433
+ var boot = typeof panelBootExposed === "function" ? panelBootExposed() : null;
5434
+ var waitsForRestart = function (id) {
5435
+ if (id !== "search" && id !== "trash") return false;
5436
+ if (boot === null) return false;
5437
+ return boot[id] !== valueOf(id);
5438
+ };
5402
5439
  var rows = FEATURE_IDS.map(function (id) {
5403
5440
  return h(FeatureRow, {
5404
5441
  key: id,
5405
5442
  id: id,
5406
5443
  title: t("features." + id + ".title"),
5407
- description: t("features." + id + ".desc"),
5444
+ description: waitsForRestart(id)
5445
+ ? t("features." + id + ".desc") + " " + t("features.restart")
5446
+ : t("features." + id + ".desc"),
5408
5447
  on: valueOf(id),
5409
5448
  onToggle: toggle,
5410
5449
  });
5411
5450
  });
5451
+
5412
5452
  var onCount = FEATURE_IDS.filter(function (id) { return valueOf(id); }).length;
5413
5453
  return h("section", { className: "wsr-plugin-features", "data-wsr-features": OUR_PACKAGE },
5414
5454
  h("div", { className: "wsr-features-head" },
@@ -5985,16 +6025,7 @@
5985
6025
  });
5986
6026
 
5987
6027
  if (SEARCH_ENABLED) {
5988
- ctx.slots.inject("sidebar.panellist", function () {
5989
- return ctx.slots.register({
5990
- name: "sidebar.panellist",
5991
- id: "ws-recency-search",
5992
- order: 19,
5993
- store: prefs,
5994
- locale: NS,
5995
- label: function () { return t("search.title"); },
5996
- }, withFeature(SearchPanelIcon, "search"));
5997
- });
6028
+
5998
6029
 
5999
6030
  ctx.slots.inject("main", function () {
6000
6031
  return ctx.slots.register({
@@ -6008,16 +6039,7 @@
6008
6039
 
6009
6040
 
6010
6041
 
6011
- ctx.slots.inject("sidebar.panellist", function () {
6012
- return ctx.slots.register({
6013
- name: "sidebar.panellist",
6014
- id: "ws-recency-trash",
6015
- order: 20,
6016
- store: prefs,
6017
- locale: NS,
6018
- label: function () { return t("trash.title"); },
6019
- }, withFeature(TrashPanelIcon, "trash"));
6020
- });
6042
+
6021
6043
 
6022
6044
  ctx.slots.inject("plugins.detail.section", function () {
6023
6045
  return ctx.slots.register({
@@ -6114,6 +6136,61 @@
6114
6136
 
6115
6137
 
6116
6138
 
6139
+ /*
6140
+ * Search and trash each own a sidebar row. The host derives the row from the
6141
+ * registration, so a row cannot be hidden by drawing less; and re-registering
6142
+ * mid-session left the row behind on the next switch. So: register once, at
6143
+ * startup, for whatever the stored settings asked for, and tell the user that a
6144
+ * change here needs a restart. Everything else takes effect immediately.
6145
+ */
6146
+ var panelBoot = null;
6147
+ function syncPanels(settings) {
6148
+ if (panelBoot !== null) return;
6149
+ panelBoot = {};
6150
+ FEATURE_IDS.forEach(function (feature) { panelBoot[feature] = featureOn(settings, feature); });
6151
+ if (panelBoot.search) {
6152
+ ctx.slots.inject("sidebar.panellist", function () {
6153
+ return ctx.slots.register({
6154
+ name: "sidebar.panellist",
6155
+ id: "ws-recency-search",
6156
+ order: 19,
6157
+ store: prefs,
6158
+ locale: NS,
6159
+ label: function () { return t("search.title"); },
6160
+ }, SearchPanelIcon);
6161
+ });
6162
+ ctx.slots.inject("main", function () {
6163
+ return ctx.slots.register({
6164
+ name: "main",
6165
+ key: "ws-recency-search",
6166
+ store: prefs,
6167
+ locale: NS,
6168
+ }, SearchPanelPage);
6169
+ });
6170
+ }
6171
+ if (panelBoot.trash) {
6172
+ ctx.slots.inject("sidebar.panellist", function () {
6173
+ return ctx.slots.register({
6174
+ name: "sidebar.panellist",
6175
+ id: "ws-recency-trash",
6176
+ order: 20,
6177
+ store: prefs,
6178
+ locale: NS,
6179
+ label: function () { return t("trash.title"); },
6180
+ }, TrashPanelIcon);
6181
+ });
6182
+ ctx.slots.inject("main", function () {
6183
+ return ctx.slots.register({
6184
+ name: "main",
6185
+ key: "ws-recency-trash",
6186
+ store: prefs,
6187
+ locale: NS,
6188
+ }, TrashPanelPage);
6189
+ });
6190
+ }
6191
+ }
6192
+ syncPanelsExposed = syncPanels;
6193
+ panelBootExposed = function () { return panelBoot; };
6117
6194
  ctx.effect(function () {
6118
6195
  return function () { shutdown(); };
6119
6196
  }, "dsh-ws-recency: list observer");
@@ -6136,6 +6213,13 @@
6136
6213
 
6137
6214
  /* Test hook: the jump and the highlighting are pure DOM helpers. */
6138
6215
  /* The statistics panel no longer has a menu row; tests open it here. */
6216
+ /* What the sidebar bound at startup: the page reads it to say "restart". */
6217
+ exports.__features = {
6218
+ boot: function () {
6219
+ return typeof panelBootExposed === "function" ? panelBootExposed() : null;
6220
+ },
6221
+ };
6222
+
6139
6223
  exports.__stats = { open: openStatsPanel, close: closeStatsPanel };
6140
6224
 
6141
6225
  exports.__search = {
package/index.js CHANGED
@@ -32,7 +32,7 @@ import { dirname, join } from "node:path";
32
32
  export const name = "ws-recency";
33
33
 
34
34
  /** Version marker reported by the health route. */
35
- export const HOST_VERSION = "0.35.1";
35
+ export const HOST_VERSION = "0.35.3";
36
36
 
37
37
  /**
38
38
  * Exact routes the client half calls. Registered on the bare web server, so they
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ws-recency",
3
- "version": "0.35.1",
3
+ "version": "0.35.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, archived sessions managed from that same trash panel, per-session token statistics with an argument/result split and an option to count tool arguments as the agent's writing, moving a session to another workspace, and a literal content search that jumps to the turn a word was said in.",
5
5
  "license": "MIT",
6
6
  "author": "chyxhtc",