dsh-ws-recency 0.35.0 → 0.35.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 CHANGED
@@ -209,7 +209,7 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
209
209
 
210
210
  ## 插件功能开关
211
211
 
212
- 侧栏多了一个「插件功能」面板(滑块图标),每一项都能单独开关,默认全开:
212
+ 开关在插件自己的页面上:侧栏「插件」→ `dsh-ws-recency` → 页面底部的「插件功能」一节(`plugins.detail.section`)。每一项都能单独开关,默认全开:
213
213
 
214
214
  | 开关 | 关掉之后 |
215
215
  |---|---|
package/client.js CHANGED
@@ -398,6 +398,9 @@
398
398
  ".wsr-amplified-subtitle{font-size:11px;font-weight:600;color:var(--dsw-alias-label-secondary);margin-top:4px}",
399
399
  ".wsr-amplified-lead{font-size:11px;line-height:1.6;color:var(--dsw-alias-label-tertiary)}",
400
400
  ".wsr-stats-footnote{padding-top:6px;border-top:.5px solid rgba(255,255,255,.06)}",
401
+ ".wsr-plugin-features{display:flex;flex-direction:column;gap:2px;margin-top:18px;padding-top:14px;border-top:1px solid var(--dsw-alias-border-1,rgba(255,255,255,.10))}",
402
+ ".wsr-features-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:2px 2px 6px}",
403
+ ".wsr-features-title{font-size:14px;font-weight:600}",
401
404
  ".wsr-toggle{width:100%;height:28px;padding:0 12px 0 calc(28px + var(--dsh-workspace-indent,0px));cursor:pointer;text-align:left;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;font-size:12px}",
402
405
  ".wsr-toggle:hover{color:var(--dsw-alias-label-secondary)}",
403
406
  '[' + STATE_ATTR + '="running"] [class*="_title"]{color:#4f8ef7}',
@@ -5317,13 +5320,6 @@
5317
5320
  }
5318
5321
 
5319
5322
  /** The sidebar's trash entry glyph. */
5320
- /** Sidebar glyph for the feature switches. */
5321
- function FeaturesPanelIcon(props) {
5322
- var Icon = ui.IconSlidersTwoOutlineRegular;
5323
- if (typeof Icon !== "function") return null;
5324
- var size = props !== undefined && props !== null && typeof props.size === "number" ? props.size : 16;
5325
- return h(Icon, { size: size });
5326
- }
5327
5323
 
5328
5324
  function TrashPanelIcon(props) {
5329
5325
  var Icon = ui.IconTrashOutlineRegular;
@@ -5334,8 +5330,7 @@
5334
5330
 
5335
5331
  /** One switch: a title, what it costs to turn off, and a toggle. */
5336
5332
  function FeatureRow(props) {
5337
- var settings = props.useStore(function (state) { return state; });
5338
- var on = featureOn(settings, props.id);
5333
+ var on = props.on === true;
5339
5334
  return h("div", { className: "wsr-setRow", "data-wsr-feature": props.id },
5340
5335
  h("div", { className: "wsr-setText" },
5341
5336
  h("div", { className: "wsr-setTitle" }, props.title),
@@ -5347,47 +5342,92 @@
5347
5342
  className: on ? "wsr-toggle wsr-toggle-on" : "wsr-toggle",
5348
5343
  "aria-pressed": on ? "true" : "false",
5349
5344
  "data-wsr-feature-toggle": props.id,
5350
- onClick: function () { props.actions.setFeature(props.id); },
5345
+ onClick: function () {
5346
+ if (typeof props.onToggle === "function") props.onToggle(props.id);
5347
+ },
5351
5348
  }, t(on ? "features.on" : "features.off")),
5352
5349
  ),
5353
5350
  );
5354
5351
  }
