dsh-ws-recency 0.35.1 → 0.35.2

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 (3) hide show
  1. package/client.js +125 -35
  2. package/index.js +1 -1
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -2022,6 +2022,11 @@
2022
2022
 
2023
2023
  function schedule() {
2024
2024
  if (disposed || timer !== null) return;
2025
+ /* The interval keeps calling us; a switched-off half must not paint. */
2026
+ if (!featureOn(data.settings, "sidebar")) {
2027
+ unpaintSidebar();
2028
+ return;
2029
+ }
2025
2030
  sidebarAncestors = null;
2026
2031
  if (passesSuspended()) {
2027
2032
  /* One pass, once the host has finished mounting. */
@@ -2049,10 +2054,15 @@
2049
2054
  function unpaintSidebar() {
2050
2055
  if (typeof document === "undefined") return;
2051
2056
  try {
2052
- var painted = document.querySelectorAll("[data-wsr-rank],[data-wsr-dot]");
2057
+ var pinned = document.querySelectorAll('[data-wsr-pin="true"]');
2058
+ for (var k = 0; k < pinned.length; k += 1) pinned[k].remove();
2059
+ pinHost = null;
2060
+ var painted = document.querySelectorAll("[data-wsr-rank],[data-wsr-dot],[data-wsr-state],[data-wsr-pin-hidden]");
2053
2061
  for (var i = 0; i < painted.length; i += 1) {
2054
2062
  painted[i].removeAttribute("data-wsr-rank");
2055
2063
  painted[i].removeAttribute("data-wsr-dot");
2064
+ painted[i].removeAttribute("data-wsr-state");
2065
+ painted[i].removeAttribute("data-wsr-pin-hidden");
2056
2066
  painted[i].style.removeProperty("order");
2057
2067
  }
2058
2068
  var hidden = document.querySelectorAll(".wsr-hidden");
@@ -2079,6 +2089,7 @@
2079
2089
  if (typeof props.t === "function") data.t = props.t;
2080
2090
  /* With the sidebar half off, drop our paint and stop the timer. */
2081
2091
  var sidebarOn = featureOn(data.settings, "sidebar");
2092
+ if (typeof syncPanelsExposed === "function") syncPanelsExposed(data.settings);
2082
2093
  react.useEffect(function () {
2083
2094
  if (sidebarOn) {
2084
2095
  schedule();
@@ -2178,6 +2189,9 @@
2178
2189
  * never take the window's focus away.
2179
2190
  * ------------------------------------------------------------------- */
2180
2191
 
2192
+ /** Set by apply(): keeps gated panel registrations in step with the store. */
2193
+ var syncPanelsExposed = null;
2194
+
2181
2195
  var confirmBackdrop = null;
2182
2196
  var confirmPrevious = null;
2183
2197
  var confirmKey = null;
@@ -5328,28 +5342,39 @@
5328
5342
  return h(Icon, { size: size });
5329
5343
  }
5330
5344
 
5331
- /** One switch: a title, what it costs to turn off, and a toggle. */
5345
+ /** One switch: a title, what it costs to turn off, and the host's own toggle. */
5332
5346
  function FeatureRow(props) {
5333
5347
  var on = props.on === true;
5348
+ var Switch = ui.Switch;
5349
+ var control;
5350
+ if (typeof Switch === "function") {
5351
+ control = h(Switch, {
5352
+ checked: on,
5353
+ label: props.title,
5354
+ onChange: function () {
5355
+ if (typeof props.onToggle === "function") props.onToggle(props.id);
5356
+ },
5357
+ });
5358
+ } else {
5359
+ /* Older hosts without the primitive fall back to a plain button. */
5360
+ control = h("button", {
5361
+ type: "button",
5362
+ className: on ? "wsr-toggle wsr-toggle-on" : "wsr-toggle",
5363
+ "aria-pressed": on ? "true" : "false",
5364
+ "data-wsr-feature-toggle": props.id,
5365
+ onClick: function () {
5366
+ if (typeof props.onToggle === "function") props.onToggle(props.id);
5367
+ },
5368
+ }, t(on ? "features.on" : "features.off"));
5369
+ }
5334
5370
  return h("div", { className: "wsr-setRow", "data-wsr-feature": props.id },
5335
5371
  h("div", { className: "wsr-setText" },
5336
5372
  h("div", { className: "wsr-setTitle" }, props.title),
5337
5373
  h("div", { className: "wsr-setDesc" }, props.description),
5338
5374
  ),
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
- ),
5375
+ h("div", { className: "wsr-controls", "data-wsr-feature-toggle": props.id }, control),
5350
5376
  );
5351
- }
5352
- /** The package this section belongs to, as the plugin page names it. */
5377
+ } /** The package this section belongs to, as the plugin page names it. */
5353
5378
  var OUR_PACKAGE = "dsh-ws-recency";
5354
5379
 
5355
5380
  /** The package name a detail subject stands for, whichever shape it takes. */
@@ -5985,16 +6010,7 @@
5985
6010
  });
5986
6011
 
5987
6012
  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
- });
6013
+
5998
6014
 
