dsh-ws-recency 0.20.1 → 0.21.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.
Files changed (4) hide show
  1. package/README.md +11 -10
  2. package/client.js +112 -24
  3. package/index.js +1 -1
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -120,17 +120,18 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
120
120
 
121
121
  ## 八、交接到新会话
122
122
 
123
- 长期会话的上下文迟早会满,被动压缩往往比"换个新会话、带上交接"更差。交接全程在**对话里**完成,不会弹窗:
123
+ 长期会话的上下文迟早会满,被动压缩往往比"换个新会话、带上交接"更差。交接全程在对话里完成,不弹窗:
124
124
 
125
- 1. 每轮回复底部的动作行(复制 / 点赞 / 分支那一排)里点 **交接到新会话**:插件把一段固定指令放进输入框并尝试直接发送(发不出去就在卡片上提示你按回车);
126
- 2. 当前会话的 AI 按指令输出一个 ```handoff 代码块——**只写文档路径和要点,不粘贴文档内容**;
127
- 3. 插件每 2 秒读一次这个会话的最新回复,抓到代码块后,**在该轮回复下方**出现一张卡片:可编辑预览 + 三个按钮;
128
- 4. **交接到新会话**:在当前工作区开一个新会话,把"开场要求 + 交接块"预填进输入框,你按回车开始;**继续补充**回到输入框接着打磨(新一轮回复会刷新卡片);**放弃交接**收起卡片。
129
- 5. 轮询最多 5 分钟后自动收起,避免一直挂着。
125
+ 1. 每轮回复底部的动作行(复制 / 点赞 / 分支那一排)里点 **交接到新会话**:插件把交接指令放进输入框并尝试直接发送(发不出去会在卡片上提示你按回车);
126
+ 2. 当前会话的 AI 输出一个 ```handoff 代码块——**只写文档路径和要点,不粘贴文档内容**;
127
+ 3. 抓到代码块后,**在该轮回复下方**出现一张问询卡片,和工具向用户提问的形态一致:
128
+ - **确认,交接到新会话**(默认选中):当前工作区开新会话,内容预填进输入框;
129
+ - **不满意,重新生成一版**:让当前会话按同样的要求再写一份;
130
+ - 底部输入框:填写调整意见(例如"多写接口约束、少写历史"),提交后按这些要求重写;
131
+ - 「查看内容」展开只读预览,「放弃交接」收起卡片。
132
+ 4. 交接内容另存一份到 `~/.hypers-work/.wsr/handoff/<sessionId>-<时间>.md`。
130
133
 
131
- - 交接内容另存一份到 `~/.hypers-work/.wsr/handoff/<sessionId>-<时间>.md`;
132
- - 新会话是草稿形态:侧栏显示为「新会话」,发出第一条消息后才转正;
133
- - 「…」菜单里的同名入口保留。
134
+ 细节想改不用在这里改——新会话的输入框里直接调更顺手。轮询最多 5 分钟自动收起。
134
135
 
135
136
  ## 设置
136
137
 
@@ -168,7 +169,7 @@ dsh plugin --profile <profile> add github:chyxhtc/dsh-ws-recency
168
169
  或固定版本的预构建包:
169
170
 
170
171
  ```powershell
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
+ dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.21.0/dsh-ws-recency-0.21.0.tgz
172
173
  ```
173
174
 
174
175
  装完把 `dsh-ws-recency` 加进 `~/.hypers-work/profiles/<profile>/package.json` 的 `dsh.profile.bundles`,重启应用。
package/client.js CHANGED
@@ -140,6 +140,14 @@
140
140
  ".wsr-footer-action{display:flex;box-sizing:border-box;flex:none;align-items:center;justify-content:flex-start;gap:8px;width:calc(100% + 4px);min-width:0;height:42px;margin:4px -2px;padding:0 10px 0 8px;border:0;border-radius:12px;background:transparent;color:var(--dsw-alias-label-primary);font-family:inherit;font-size:14px;line-height:22px;text-align:left;cursor:pointer}",
141
141
  ".wsr-footer-action:hover{background:var(--dsw-alias-interactive-bg-hover)}",
142
142
  ".wsr-page{display:flex;flex-direction:column;gap:10px;padding:16px 18px;min-width:0;box-sizing:border-box;height:100%;overflow:auto}",