5352
+ /** The package this section belongs to, as the plugin page names it. */
5353
+ var OUR_PACKAGE = "dsh-ws-recency";
5354
+
5355
+ /** The package name a detail subject stands for, whichever shape it takes. */
5356
+ function subjectPackageName(subject) {
5357
+ if (subject === null || subject === undefined || typeof subject !== "object") return "";
5358
+ if (typeof subject.name === "string" && subject.name !== "") return subject.name;
5359
+ var pkg = subject.pkg;
5360
+ if (typeof pkg === "string") return pkg;
5361
+ if (pkg !== null && pkg !== undefined && typeof pkg === "object") {
5362
+ if (typeof pkg.name === "string") return pkg.name;
5363
+ if (typeof pkg.id === "string") return pkg.id;
5364
+ }
5365
+ var row = subject.row;
5366
+ if (row !== null && row !== undefined && typeof row === "object" && typeof row.package === "string") return row.package;
5367
+ return "";
5368
+ }
5369
+
5370
+ /**
5371
+ * The plugin page's own section: every ability of this plugin, on or off.
5372
+ *
5373
+ * It renders nothing for another package's page, which is the contract for a
5374
+ * detail section.
5375
+ */
5376
+ function FeaturesSection(props) {
5377
+ var storeSettings = typeof props.useStore === "function" ? props.useStore(function (state) { return state; }) : data.settings;
5378
+ var name = subjectPackageName(props.subject);
5379
+ /* A row subject carries the package differently; accept both spellings. */
5380
+ if (name !== OUR_PACKAGE && String(name).indexOf(OUR_PACKAGE) !== 0) return null;
5381
+
5382
+ /* A toggle is visible at once, even where the slot hands us no store hook. */
5383
+ var overrides = react.useState({});
5384
+ var valueOf = function (id) {
5385
+ var bag = overrides[0] || {};
5386
+ if (typeof bag[id] === "boolean") return bag[id];
5387
+ return featureOn(storeSettings, id);
5388
+ };
5389
+ var setAll = function (bag) { overrides[1](bag); };
5390
+ var toggle = function (id) {
5391
+ var next = {};
5392
+ var bag = overrides[0] || {};
5393
+ next[id] = !valueOf(id);
5394
+ setAll(Object.assign({}, bag, next));
5395
+ if (props.actions !== undefined) props.actions.setFeature(id);
5396
+ };
5397
+ var reset = function () {
5398
+ setAll({});
5399
+ if (props.actions !== undefined) props.actions.resetFeatures();
5400
+ };
5355
5401
 
5356
- /** The settings page: every ability of the plugin, on or off. */
5357
- function FeaturesPanelPage(props) {
5358
- var settings = props.useStore(function (state) { return state; });
5359
5402
  var rows = FEATURE_IDS.map(function (id) {
5360
5403
  return h(FeatureRow, {
5361
5404
  key: id,
5362
5405
  id: id,
5363
5406
  title: t("features." + id + ".title"),
5364
5407
  description: t("features." + id + ".desc"),
5365
- useStore: props.useStore,
5366
- actions: props.actions,
5408
+ on: valueOf(id),
5409
+ onToggle: toggle,
5367
5410
  });
5368
5411
  });
5369
- return h("div", { className: "wsr-page wsr-features-page" },
5370
- h("div", { className: "wsr-page-head" },
5371
- h("div", { className: "wsr-page-heading" }, t("features.title")),
5412
+ var onCount = FEATURE_IDS.filter(function (id) { return valueOf(id); }).length;
5413
+ return h("section", { className: "wsr-plugin-features", "data-wsr-features": OUR_PACKAGE },
5414
+ h("div", { className: "wsr-features-head" },
5415
+ h("div", { className: "wsr-features-title" }, t("features.title")),
5372
5416
  h("button", {
5373
5417
  type: "button",
5374
5418
  className: "wsr-btn",
5375
5419
  "data-wsr-features-reset": "true",
5376
- onClick: function () { props.actions.resetFeatures(); },
5420
+ onClick: reset,
5377
5421
  }, t("features.reset")),
5378
5422
  ),
5379
- h("div", { className: "wsr-page-list" },
5380
- h("div", { className: "wsr-setNote" }, t("features.note")),
5381
- rows,
5382
- h("div", { className: "wsr-setNote" }, t("features.takesEffect", {
5383
- on: String(FEATURE_IDS.filter(function (id) { return featureOn(settings, id); }).length),
5384
- all: String(FEATURE_IDS.length),
5385
- })),
5386
- ),
5423
+ h("div", { className: "wsr-setNote" }, t("features.note")),
5424
+ rows,
5425
+ h("div", { className: "wsr-setNote" }, t("features.takesEffect", {
5426
+ on: String(onCount),
5427
+ all: String(FEATURE_IDS.length),
5428
+ })),
5387
5429
  );
5388
- }
5389
-
5390
- /**
5430
+ } /**
5391
5431
  * The trash page itself: the plugin's trash (deleted logs) on top, the
5392
5432
  * Host's archive set (hidden sessions whose logs are still in place)
5393
5433
  * below. Both are "put away", so both are managed from here.
@@ -5967,16 +6007,6 @@
5967
6007
  }
5968
6008
 
5969
6009
 
5970
- ctx.slots.inject("sidebar.panellist", function () {
5971
- return ctx.slots.register({
5972
- name: "sidebar.panellist",
5973
- id: "ws-recency-features",
5974
- order: 21,
5975
- store: prefs,
5976
- locale: NS,
5977
- label: function () { return t("features.title"); },
5978
- }, FeaturesPanelIcon);
5979
- });
5980
6010
 
5981
6011
  ctx.slots.inject("sidebar.panellist", function () {
5982
6012
  return ctx.slots.register({
@@ -5989,13 +6019,14 @@
5989
6019
  }, withFeature(TrashPanelIcon, "trash"));
5990
6020
  });
5991
6021
 
5992
- ctx.slots.inject("main", function () {
6022
+ ctx.slots.inject("plugins.detail.section", function () {
5993
6023
  return ctx.slots.register({
5994
- name: "main",
5995
- key: "ws-recency-features",
6024
+ name: "plugins.detail.section",
6025
+ id: "ws-recency-features",
6026
+ order: 60,
5996
6027
  store: prefs,
5997
6028
  locale: NS,
5998
- }, FeaturesPanelPage);
6029
+ }, FeaturesSection);
5999
6030
  });
6000
6031
 
6001
6032
  ctx.slots.inject("main", function () {
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.0";
35
+ export const HOST_VERSION = "0.35.1";
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.0",
3
+ "version": "0.35.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, 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",