5999
6015
  ctx.slots.inject("main", function () {
6000
6016
  return ctx.slots.register({
@@ -6008,16 +6024,7 @@
6008
6024
 
6009
6025
 
6010
6026
 
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
- });
6027
+
6021
6028
 
6022
6029
  ctx.slots.inject("plugins.detail.section", function () {
6023
6030
  return ctx.slots.register({
@@ -6114,6 +6121,89 @@
6114
6121
 
6115
6122
 
6116
6123
 
6124
+ /*
6125
+ * Search and trash each own a sidebar row. Hiding the glyph is not enough:
6126
+ * the row's label and its panel page are registered too, so the switch has to
6127
+ * dispose the whole injection and build it again when it comes back.
6128
+ */
6129
+ var gated = {};
6130
+ function bindPanels(feature, build) {
6131
+ gated[feature] = { build: build, dispose: null };
6132
+ syncPanels(data.settings);
6133
+ }
6134
+ function syncPanels(settings) {
6135
+ Object.keys(gated).forEach(function (feature) {
6136
+ var entry = gated[feature];
6137
+ var want = featureOn(settings, feature);
6138
+ if (want && entry.dispose === null) {
6139
+ try {
6140
+ entry.dispose = entry.build();
6141
+ } catch (error) {
6142
+ console.warn("[dsh-ws-recency] could not register " + feature + ":", error);
6143
+ }
6144
+ return;
6145
+ }
6146
+ if (!want && entry.dispose !== null) {
6147
+ try {
6148
+ entry.dispose();
6149
+ } catch (error) {
6150
+ /* already gone */
6151
+ }
6152
+ entry.dispose = null;
6153
+ }
6154
+ });
6155
+ }
6156
+ syncPanelsExposed = syncPanels;
6157
+
6158
+ bindPanels("search", function () {
6159
+ var icon = ctx.slots.inject("sidebar.panellist", function () {
6160
+ return ctx.slots.register({
6161
+ name: "sidebar.panellist",
6162
+ id: "ws-recency-search",
6163
+ order: 19,
6164
+ store: prefs,
6165
+ locale: NS,
6166
+ label: function () { return t("search.title"); },
6167
+ }, SearchPanelIcon);
6168
+ });
6169
+ var page = ctx.slots.inject("main", function () {
6170
+ return ctx.slots.register({
6171
+ name: "main",
6172
+ key: "ws-recency-search",
6173
+ store: prefs,
6174
+ locale: NS,
6175
+ }, SearchPanelPage);
6176
+ });
6177
+ return function () {
6178
+ if (typeof icon === "function") icon();
6179
+ if (typeof page === "function") page();
6180
+ };
6181
+ });
6182
+
6183
+ bindPanels("trash", function () {
6184
+ var icon = ctx.slots.inject("sidebar.panellist", function () {
6185
+ return ctx.slots.register({
6186
+ name: "sidebar.panellist",
6187
+ id: "ws-recency-trash",
6188
+ order: 20,
6189
+ store: prefs,
6190
+ locale: NS,
6191
+ label: function () { return t("trash.title"); },
6192
+ }, TrashPanelIcon);
6193
+ });
6194
+ var page = ctx.slots.inject("main", function () {
6195
+ return ctx.slots.register({
6196
+ name: "main",
6197
+ key: "ws-recency-trash",
6198
+ store: prefs,
6199
+ locale: NS,
6200
+ }, TrashPanelPage);
6201
+ });
6202
+ return function () {
6203
+ if (typeof icon === "function") icon();
6204
+ if (typeof page === "function") page();
6205
+ };
6206
+ });
6117
6207
  ctx.effect(function () {
6118
6208
  return function () { shutdown(); };
6119
6209
  }, "dsh-ws-recency: list observer");
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.2";
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.2",
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",