143
+ ".wsr-handoff-option{display:flex;align-items:flex-start;gap:8px;padding:6px 8px;border-radius:8px;cursor:pointer}",
144
+ ".wsr-handoff-option:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}",
145
+ ".wsr-handoff-option input{margin-top:2px}",
146
+ ".wsr-handoff-option-text{display:flex;flex-direction:column;gap:2px;min-width:0}",
147
+ ".wsr-handoff-option-title{font-size:13px;color:var(--dsw-alias-label-primary)}",
148
+ ".wsr-handoff-option-desc{font-size:11px;color:var(--dsw-alias-label-tertiary)}",
149
+ ".wsr-handoff-extra{width:100%;box-sizing:border-box;min-height:56px;max-height:140px;resize:vertical;font:inherit;font-size:12px;line-height:1.6;padding:8px 10px;border-radius:8px;border:.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.16));background:var(--dsw-alias-bg-layer-1,#1b1b1b);color:var(--dsw-alias-label-primary,#e6e6e6)}",
150
+ ".wsr-handoff-body{white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.6;max-height:220px;overflow:auto;padding:8px 10px;border-radius:8px;background:var(--dsw-alias-bg-layer-1,#1b1b1b)}",
143
151
  ".wsr-handoff-card{display:flex;flex-direction:column;gap:8px;margin:8px 0;padding:12px 14px;border:.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.16));border-radius:10px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04))}",
144
152
  ".wsr-handoff-head{font-size:12px;color:var(--dsw-alias-label-secondary)}",
145
153
  ".wsr-handoff-actions{display:flex;gap:6px;align-items:center;white-space:nowrap}",
@@ -282,6 +290,17 @@
282
290
  "handoff.noService": "没能自动开新会话,交接内容已复制到剪贴板,手动新建会话粘贴即可。",
283
291
  "handoff.preamble": "以下是一个会话交接说明,来自上一个会话。请先按「文档引用」逐份阅读文档,再结合要点接续工作;已经完成的部分不要重做。",
284
292
  "handoff.footnote": "交接内容会另存一份到 .wsr/handoff/,方便追溯。",
293
+ "handoff.preparing": "正在准备交接,等这一轮回复写完…",
294
+ "handoff.pressEnter": "指令已放进输入框,请按回车发送(自动发送没有生效)。",
295
+ "handoff.cancel": "放弃交接",
296
+ "handoff.confirmDesc": "带着这份内容在当前工作区开一个新会话",
297
+ "handoff.regen": "不满意,重新生成一版",
298
+ "handoff.regenDesc": "让当前会话按同样的要求再写一份",
299
+ "handoff.extraPlaceholder": "补充调整意见(填了就按这些要求重写,例如:多写接口约束、少写历史)",
300
+ "handoff.preview": "查看内容",
301
+ "handoff.submit": "提交",
302
+ "handoff.regeneratePrompt": "这份交接说明需要重写。请按最初同样的要求再输出一份,同样写进 ```handoff 代码块,路径与要点保持精炼。",
303
+ "handoff.adjustPrompt": "请按下面的补充要求重写交接说明,保持 ```handoff 代码块格式:",
285
304
  "move.title": "移动到工作区",
286
305
  "move.warning": "只移动会话本身:它在旧工作区里创建或修改的文件不会跟着走,仍留在原目录。",
287
306
  "move.note": "会话属于哪个工作区,由它创建时的目录决定;移动会改写会话记录的 cwd,把日志搬到新工作区目录,旧日志备份在 .trash/ws-recency。",
@@ -402,6 +421,17 @@
402
421
  "handoff.noService": "Could not open a Session automatically; the handoff was copied to the clipboard.",
403
422
  "handoff.preamble": "Below is a handoff note from the previous Session. Read the referenced documents first, then continue from the notes; do not redo what is already done.",
404
423
  "handoff.footnote": "A copy is saved under .wsr/handoff/ for later reference.",
424
+ "handoff.preparing": "Preparing the handoff; waiting for this turn to finish…",
425
+ "handoff.pressEnter": "The instruction is in the composer; press Enter to send it (automatic send did not take).",
426
+ "handoff.cancel": "Cancel handoff",
427
+ "handoff.confirmDesc": "Open a new Session in this workspace with this note",
428
+ "handoff.regen": "Not good enough, regenerate",
429
+ "handoff.regenDesc": "Ask the current Session to write it again with the same rules",
430
+ "handoff.extraPlaceholder": "Adjustments (if filled, the note is rewritten with them: more constraints, less history, …)",
431
+ "handoff.preview": "Show note",
432
+ "handoff.submit": "Submit",
433
+ "handoff.regeneratePrompt": "Rewrite the handoff note with the same rules as before, again inside a ```handoff block.",
434
+ "handoff.adjustPrompt": "Rewrite the handoff note following these adjustments, keeping the ```handoff block format:",
405
435
  "move.title": "Move to workspace",
