dsh-ws-recency 0.21.0 → 0.23.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 +4 -2
  2. package/client.js +149 -83
  3. package/index.js +1 -1
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -125,7 +125,7 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
125
125
  1. 每轮回复底部的动作行(复制 / 点赞 / 分支那一排)里点 **交接到新会话**:插件把交接指令放进输入框并尝试直接发送(发不出去会在卡片上提示你按回车);
126
126
  2. 当前会话的 AI 输出一个 ```handoff 代码块——**只写文档路径和要点,不粘贴文档内容**;
127
127
  3. 抓到代码块后,**在该轮回复下方**出现一张问询卡片,和工具向用户提问的形态一致:
128
- - **确认,交接到新会话**(默认选中):当前工作区开新会话,内容预填进输入框;
128
+ - 卡片样式沿用宿主问询卡:标题 + 编号选项 + 底部动作;**确认,交接到新会话**(默认选中):当前工作区开新会话,内容预填进输入框;
129
129
  - **不满意,重新生成一版**:让当前会话按同样的要求再写一份;
130
130
  - 底部输入框:填写调整意见(例如"多写接口约束、少写历史"),提交后按这些要求重写;
131
131
  - 「查看内容」展开只读预览,「放弃交接」收起卡片。
@@ -133,6 +133,8 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
133
133
 
134
134
  细节想改不用在这里改——新会话的输入框里直接调更顺手。轮询最多 5 分钟自动收起。
135
135
 
136
+ 自动发送是模拟 Enter:草稿面板渲染慢时会在 14 秒内重试;如果始终没送出去,文本仍留在输入框里,手动回车即可。
137
+
136
138
  ## 设置
137
139
 
138
140
  **设置 → 通用**:
@@ -169,7 +171,7 @@ dsh plugin --profile <profile> add github:chyxhtc/dsh-ws-recency
169
171
  或固定版本的预构建包:
170
172
 
171
173
  ```powershell
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
174
+ dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.23.0/dsh-ws-recency-0.23.0.tgz
173
175
  ```
174
176
 
175
177
  装完把 `dsh-ws-recency` 加进 `~/.hypers-work/profiles/<profile>/package.json` 的 `dsh.profile.bundles`,重启应用。
package/client.js CHANGED
@@ -148,9 +148,29 @@
148
148
  ".wsr-handoff-option-desc{font-size:11px;color:var(--dsw-alias-label-tertiary)}",
149
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
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)}",
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))}",
152
- ".wsr-handoff-head{font-size:12px;color:var(--dsw-alias-label-secondary)}",
153
- ".wsr-handoff-actions{display:flex;gap:6px;align-items:center;white-space:nowrap}",
151
+ ".wsr-qcard{width:100%;max-width:var(--dsh-chat-content-width,100%);border-radius:var(--dsw-radius-xl,16px);background:var(--dsw-specific-input-major,var(--dsw-alias-bg-layer-2));box-shadow:var(--dsw-elevation-panel,0 8px 24px rgba(0,0,0,.35));color:var(--dsw-alias-label-primary);display:flex;flex-direction:column;padding:0 0 10px;margin:8px 0;overflow:hidden}",
152
+ ".wsr-qcard *{box-sizing:border-box}",
153
+ ".wsr-qhead{display:flex;align-items:flex-start;gap:8px;padding:14px 16px 8px}",
154
+ ".wsr-qheading{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}",
155
+ ".wsr-qeyebrow{font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.04em}",
156
+ ".wsr-qtitle{font-size:15px;font-weight:500;line-height:22px;color:var(--dsw-alias-label-primary)}",
157
+ ".wsr-qdetail{font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary)}",
158
+ ".wsr-qicon{flex:none;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:12px;cursor:pointer;padding:2px 6px;border-radius:6px}",
159
+ ".wsr-qicon:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08));color:var(--dsw-alias-label-primary)}",
160
+ ".wsr-qoptions{display:flex;flex-direction:column;gap:1px;margin:8px 0 0;padding:4px 12px}",
161
+ ".wsr-qoption{display:flex;align-items:flex-start;gap:8px;width:100%;min-height:40px;padding:8px 12px 8px 8px;border:1px solid transparent;border-radius:var(--dsw-radius-md,8px);background:transparent;color:inherit;text-align:left;cursor:pointer;font:inherit;transition:background-color .12s,border-color .12s}",
162
+ ".wsr-qoption:hover,.wsr-qoption-selected{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}",
163
+ ".wsr-qoption-selected{border-color:var(--dsw-alias-border-l2,rgba(255,255,255,.16))}",
164
+ ".wsr-qnum{flex:none;width:18px;font-size:12px;line-height:20px;color:var(--dsw-alias-label-tertiary);text-align:center}",
165
+ ".wsr-qtext{display:flex;flex-direction:column;gap:2px;min-width:0}",
166
+ ".wsr-qextra{padding:4px 16px 0}",
167
+ ".wsr-qpreview{margin:8px 16px 0;padding:8px 10px;border-radius:8px;background:var(--dsw-alias-bg-layer-1,rgba(0,0,0,.24));white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.6;max-height:220px;overflow:auto}",
168
+ ".wsr-qfooter{display:flex;align-items:center;justify-content:flex-end;gap:12px;padding:8px 16px 0}",
169
+ ".wsr-qactions{display:flex;align-items:center;gap:8px}",
170
+ ".wsr-qcancel{border:none;background:transparent;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:12px;cursor:pointer;padding:4px 8px;border-radius:6px}",
171
+ ".wsr-qcancel:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}",
172
+ ".wsr-qsubmit{border:none;border-radius:8px;background:var(--dsw-alias-brand-primary,#4f7cff);color:#fff;font:inherit;font-size:12px;font-weight:500;cursor:pointer;padding:6px 14px}",
173
+ ".wsr-qsubmit:hover{filter:brightness(1.06)}",
154
174
  ".wsr-handoff-live{margin:8px 0;font-size:12px;color:var(--dsw-alias-label-tertiary)}",
155
175
  ".wsr-msg-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:4px;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer}",
156
176
  ".wsr-msg-btn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08));color:var(--dsw-alias-label-primary)}",
@@ -299,6 +319,7 @@
299
319
  "handoff.extraPlaceholder": "补充调整意见(填了就按这些要求重写,例如:多写接口约束、少写历史)",
300
320
  "handoff.preview": "查看内容",
301
321
  "handoff.submit": "提交",
322
+ "handoff.eyebrow": "需要你确认",
302
323
  "handoff.regeneratePrompt": "这份交接说明需要重写。请按最初同样的要求再输出一份,同样写进 ```handoff 代码块,路径与要点保持精炼。",
