dsh-ws-recency 0.33.2 → 0.34.0

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
@@ -196,6 +196,17 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
196
196
 
197
197
  所以用 `dsh-gateway` 之类的转接插件、或直接从局域网 IP 访问时,删除和统计都能正常用;只有**真正的跨站页面**会被 403 拒绝。0.32.1 及更早的版本只认回环地址,非回环访问一律 403(issue #3)。
198
198
 
199
+ ## 会话菜单里留下什么
200
+
201
+ 本插件只往会话「…」菜单里加两项,其余动作都由宿主或对话界面本身提供:
202
+
203
+ | 项 | 为什么还需要它 |
204
+ |---|---|
205
+ | 标记需要跟进 | 宿主没有这个概念,它是侧栏三色标记的一种 |
206
+ | 移动到工作区… | 宿主的 attach 校验 `header.cwd`,核心没有改工作区的入口 |
207
+
208
+ 交接在每轮回复下方的动作行里;Token 统计在输入框上方的「分析」胶囊里;删除会话(移入回收站)的菜单项在 0.34.0 移除——要恢复它,把 `ctx.slots.inject("sidebar.workspaces.session.menu.item", … , TrashMenuItem)` 那段注册加回去即可,宿主侧的删除/回收站路由一直都在。
209
+
199
210
  ## 已知边界
200
211
 
201
212
  - 依赖宿主 DOM:分组容器带 `_groupSection`、分组头带 `data-row-key="workspace:<id>"`、行带 `data-row-key="session:<id>"`、溢出按钮类名含 `sessionOverflowButton`。宿主改结构就要跟着改。
package/client.js CHANGED
@@ -1285,7 +1285,7 @@
1285
1285
  folded. Expanding drives the hidden host button until nothing is left
1286
1286
  unrendered, so one click reveals the whole group. */
1287
1287
  var remaining = folded + hostHidden;
1288
- /* A project that is entirely history is open because opening it is the
1288
+ /* A project that is entirely history is open because opening it is the
1289
1289
  request; there is nothing to offer to fold back. */
1290
1290
  if (expanded && !onlyHistory) {
1291
1291
  (function (entryKey) {
@@ -2008,48 +2008,7 @@
2008
2008
  });
2009
2009
  }
2010
2010
 
2011
- /**
2012
- * Session "..." menu row: move the session into the trash folder.
2013
- *
2014
- * DSH itself only archives; the host half of this plugin stops the work,
2015
- * detaches the bookkeeping and renames the log directory into
2016
- * `<home>/.trash/ws-recency/`. The browser half only asks for confirmation
2017
- * and posts the id.
2018
- */
2019
2011
 
2020
- function TrashMenuItem(props) {
2021
- var Item = ui.MenuItemButton;
2022
- if (typeof Item !== "function") return null;
2023
- var Icon = ui.IconTrashOutlineRegular;
2024
- return h(Item, {
2025
- icon: typeof Icon === "function" ? h(Icon, {}) : undefined,
2026
- onSelect: function () {
2027
- askConfirm(t("trash.confirm"), function () {
2028
- fetch("/ws-recency/session-trash?sessionId=" + encodeURIComponent(props.sessionId), {
2029
- method: "POST",
2030
- headers: { "content-type": "application/json" },
2031
- body: JSON.stringify({ sessionId: props.sessionId }),
2032
- })
2033
- .then(function (response) {
2034
- return response.text().then(function (text) {
2035
- var parsed = null;
2036
- try { parsed = JSON.parse(text); } catch (error) { parsed = null; }
2037
- return { status: response.status, text: text, json: parsed };
2038
- });
2039
- })
2040
- .then(function (result) {
2041
- if (result.json !== null && result.json.ok === true) return;
2042
- var reason = (result.json !== null && result.json.error) || (result.text || "").trim().slice(0, 120) || "(empty response)";
2043
- askNotice(t("trash.failed") + "HTTP " + result.status + " \u00b7 " + reason);
2044
- })
2045
- .catch(function (error) {
2046
- askNotice(t("trash.failed") + (error && error.message ? error.message : error));
2047
- });
2048
- });
2049
- },
2050
- }, t("menu.trash"));
2051
- }
2052
-
2053
2012
  /* ------------------------- token statistics ------------------------- */
2054
2013
 
2055
2014
  var statsModal = null;
@@ -3750,36 +3709,8 @@
3750
3709
  return typeof Tooltip === "function" ? h(Tooltip, { label: label, side: "bottom" }, button) : button;
3751
3710
  }
