dsh-ws-recency 0.20.0 → 0.20.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
@@ -168,7 +168,7 @@ dsh plugin --profile <profile> add github:chyxhtc/dsh-ws-recency
168
168
  或固定版本的预构建包:
169
169
 
170
170
  ```powershell
171
- dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.20.0/dsh-ws-recency-0.20.0.tgz
171
+ dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.20.1/dsh-ws-recency-0.20.1.tgz
172
172
  ```
173
173
 
174
174
  装完把 `dsh-ws-recency` 加进 `~/.hypers-work/profiles/<profile>/package.json` 的 `dsh.profile.bundles`,重启应用。
package/client.js CHANGED
@@ -1874,7 +1874,31 @@
1874
1874
 
1875
1875
  /* ------------------------------ handoff ------------------------------ */
1876
1876
 
1877
- var handoffStore = null;
1877
+ /* A plain observable, not a slot store: the turn card and the turn action are
1878
+ different slot instances, and a store handle would hand each its own copy. */
1879
+ var handoffState = { sessionId: "", phase: "idle", block: "", needsEnter: false };
1880
+ var handoffListeners = [];
1881
+
1882
+ function currentHandoffState() {
1883
+ return handoffState;
1884
+ }
1885
+
1886
+ function setHandoffState(patch) {
1887
+ handoffState = Object.assign({}, handoffState, patch);
1888
+ var listeners = handoffListeners.slice();
1889
+ for (var i = 0; i < listeners.length; i += 1) {
1890
+ try { listeners[i](handoffState); } catch (error) { /* a dead component */ }
1891
+ }
1892
+ }
1893
+
1894
+ function subscribeHandoff(listener) {
1895
+ handoffListeners.push(listener);
1896
+ return function () {
1897
+ var at = handoffListeners.indexOf(listener);
1898
+ if (at !== -1) handoffListeners.splice(at, 1);
1899
+ };
1900
+ }
1901
+
1878
1902
  var handoffTimer = null;
1879
1903
  var handoffBaseline = 0;
1880
1904
  var handoffTries = 0;
@@ -1959,9 +1983,7 @@
1959
1983
  handoffSession = null;
1960
1984
  handoffBaseline = 0;
1961
1985
  handoffTries = 0;
1962
- if (handoffStore !== null && handoffStore !== undefined) {
1963
- try { handoffStore.actions.setIdle(); } catch (error) { /* store gone */ }
1964
- }
1986
+ setHandoffState({ sessionId: "", phase: "idle", block: "", needsEnter: false });
1965
1987
  }
1966
1988
 
1967
1989
  function handoffBlockOf(text) {
@@ -1989,14 +2011,14 @@
1989
2011
  if (replies > handoffBaseline) {
1990
2012
  var found = handoffBlockOf(answer.text);
1991
2013
  if (found !== "") {
1992
- handoffStore.actions.setReady(found);
2014
+ setHandoffState({ sessionId: sessionId, phase: "ready", block: found, needsEnter: false });
1993
2015
  return;
1994
2016
  }
1995
2017
  handoffBaseline = replies;
1996
2018
  }
1997
2019
  }
1998
2020
  if (handoffTries > 150) {
1999
- handoffStore.actions.setIdle();
2021
+ setHandoffState({ sessionId: "", phase: "idle", block: "", needsEnter: false });
2000
2022
  handoffSession = null;
2001
2023
  return;
2002
2024
  }
@@ -2017,10 +2039,9 @@
2017
2039
 
2018
2040
  /** The turn action: send the instruction and wait for the block. */
2019
2041
  function startHandoff(sessionId) {
2020
- if (handoffStore === null || handoffStore === undefined) return;
2021
2042
  if (typeof sessionId !== "string" || sessionId === "") return;
2022
2043
  var sent = sendInstruction(sessionId);
2023
- handoffStore.actions.setRunning(sessionId, sent);
2044
+ setHandoffState({ sessionId: sessionId, phase: "running", block: "", needsEnter: sent !== true });
2024
2045
  watchHandoff(sessionId);
2025
2046
  }
2026
2047
 
@@ -2057,7 +2078,13 @@
2057
2078
  */