406
436
  "move.warning": "Only the session moves: files it created or changed in the old workspace stay where they are.",
407
437
  "move.note": "A session belongs to the workspace of the directory it was created in. Moving rewrites the stored cwd, relocates the log and keeps the old one as a backup in .trash/ws-recency.",
@@ -1920,9 +1950,8 @@
1920
1950
  }
1921
1951
 
1922
1952
  /** Write text into the composer and send it, if the editor is reachable. */
1923
- function sendInstruction(sessionId) {
1924
- var text = handoffInstruction();
1925
- if (typeof document === "undefined") return false;
1953
+ function sendToSession(text) {
1954
+ if (typeof document === "undefined" || typeof text !== "string" || text === "") return false;
1926
1955
  var seat = typeof document.querySelector === "function" ? document.querySelector("[data-composer-seat]") : null;
1927
1956
  if (seat === null || seat === undefined) return false;
1928
1957
  var editor = null;
@@ -2040,7 +2069,7 @@
2040
2069
  /** The turn action: send the instruction and wait for the block. */
2041
2070
  function startHandoff(sessionId) {
2042
2071
  if (typeof sessionId !== "string" || sessionId === "") return;
2043
- var sent = sendInstruction(sessionId);
2072
+ var sent = sendToSession(handoffInstruction());
2044
2073
  setHandoffState({ sessionId: sessionId, phase: "running", block: "", needsEnter: sent !== true });
2045
2074
  watchHandoff(sessionId);
2046
2075
  }
@@ -2072,9 +2101,24 @@
2072
2101
  });
2073
2102
  }
2074
2103
 
2104
+ /** Ask the current Session to rewrite the handoff with the user's adjustments. */
2105
+ function rewriteHandoff(sessionId, extra) {
2106
+ var text = extra.trim() === "" ? t("handoff.regeneratePrompt") : t("handoff.adjustPrompt") + "\n\n" + extra.trim();
2107
+ var sent = sendToSession(text);
2108
+ setHandoffState({ sessionId: sessionId, phase: "running", block: "", needsEnter: sent !== true });
2109
+ handoffBaseline = 0;
2110
+ handoffTries = 0;
2111
+ handoffSession = sessionId;
2112
+ watchHandoff(sessionId);
2113
+ }
2114
+
2075
2115
  /**
2076
- * The handoff card, rendered in the turn tail: it appears only for the
2077
- * Session that started the flow, and only once a block has been produced.
2116
+ * The handoff question card.
2117
+ *
2118
+ * Two mutually exclusive choices and one free-text field, the same shape as a
2119
+ * tool asking the user a question: confirm and carry over, regenerate, or say
2120
+ * what to change. The note itself is read-only here - detail edits belong in
2121
+ * the new Session's composer.
2078
2122
  */