3752
3711
 
3753
- /** Session "..." menu row: hand the work over to a fresh Session. */
3754
- function HandoffMenuItem(props) {
3755
- var Item = ui.MenuItemButton;
3756
- if (typeof Item !== "function") return null;
3757
- var Icon = ui.IconDataOutlineRegular;
3758
- return h(Item, {
3759
- icon: typeof Icon === "function" ? h(Icon, {}) : undefined,
3760
- onSelect: function () {
3761
- /* Open the conversation first so the running handoff (and later the
3762
- card) is visible; the prompt itself does not need the composer. */
3763
- var service = data.service;
3764
- if (service !== null && service !== undefined && typeof service.openSession === "function") {
3765
- try { service.openSession(props.sessionId); } catch (error) { /* the send still lands */ }
3766
- }
3767
- startHandoff(props.sessionId);
3768
- },
3769
- }, t("menu.handoff"));
3770
- }
3771
-
3772
- /** Session "..." menu row: token statistics of that session. */
3773
- function StatsMenuItem(props) {
3774
- var Item = ui.MenuItemButton;
3775
- if (typeof Item !== "function") return null;
3776
- var Icon = ui.IconDataOutlineRegular;
3777
- return h(Item, {
3778
- icon: typeof Icon === "function" ? h(Icon, {}) : undefined,
3779
- onSelect: function () { openStatsPanel(props.sessionId); },
3780
- }, t("menu.stats"));
3781
- }
3782
-
3712
+
3713
+
3783
3714
  /** Settings -> General row: ask before a jump that loads a lot of history. */
3784
3715
  function ColdJumpRow(props) {
3785
3716
  var settings = props.useStore(function (state) { return state; });
@@ -5926,36 +5857,9 @@
5926
5857
  }, MoveMenuItem);
5927
5858
  });
5928
5859
 
5929
- ctx.slots.inject("sidebar.workspaces.session.menu.item", function () {
5930
- return ctx.slots.register({
5931
- name: "sidebar.workspaces.session.menu.item",
5932
- id: "ws-recency-handoff",
5933
- order: 685,
5934
- store: prefs,
5935
- locale: NS,
5936
- }, HandoffMenuItem);
5937
- });
5938
5860
 
5939
- ctx.slots.inject("sidebar.workspaces.session.menu.item", function () {
5940
- return ctx.slots.register({
5941
- name: "sidebar.workspaces.session.menu.item",
5942
- id: "ws-recency-stats",
5943
- order: 710,
5944
- store: prefs,
5945
- locale: NS,
5946
- }, StatsMenuItem);
5947
- });
5948
5861
 
5949
5862
 
5950
- ctx.slots.inject("sidebar.workspaces.session.menu.item", function () {
5951
- return ctx.slots.register({
5952
- name: "sidebar.workspaces.session.menu.item",
5953
- id: "ws-recency-trash",
5954
- order: 700,
5955
- store: prefs,
5956
- locale: NS,
5957
- }, TrashMenuItem);
5958
- });
5959
5863
 
5960
5864
  ctx.effect(function () {
5961
5865
  return function () { shutdown(); };
@@ -5978,6 +5882,9 @@
5978
5882
  };
5979
5883
 
5980
5884
  /* Test hook: the jump and the highlighting are pure DOM helpers. */
5885
+ /* The statistics panel no longer has a menu row; tests open it here. */
5886
+ exports.__stats = { open: openStatsPanel, close: closeStatsPanel };
5887
+
5981
5888
  exports.__search = {
5982
5889
  draft: function () { return searchDraft; },
5983
5890
  highlight: highlightSnippet,
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.33.2";
35
+ export const HOST_VERSION = "0.34.0";
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.33.2",
3
+ "version": "0.34.0",
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",