2058
2079
  function HandoffTailCard(props) {
2059
2080
  var sessionId = props !== undefined && props !== null && typeof props.sessionId === "string" ? props.sessionId : "";
2060
- var state = typeof props.useStore === "function" ? props.useStore(function (value) { return value; }) : null;
2081
+ var pair = react.useState(currentHandoffState());
2082
+ var live = pair[0];
2083
+ var setLive = pair[1];
2084
+ react.useEffect(function () {
2085
+ return subscribeHandoff(function (next) { setLive(next); });
2086
+ }, []);
2087
+ var state = live;
2061
2088
  if (state === null || state === undefined || state.sessionId !== sessionId) return null;
2062
2089
  if (state.phase === "running") {
2063
2090
  return h("div", { className: "wsr-handoff-live" }, state.needsEnter === true ? t("handoff.pressEnter") : t("handoff.preparing"));
@@ -2068,7 +2095,7 @@
2068
2095
  h("textarea", {
2069
2096
  className: "wsr-handoff-text",
2070
2097
  value: state.block,
2071
- onChange: function (event) { props.actions.setBlock(event.target.value); },
2098
+ onChange: function (event) { setHandoffState({ block: event.target.value }); },
2072
2099
  }),
2073
2100
  h("div", { className: "wsr-handoff-actions" },
2074
2101
  h("button", {
@@ -2080,7 +2107,7 @@
2080
2107
  type: "button",
2081
2108
  className: "wsr-btn",
2082
2109
  onClick: function () {
2083
- props.actions.setRunning(sessionId, false);
2110
+ setHandoffState({ sessionId: sessionId, phase: "running", block: "", needsEnter: false });
2084
2111
  handoffBaseline = 0;
2085
2112
  handoffTries = 0;
2086
2113
  handoffSession = sessionId;
@@ -2832,34 +2859,6 @@
2832
2859
 
2833
2860
  /* The statistics renderer is plain DOM, not a slot component: keep the
2834
2861
  store handle so it can read the argument-mode preference live. */
2835
- /* Handoff progress lives in a store so the turn card re-renders with it. */
2836
- var handoff = clientStore.defineStore({
2837
- init: function () {
2838
- return { sessionId: "", phase: "idle", block: "", needsEnter: false };
2839
- },
2840
- actions: {
2841
- setRunning: function (draft, sessionId, needsEnter) {
2842
- draft.sessionId = sessionId;
2843
- draft.phase = "running";
2844
- draft.block = "";
2845
- draft.needsEnter = needsEnter === true;
2846
- },
2847
- setReady: function (draft, block) {
2848
- draft.phase = "ready";
2849
- draft.block = typeof block === "string" ? block : "";
2850
- },
2851
- setBlock: function (draft, block) {
2852
- draft.block = typeof block === "string" ? block : "";
2853
- },
2854
- setIdle: function (draft) {
2855
- draft.phase = "idle";
2856
- draft.block = "";
2857
- draft.sessionId = "";
2858
- draft.needsEnter = false;
2859
- },
2860
- },
2861
- });
2862
- handoffStore = handoff;
2863
2862
 
2864
2863
  prefsStore = prefs;
2865
2864
 
@@ -2956,7 +2955,6 @@
2956
2955
  name: "conversation.chat.turnTail",
2957
2956
  id: "ws-recency-handoff-card",
2958
2957
  order: 30,
2959
- store: handoff,
2960
2958
  locale: NS,
2961
2959
  inject: function (sessionId) { return { sessionId: sessionId }; },
2962
2960
  }, HandoffTailCard);
@@ -3030,6 +3028,9 @@
3030
3028
  schedule();
3031
3029
  }
3032
3030
 
3031
+ /* Test hook: the card state is a module observable, invisible from outside. */
3032
+ exports.__handoff = { current: currentHandoffState, set: setHandoffState };
3033
+
3033
3034
  exports.name = "dsh-ws-recency";
3034
3035
  exports.inject = inject;
3035
3036
  exports.apply = apply_;
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.20.0";
35
+ export const HOST_VERSION = "0.20.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.20.0",
3
+ "version": "0.20.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, and moving a session to another workspace.",
5
5
  "license": "MIT",
6
6
  "author": "chyxhtc",