303
324
  "handoff.adjustPrompt": "请按下面的补充要求重写交接说明,保持 ```handoff 代码块格式:",
304
325
  "move.title": "移动到工作区",
@@ -430,6 +451,7 @@
430
451
  "handoff.extraPlaceholder": "Adjustments (if filled, the note is rewritten with them: more constraints, less history, …)",
431
452
  "handoff.preview": "Show note",
432
453
  "handoff.submit": "Submit",
454
+ "handoff.eyebrow": "Needs your decision",
433
455
  "handoff.regeneratePrompt": "Rewrite the handoff note with the same rules as before, again inside a ```handoff block.",
434
456
  "handoff.adjustPrompt": "Rewrite the handoff note following these adjustments, keeping the ```handoff block format:",
435
457
  "move.title": "Move to workspace",
@@ -1949,6 +1971,69 @@
1949
1971
  });
1950
1972
  }
1951
1973
 
1974
+ /** Enter is the only submit path the composer exposes to a plugin. */
1975
+ function pressEnter(editor) {
1976
+ try {
1977
+ var event = new window.KeyboardEvent("keydown", {
1978
+ key: "Enter",
1979
+ code: "Enter",
1980
+ keyCode: 13,
1981
+ which: 13,
1982
+ bubbles: true,
1983
+ cancelable: true,
1984
+ });
1985
+ editor.dispatchEvent(event);
1986
+ return true;
1987
+ } catch (error) {
1988
+ return false;
1989
+ }
1990
+ }
1991
+
1992
+ /** The composer of the open conversation, if it is on screen. */
1993
+ function composerEditor() {
1994
+ if (typeof document === "undefined") return null;
1995
+ var seat = typeof document.querySelector === "function" ? document.querySelector("[data-composer-seat]") : null;
1996
+ if (seat === null || seat === undefined) return null;
1997
+ var editor = null;
1998
+ try { editor = seat.querySelector('[contenteditable="true"]'); } catch (error) { editor = null; }
1999
+ if (editor === null || editor === undefined) {
2000
+ try { editor = seat.querySelector("textarea"); } catch (error) { editor = null; }
2001
+ }
2002
+ return editor === undefined ? null : editor;
2003
+ }
2004
+
2005
+ function editorText(editor) {
2006
+ if (editor === null || editor === undefined) return "";
2007
+ if (editor.tagName === "TEXTAREA" || editor.tagName === "INPUT") return typeof editor.value === "string" ? editor.value : "";
2008
+ return typeof editor.textContent === "string" ? editor.textContent : "";
2009
+ }
2010
+
2011
+ /**
2012
+ * Send the handoff in the Session that was just opened.
2013
+ *
2014
+ * The draft initialises asynchronously: poll until the composer actually holds
2015
+ * the note, press Enter once, then stop. If it never shows up (slow render,
2016
+ * another draft kept) the text simply stays there for a manual Enter.
2017
+ */
2018
+ function autoSendDraft(marker) {
2019
+ if (typeof window === "undefined") return;
2020
+ var tries = 0;
2021
+ function step() {
2022
+ tries += 1;
2023
+ var editor = composerEditor();
2024
+ if (editor !== null) {
2025
+ var text = editorText(editor);
2026
+ if (text.indexOf(marker) !== -1) {
2027
+ try { if (typeof editor.focus === "function") editor.focus(); } catch (error) { /* focus is best effort */ }
2028
+ pressEnter(editor);
2029
+ return;
2030
+ }
2031
+ }
2032
+ if (tries < 40) window.setTimeout(step, 350);
2033
+ }
2034
+ window.setTimeout(step, 400);
2035
+ }
2036
+
1952
2037
  /** Write text into the composer and send it, if the editor is reachable. */