2079
2123
  function HandoffTailCard(props) {
2080
2124
  var sessionId = props !== undefined && props !== null && typeof props.sessionId === "string" ? props.sessionId : "";
@@ -2084,44 +2128,88 @@
2084
2128
  react.useEffect(function () {
2085
2129
  return subscribeHandoff(function (next) { setLive(next); });
2086
2130
  }, []);
2131
+ var choice = react.useState("confirm");
2132
+ var picked = choice[0];
2133
+ var setPicked = choice[1];
2134
+ var extraPair = react.useState("");
2135
+ var extra = extraPair[0];
2136
+ var setExtra = extraPair[1];
2137
+
2087
2138
  var state = live;
2088
2139
  if (state === null || state === undefined || state.sessionId !== sessionId) return null;
2089
2140
  if (state.phase === "running") {
2090
2141
  return h("div", { className: "wsr-handoff-live" }, state.needsEnter === true ? t("handoff.pressEnter") : t("handoff.preparing"));
2091
2142
  }
2092
2143
  if (state.phase !== "ready") return null;
2093
- var body = [
2094
- h("div", { className: "wsr-handoff-head" }, t("handoff.found")),
2144
+
2145
+ var rows = [
2146
+ h("label", { className: "wsr-handoff-option", key: "opt-confirm" },
2147
+ h("input", {
2148
+ type: "radio",
2149
+ name: "wsr-handoff-" + sessionId,
2150
+ checked: picked === "confirm",
2151
+ onChange: function () { setPicked("confirm"); },
2152
+ }),
2153
+ h("span", { className: "wsr-handoff-option-text" },
2154
+ h("span", { className: "wsr-handoff-option-title" }, t("handoff.confirm")),
2155
+ h("span", { className: "wsr-handoff-option-desc" }, t("handoff.confirmDesc")),
2156
+ ),
2157
+ ),
2158
+ h("label", { className: "wsr-handoff-option", key: "opt-redo" },
2159
+ h("input", {
2160
+ type: "radio",
2161
+ name: "wsr-handoff-" + sessionId,
2162
+ checked: picked === "redo",
2163
+ onChange: function () { setPicked("redo"); },
2164
+ }),
2165
+ h("span", { className: "wsr-handoff-option-text" },
2166
+ h("span", { className: "wsr-handoff-option-title" }, t("handoff.regen")),
2167
+ h("span", { className: "wsr-handoff-option-desc" }, t("handoff.regenDesc")),
2168
+ ),
2169
+ ),
2095
2170
  h("textarea", {
2096
- className: "wsr-handoff-text",
2097
- value: state.block,
2098
- onChange: function (event) { setHandoffState({ block: event.target.value }); },
2171
+ className: "wsr-handoff-extra",
2172
+ key: "extra",
2173
+ placeholder: t("handoff.extraPlaceholder"),
2174
+ value: extra,
2175
+ onChange: function (event) { setExtra(event.target.value); },
2099
2176
  }),
2100
- h("div", { className: "wsr-handoff-actions" },
2101
- h("button", {
2102
- type: "button",
2103
- className: "wsr-btn",
2104
- onClick: function () { carryHandoff(sessionId, state.block); },
2105
- }, t("handoff.confirm")),
2177
+ h("div", { className: "wsr-handoff-actions", key: "actions" },
2106
2178
  h("button", {
2107
2179
  type: "button",
2108
2180
  className: "wsr-btn",
2109
2181
  onClick: function () {
2110
- setHandoffState({ sessionId: sessionId, phase: "running", block: "", needsEnter: false });
2111
- handoffBaseline = 0;
2112
- handoffTries = 0;
2113
- handoffSession = sessionId;
2114
- watchHandoff(sessionId);
2182
+ if (extra.trim() !== "") { rewriteHandoff(sessionId, extra); return; }
2183
+ if (picked === "redo") { rewriteHandoff(sessionId, ""); return; }
2184
+ carryHandoff(sessionId, state.block);
2115
2185
  },
2116
- }, t("handoff.more")),
2186
+ }, t("handoff.submit")),
2117
2187
  h("button", {
2118
2188
  type: "button",
2119
2189
  className: "wsr-btn",
2120
2190
  onClick: function () { resetHandoff(); },
2121
2191
  }, t("handoff.cancel")),
2192
+ h("button", {
2193
+ type: "button",
2194
+ className: "wsr-btn",
2195
+ onClick: function () {
2196
+ var preview = typeof document !== "undefined" ? document.querySelector('[data-wsr-handoff-preview="' + sessionId + '"]') : null;
2197
+ if (preview !== null && preview !== undefined && preview.style !== undefined) {
2198
+ preview.style.display = preview.style.display === "none" ? "" : "none";
2199
+ }
2200
+ },
2201
+ }, t("handoff.preview")),
2122
2202
  ),
2123
2203
  ];
2124
- return h.apply(null, ["div", { className: "wsr-handoff-card" }].concat(body));
2204
+
2205
+ return h("div", { className: "wsr-handoff-card" },
2206
+ h("div", { className: "wsr-handoff-head" }, t("handoff.found")),
2207
+ h("div", { "data-wsr-handoff-preview": sessionId, className: "wsr-handoff-body", style: { display: "none" } }, state.block),
2208
+ rows[0],
2209
+ rows[1],
2210
+ rows[2],
2211
+ rows[3],
2212
+ );
2125
2213
  }
2126
2214
 
2127
2215
  /**
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.1";
35
+ export const HOST_VERSION = "0.21.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.20.1",
3
+ "version": "0.21.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, and moving a session to another workspace.",
5
5
  "license": "MIT",
6
6
  "author": "chyxhtc",