dsh-ws-recency 0.22.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.
- package/README.md +3 -1
- package/client.js +65 -18
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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.
|
|
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
|
@@ -1971,6 +1971,69 @@
|
|
|
1971
1971
|
});
|
|
1972
1972
|
}
|
|
1973
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
|
+
|
|
1974
2037
|
/** Write text into the composer and send it, if the editor is reachable. */
|
|
1975
2038
|
function sendToSession(text) {
|
|
1976
2039
|
if (typeof document === "undefined" || typeof text !== "string" || text === "") return false;
|
|
@@ -2001,24 +2064,7 @@
|
|
|
2001
2064
|
editor.dispatchEvent(new window.Event("input", { bubbles: true }));
|
|
2002
2065
|
}
|
|
2003
2066
|
}
|
|
2004
|
-
|
|
2005
|
-
does not take, the card says so and the user presses it themselves. */
|
|
2006
|
-
var sent = false;
|
|
2007
|
-
try {
|
|
2008
|
-
var event = new window.KeyboardEvent("keydown", {
|
|
2009
|
-
key: "Enter",
|
|
2010
|
-
code: "Enter",
|
|
2011
|
-
keyCode: 13,
|
|
2012
|
-
which: 13,
|
|
2013
|
-
bubbles: true,
|
|
2014
|
-
cancelable: true,
|
|
2015
|
-
});
|
|
2016
|
-
editor.dispatchEvent(event);
|
|
2017
|
-
sent = true;
|
|
2018
|
-
} catch (error) {
|
|
2019
|
-
sent = false;
|
|
2020
|
-
}
|
|
2021
|
-
return sent;
|
|
2067
|
+
return pressEnter(editor);
|
|
2022
2068
|
} catch (error) {
|
|
2023
2069
|
return false;
|
|
2024
2070
|
}
|
|
@@ -2109,6 +2155,7 @@
|
|
|
2109
2155
|
try {
|
|
2110
2156
|
service.startSession(workspaceId, { prompt: prompt, whenDraftExists: "replace" });
|
|
2111
2157
|
resetHandoff();
|
|
2158
|
+
autoSendDraft(t("handoff.preamble").slice(0, 12));
|
|
2112
2159
|
return;
|
|
2113
2160
|
} catch (error) {
|
|
2114
2161
|
/* fall through */
|
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
|
+
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.
|
|
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",
|