1953
2038
  function sendToSession(text) {
1954
2039
  if (typeof document === "undefined" || typeof text !== "string" || text === "") return false;
@@ -1979,24 +2064,7 @@
1979
2064
  editor.dispatchEvent(new window.Event("input", { bubbles: true }));
1980
2065
  }
1981
2066
  }
1982
- /* Enter is the only submit path the composer exposes to a plugin. If it
1983
- does not take, the card says so and the user presses it themselves. */
1984
- var sent = false;
1985
- try {
1986
- var event = new window.KeyboardEvent("keydown", {
1987
- key: "Enter",
1988
- code: "Enter",
1989
- keyCode: 13,
1990
- which: 13,
1991
- bubbles: true,
1992
- cancelable: true,
1993
- });
1994
- editor.dispatchEvent(event);
1995
- sent = true;
1996
- } catch (error) {
1997
- sent = false;
1998
- }
1999
- return sent;
2067
+ return pressEnter(editor);
2000
2068
  } catch (error) {
2001
2069
  return false;
2002
2070
  }
@@ -2087,6 +2155,7 @@
2087
2155
  try {
2088
2156
  service.startSession(workspaceId, { prompt: prompt, whenDraftExists: "replace" });
2089
2157
  resetHandoff();
2158
+ autoSendDraft(t("handoff.preamble").slice(0, 12));
2090
2159
  return;
2091
2160
  } catch (error) {
2092
2161
  /* fall through */
@@ -2115,10 +2184,10 @@
2115
2184
  /**
2116
2185
  * The handoff question card.
2117
2186
  *
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.
2187
+ * Visual language copied from the Host's own ask-a-question card (the one the
2188
+ * question tool renders): a raised panel with a title, numbered option rows
2189
+ * and one footer of actions. Two mutually exclusive choices plus a free-text
2190
+ * field, which takes precedence when it has content.
2122
2191
  */
2123
2192
  function HandoffTailCard(props) {
2124
2193
  var sessionId = props !== undefined && props !== null && typeof props.sessionId === "string" ? props.sessionId : "";
@@ -2142,73 +2211,70 @@
2142
2211
  }
2143
2212
  if (state.phase !== "ready") return null;
2144
2213
 
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")),
2214
+ function optionRow(id, index, title, description) {
2215
+ return h("button", {
2216
+ type: "button",
2217
+ key: "opt-" + id,
2218
+ className: "wsr-qoption" + (picked === id ? " wsr-qoption-selected" : ""),
2219
+ onClick: function () { setPicked(id); },
2220
+ },
2221
+ h("span", { className: "wsr-qnum" }, String(index)),
2222
+ h("span", { className: "wsr-qtext" },
2223
+ h("span", { className: "wsr-qtitle" }, title),
2224
+ h("span", { className: "wsr-qdetail" }, description),
2156
2225
  ),
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")),
2226
+ );
2227
+ }
2228
+
2229
+ return h("div", { className: "wsr-qcard" },
2230
+ h("div", { className: "wsr-qhead" },
2231
+ h("div", { className: "wsr-qheading" },
2232
+ h("div", { className: "wsr-qeyebrow" }, t("handoff.eyebrow")),
2233
+ h("div", { className: "wsr-qtitle" }, t("handoff.found")),
2168
2234
  ),
2169
- ),
2170
- h("textarea", {
2171
- className: "wsr-handoff-extra",
2172
- key: "extra",
2173
- placeholder: t("handoff.extraPlaceholder"),
2174
- value: extra,
2175
- onChange: function (event) { setExtra(event.target.value); },
2176
- }),
2177
- h("div", { className: "wsr-handoff-actions", key: "actions" },
2178
2235
  h("button", {
2179
2236
  type: "button",
2180
- className: "wsr-btn",
2237
+ className: "wsr-qicon",
2238
+ title: t("handoff.preview"),
2181
2239
  onClick: function () {
2182
- if (extra.trim() !== "") { rewriteHandoff(sessionId, extra); return; }
2183
- if (picked === "redo") { rewriteHandoff(sessionId, ""); return; }
2184
- carryHandoff(sessionId, state.block);
2185
- },
2186
- }, t("handoff.submit")),
2187
- h("button", {
2188
- type: "button",
2189
- className: "wsr-btn",
2190
- onClick: function () { resetHandoff(); },
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";
2240
+ var body = typeof document !== "undefined" ? document.querySelector('[data-wsr-handoff-preview="' + sessionId + '"]') : null;
2241
+ if (body !== null && body !== undefined && body.style !== undefined) {
2242
+ body.style.display = body.style.display === "none" ? "" : "none";
2199
2243
  }
2200
2244
  },
2201
2245
  }, t("handoff.preview")),
2202
2246
  ),
2203
- ];
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],
2247
+ h("div", { className: "wsr-qoptions" },
2248
+ optionRow("confirm", 1, t("handoff.confirm"), t("handoff.confirmDesc")),
2249
+ optionRow("redo", 2, t("handoff.regen"), t("handoff.regenDesc")),
2250
+ ),
2251
+ h("div", { className: "wsr-qextra" },
2252
+ h("textarea", {
2253
+ className: "wsr-handoff-extra",
2254
+ placeholder: t("handoff.extraPlaceholder"),
2255
+ value: extra,
2256
+ onChange: function (event) { setExtra(event.target.value); },
2257
+ }),
2258
+ ),
2259
+ h("div", { "data-wsr-handoff-preview": sessionId, className: "wsr-qpreview", style: { display: "none" } }, state.block),
2260
+ h("div", { className: "wsr-qfooter" },
2261
+ h("div", { className: "wsr-qactions" },
2262
+ h("button", {
2263
+ type: "button",
2264
+ className: "wsr-qcancel",
2265
+ onClick: function () { resetHandoff(); },
2266
+ }, t("handoff.cancel")),
2267
+ h("button", {
2268
+ type: "button",
2269
+ className: "wsr-qsubmit",
2270
+ onClick: function () {
2271
+ if (extra.trim() !== "") { rewriteHandoff(sessionId, extra); return; }
2272
+ if (picked === "redo") { rewriteHandoff(sessionId, ""); return; }
2273
+ carryHandoff(sessionId, state.block);
2274
+ },
2275
+ }, t("handoff.submit")),
2276
+ ),
2277
+ ),
2212
2278
  );
2213
2279
  }
2214
2280
 
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.21.0";
35
+ export const HOST_VERSION = "0.23.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.21.0",
3
+ "version": "0.23.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",