dsh-ws-recency 0.23.3 → 0.24.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 +6 -6
- package/client.js +184 -54
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -122,22 +122,22 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
|
|
|
122
122
|
|
|
123
123
|
长期会话的上下文迟早会满,被动压缩往往比"换个新会话、带上交接"更差。交接全程在对话里完成,不弹窗:
|
|
124
124
|
|
|
125
|
-
1. 每轮回复底部的动作行(复制 / 点赞 /
|
|
125
|
+
1. 每轮回复底部的动作行(复制 / 点赞 / 分支那一排)或会话「…」菜单 → **交接到新会话**:插件把交接指令直接交给宿主的 Session 控制器发送(`sessions.using` + `session.prompt`),不写输入框、不模拟按键;
|
|
126
126
|
2. 当前会话的 AI 输出一个 ```handoff 代码块——**只写文档路径和要点,不粘贴文档内容**;
|
|
127
127
|
3. 抓到代码块后,**在该轮回复下方**出现一张问询卡片,和工具向用户提问的形态一致:
|
|
128
|
-
- 卡片样式沿用宿主问询卡:标题 + 编号选项 +
|
|
128
|
+
- 卡片样式沿用宿主问询卡:标题 + 编号选项 + 底部动作;**确认,交接到新会话**(默认选中):用宿主的 `connectWorkspace` 在当前工作区建一个空白会话并打开,再把「前言 + 正文」作为它的第一条消息发出去;
|
|
129
129
|
- **不满意,重新生成一版**:让当前会话按同样的要求再写一份;
|
|
130
130
|
- 底部输入框:填写调整意见(例如"多写接口约束、少写历史"),提交后按这些要求重写;
|
|
131
131
|
- 「查看内容」展开只读预览,「放弃交接」收起卡片。
|
|
132
132
|
4. 交接内容另存一份到 `~/.hypers-work/.wsr/handoff/<sessionId>-<时间>.md`。
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
细节想改不用在这里改——新会话里直接说更顺手。轮询最多 5 分钟自动收起。
|
|
135
135
|
|
|
136
136
|
交接块按 markdown 围栏解析:**只有独占一行的 ``` 才算结束**,正文里引用「```handoff 块」不会把内容截半(0.23.2 修)。
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
交接块用 `~~~handoff` 围栏(三个波浪线,CommonMark 与反引号等价,宿主自己的 markdown 解析器就用 `~{3,}` 识别围栏,展示仍是代码块):正文里提到标记不会切断内容,写了一半的回复也不会被提前抓取;旧的 ```handoff 回复仍兼容。
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
发送走宿主 API(0.24.1 起):`ctx.sessions.using(id, …)` 保持会话可寻址,再调 `session.prompt([{type:"text",…}], "queue")`;菜单项也能对不在前台的会话发起交接。只有在 Client 没有 `sessions` 服务时才退回旧路:写入当前会话的输入框、250ms 后按回车、必要时再补两次;目标会话不在屏幕上时不写错输入框,卡片会提示按回车。
|
|
141
141
|
|
|
142
142
|
## 设置
|
|
143
143
|
|
|
@@ -175,7 +175,7 @@ dsh plugin --profile <profile> add github:chyxhtc/dsh-ws-recency
|
|
|
175
175
|
或固定版本的预构建包:
|
|
176
176
|
|
|
177
177
|
```powershell
|
|
178
|
-
dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.
|
|
178
|
+
dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.24.1/dsh-ws-recency-0.24.1.tgz
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
装完把 `dsh-ws-recency` 加进 `~/.hypers-work/profiles/<profile>/package.json` 的 `dsh.profile.bundles`,重启应用。
|
package/client.js
CHANGED
|
@@ -299,7 +299,7 @@
|
|
|
299
299
|
"menu.handoff": "交接到新会话",
|
|
300
300
|
"handoff.title": "会话交接",
|
|
301
301
|
"handoff.note": "交接指令已经放进输入框(或点「复制指令」自己粘),发送后我在这里等 AI 写出交接块;抓到以后可以直接开到新会话。",
|
|
302
|
-
"handoff.instruction": "我要把这个会话交接给一个新会话继续推进。请按下面的要求输出一份交接说明,写进一个
|
|
302
|
+
"handoff.instruction": "我要把这个会话交接给一个新会话继续推进。请按下面的要求输出一份交接说明,写进一个 ~~~handoff 代码块里(三个波浪线 + 语言标记 handoff),我会原样交给新会话:\n\n1. 只给文档路径和一句话说明「读它为什么」,不要粘贴文档内容;\n2. 文档按重要性排序,标注哪些必读、哪些按需;\n3. 包含:目标、当前进度、尚未完成与下一步、关键决策与约束、踩过的坑、验证方式;\n4. 交接正文控制在 400 字以内(文档引用除外)。",
|
|
303
303
|
"handoff.inserted": "交接指令已放进输入框,按回车发送;我会自动抓取回复。",
|
|
304
304
|
"handoff.copyHint": "没能直接写入输入框,请点「复制指令」再粘贴到输入框发送。",
|
|
305
305
|
"handoff.copy": "复制指令",
|
|
@@ -320,8 +320,8 @@
|
|
|
320
320
|
"handoff.preview": "查看内容",
|
|
321
321
|
"handoff.submit": "提交",
|
|
322
322
|
"handoff.eyebrow": "需要你确认",
|
|
323
|
-
"handoff.regeneratePrompt": "这份交接说明需要重写。请按最初同样的要求再输出一份,同样写进
|
|
324
|
-
"handoff.adjustPrompt": "请按下面的补充要求重写交接说明,保持
|
|
323
|
+
"handoff.regeneratePrompt": "这份交接说明需要重写。请按最初同样的要求再输出一份,同样写进 ~~~handoff 代码块,路径与要点保持精炼。",
|
|
324
|
+
"handoff.adjustPrompt": "请按下面的补充要求重写交接说明,保持 ~~~handoff 代码块格式:",
|
|
325
325
|
"move.title": "移动到工作区",
|
|
326
326
|
"move.warning": "只移动会话本身:它在旧工作区里创建或修改的文件不会跟着走,仍留在原目录。",
|
|
327
327
|
"move.note": "会话属于哪个工作区,由它创建时的目录决定;移动会改写会话记录的 cwd,把日志搬到新工作区目录,旧日志备份在 .trash/ws-recency。",
|
|
@@ -431,7 +431,7 @@
|
|
|
431
431
|
"menu.handoff": "Hand off to a new session",
|
|
432
432
|
"handoff.title": "Session handoff",
|
|
433
433
|
"handoff.note": "The instruction is in the composer (or copy it yourself). Once you send it I watch for the handoff block and can carry it into a fresh Session.",
|
|
434
|
-
"handoff.instruction": "I am handing this session over to a new one. Please answer with a handoff note inside a
|
|
434
|
+
"handoff.instruction": "I am handing this session over to a new one. Please answer with a handoff note inside a ~~~handoff code block (three tildes, tagged handoff), which I will pass on verbatim:\n\n1. Reference documents by path with one line on why to read them; never paste document contents.\n2. Order them by importance and mark which are required and which are optional.\n3. Cover: goal, current progress, remaining work and next step, key decisions and constraints, pitfalls, and how to verify.\n4. Keep the note under 400 words (references excluded).",
|
|
435
435
|
"handoff.inserted": "Instruction placed in the composer; press Enter and I will pick up the reply.",
|
|
436
436
|
"handoff.copyHint": "Could not write into the composer; copy the instruction and paste it yourself.",
|
|
437
437
|
"handoff.copy": "Copy instruction",
|
|
@@ -452,8 +452,8 @@
|
|
|
452
452
|
"handoff.preview": "Show note",
|
|
453
453
|
"handoff.submit": "Submit",
|
|
454
454
|
"handoff.eyebrow": "Needs your decision",
|
|
455
|
-
"handoff.regeneratePrompt": "Rewrite the handoff note with the same rules as before, again inside a
|
|
456
|
-
"handoff.adjustPrompt": "Rewrite the handoff note following these adjustments, keeping the
|
|
455
|
+
"handoff.regeneratePrompt": "Rewrite the handoff note with the same rules as before, again inside a ~~~handoff block.",
|
|
456
|
+
"handoff.adjustPrompt": "Rewrite the handoff note following these adjustments, keeping the ~~~handoff block format:",
|
|
457
457
|
"move.title": "Move to workspace",
|
|
458
458
|
"move.warning": "Only the session moves: files it created or changed in the old workspace stay where they are.",
|
|
459
459
|
"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.",
|
|
@@ -1956,11 +1956,62 @@
|
|
|
1956
1956
|
var handoffTries = 0;
|
|
1957
1957
|
var handoffSession = null;
|
|
1958
1958
|
|
|
1959
|
+
/** Retention-source tag the Host books this plugin's borrows under. */
|
|
1960
|
+
var HANDOFF_SOURCE = "dsh-ws-recency";
|
|
1961
|
+
|
|
1959
1962
|
/** The instruction the user sends to the current Session. */
|
|
1960
1963
|
function handoffInstruction() {
|
|
1961
1964
|
return t("handoff.instruction");
|
|
1962
1965
|
}
|
|
1963
1966
|
|
|
1967
|
+
/** The Host's session service, when this Client provides it. */
|
|
1968
|
+
function sessionsService() {
|
|
1969
|
+
var ctx = data.ctx;
|
|
1970
|
+
if (ctx === null || ctx === undefined || typeof ctx.get !== "function") return null;
|
|
1971
|
+
var sessions;
|
|
1972
|
+
try { sessions = ctx.get("sessions"); } catch (error) { sessions = undefined; }
|
|
1973
|
+
return sessions === undefined ? null : sessions;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
/**
|
|
1977
|
+
* Send one prompt through the Host's own Session controller.
|
|
1978
|
+
*
|
|
1979
|
+
* The composer path further down is a synthetic key event: it depends on
|
|
1980
|
+
* the editor being mounted, focused, and on the insert and the key landing
|
|
1981
|
+
* in different frames. The Session controller owns a real prompt call, so
|
|
1982
|
+
* a plugin can retain the session, wait until it is open, and hand the text
|
|
1983
|
+
* over - no DOM, no key events, and it works for a session that is not the
|
|
1984
|
+
* one on screen (the "..." menu starts a handoff that way).
|
|
1985
|
+
*
|
|
1986
|
+
* @param sessionId - target Session.
|
|
1987
|
+
* @param text - prompt text, sent as one text block.
|
|
1988
|
+
* @param onUnsent - called when the prompt could not be dispatched.
|
|
1989
|
+
* @returns true when a request was dispatched (its promise may still fail).
|
|
1990
|
+
*/
|
|
1991
|
+
function promptSession(sessionId, text, onUnsent) {
|
|
1992
|
+
var sessions = sessionsService();
|
|
1993
|
+
if (sessions !== null && typeof sessions.using === "function") {
|
|
1994
|
+
try {
|
|
1995
|
+
sessions.using(sessionId, { source: HANDOFF_SOURCE }, function (reference) {
|
|
1996
|
+
var binding = reference === null || reference === undefined ? undefined : reference.binding;
|
|
1997
|
+
var session = binding === null || binding === undefined ? undefined : binding.session;
|
|
1998
|
+
if (session === undefined || session === null || typeof session.prompt !== "function") throw new Error("session unavailable");
|
|
1999
|
+
return Promise.resolve(session.prompt([{ type: "text", text: text }], "queue")).then(function (result) {
|
|
2000
|
+
if (result !== null && result !== undefined && result.ok === false) throw new Error("the session refused the prompt");
|
|
2001
|
+
return result;
|
|
2002
|
+
});
|
|
2003
|
+
}).catch(function () {
|
|
2004
|
+
if (typeof onUnsent === "function") onUnsent();
|
|
2005
|
+
});
|
|
2006
|
+
return true;
|
|
2007
|
+
} catch (error) {
|
|
2008
|
+
/* fall through to the caller's own path */
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
if (typeof onUnsent === "function") onUnsent();
|
|
2012
|
+
return false;
|
|
2013
|
+
}
|
|
2014
|
+
|
|
1964
2015
|
function handoffPost(payload) {
|
|
1965
2016
|
return fetch("/ws-recency/handoff", {
|
|
1966
2017
|
method: "POST",
|
|
@@ -2078,9 +2129,12 @@
|
|
|
2078
2129
|
}, attempt === 0 ? 250 : 800);
|
|
2079
2130
|
}
|
|
2080
2131
|
|
|
2081
|
-
/**
|
|
2082
|
-
function
|
|
2083
|
-
if (typeof document === "undefined"
|
|
2132
|
+
/** Fallback: write into the open composer and press Enter until it leaves. */
|
|
2133
|
+
function sendThroughComposer(sessionId, text) {
|
|
2134
|
+
if (typeof document === "undefined") return false;
|
|
2135
|
+
/* Never write into another conversation's composer: the open editor
|
|
2136
|
+
belongs to the session on screen, not to the target id. */
|
|
2137
|
+
if (currentConversationId() !== sessionId) return false;
|
|
2084
2138
|
var editor = composerEditor();
|
|
2085
2139
|
if (editor === null || editor === undefined) return false;
|
|
2086
2140
|
if (!writeIntoEditor(editor, text)) return false;
|
|
@@ -2088,6 +2142,24 @@
|
|
|
2088
2142
|
return true;
|
|
2089
2143
|
}
|
|
2090
2144
|
|
|
2145
|
+
/**
|
|
2146
|
+
* Send one prompt to one Session.
|
|
2147
|
+
*
|
|
2148
|
+
* Preferred: the Host's Session controller (see promptSession). Only when
|
|
2149
|
+
* that seam is unavailable does it fall back to writing into the composer
|
|
2150
|
+
* of the session on screen and pressing Enter; a target that is not on
|
|
2151
|
+
* screen then just reports "press Enter" on the card instead of sending
|
|
2152
|
+
* the instruction into the wrong conversation.
|
|
2153
|
+
*/
|
|
2154
|
+
function sendToSession(sessionId, text) {
|
|
2155
|
+
if (typeof text !== "string" || text === "") return false;
|
|
2156
|
+
var fallback = function () {
|
|
2157
|
+
if (sendThroughComposer(sessionId, text)) return;
|
|
2158
|
+
setHandoffState({ sessionId: sessionId, phase: "running", block: "", needsEnter: true });
|
|
2159
|
+
};
|
|
2160
|
+
return promptSession(sessionId, text, fallback);
|
|
2161
|
+
}
|
|
2162
|
+
|
|
2091
2163
|
function stopHandoffPolling() {
|
|
2092
2164
|
if (handoffTimer !== null && typeof window.clearTimeout === "function") window.clearTimeout(handoffTimer);
|
|
2093
2165
|
handoffTimer = null;
|
|
@@ -2134,35 +2206,33 @@
|
|
|
2134
2206
|
}
|
|
2135
2207
|
|
|
2136
2208
|
/**
|
|
2137
|
-
* Pull the
|
|
2209
|
+
* Pull the handoff block out of an assistant reply.
|
|
2138
2210
|
*
|
|
2139
|
-
*
|
|
2140
|
-
*
|
|
2141
|
-
*
|
|
2142
|
-
*
|
|
2211
|
+
* Both fence kinds are read: the prompt asks for `~~~handoff` (three tildes
|
|
2212
|
+
* rarely appear in prose), `' + '```handoff` stays supported for older replies.
|
|
2213
|
+
* A fence only counts when it owns its line and is closed by the same kind,
|
|
2214
|
+
* so a note that mentions the marker in a sentence cannot cut itself short,
|
|
2215
|
+
* and a reply that is still streaming is not captured half-written.
|
|
2143
2216
|
*/
|
|
2144
2217
|
function handoffBlockOf(text) {
|
|
2145
2218
|
if (typeof text !== "string") return "";
|
|
2146
|
-
var
|
|
2147
|
-
|
|
2148
|
-
var
|
|
2149
|
-
var
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
var fence = /^[ \t]*```[ \t]*[a-zA-Z0-9_-]*[ \t]*$/gm;
|
|
2219
|
+
var bodyOf = function (openedAt, openedLength, mark) {
|
|
2220
|
+
var closer = new RegExp("^[ \\t]*" + mark + "[ \\t]*$", "m");
|
|
2221
|
+
var rest = text.slice(openedAt + openedLength);
|
|
2222
|
+
var closed = closer.exec(rest);
|
|
2223
|
+
if (closed === null) return "";
|
|
2224
|
+
return rest.slice(0, closed.index).replace(/^\r?\n/, "").trim();
|
|
2225
|
+
};
|
|
2226
|
+
var tagged = /^[ \t]*(```|~~~)[ \t]*handoff[ \t]*$/m.exec(text);
|
|
2227
|
+
if (tagged !== null) return bodyOf(tagged.index, tagged[0].length, tagged[1]);
|
|
2228
|
+
var fence = /^[ \t]*(```|~~~)[ \t]*[a-zA-Z0-9_-]*[ \t]*$/gm;
|
|
2157
2229
|
var opened;
|
|
2158
2230
|
while ((opened = fence.exec(text)) !== null) {
|
|
2159
|
-
var
|
|
2160
|
-
|
|
2161
|
-
var
|
|
2162
|
-
if (
|
|
2163
|
-
|
|
2164
|
-
if (body.indexOf("#") !== -1) return body;
|
|
2165
|
-
fence.lastIndex = bodyFrom + ending.index + ending[0].length;
|
|
2231
|
+
var candidate = bodyOf(opened.index, opened[0].length, opened[1]);
|
|
2232
|
+
if (candidate !== "" && candidate.indexOf("#") !== -1) return candidate;
|
|
2233
|
+
var next = text.indexOf("\n", opened.index + opened[0].length);
|
|
2234
|
+
if (next === -1) return "";
|
|
2235
|
+
fence.lastIndex = next + 1;
|
|
2166
2236
|
}
|
|
2167
2237
|
return "";
|
|
2168
2238
|
}
|
|
@@ -2213,44 +2283,88 @@
|
|
|
2213
2283
|
/** The turn action: send the instruction and wait for the block. */
|
|
2214
2284
|
function startHandoff(sessionId) {
|
|
2215
2285
|
if (typeof sessionId !== "string" || sessionId === "") return;
|
|
2216
|
-
|
|
2217
|
-
|
|
2286
|
+
/* The card starts in its "working" state; if the Host refuses the send
|
|
2287
|
+
the fallback flips needsEnter so the card tells the user to press
|
|
2288
|
+
Enter instead of pretending the handoff is running. */
|
|
2289
|
+
setHandoffState({ sessionId: sessionId, phase: "running", block: "", needsEnter: false });
|
|
2290
|
+
sendToSession(sessionId, handoffInstruction());
|
|
2218
2291
|
watchHandoff(sessionId);
|
|
2219
2292
|
}
|
|
2220
2293
|
|
|
2221
|
-
/**
|
|
2294
|
+
/**
|
|
2295
|
+
* Fallback carry: the Host opened a blank session and keeps the note as an
|
|
2296
|
+
* unsent draft (the pre-0.35 behaviour). Only used when the Session
|
|
2297
|
+
* controller seam is missing or the workspace is unknown.
|
|
2298
|
+
*/
|
|
2299
|
+
function startHandoffSession(workspaceId, prompt) {
|
|
2300
|
+
var service = data.service;
|
|
2301
|
+
if (service !== null && service !== undefined && typeof service.startSession === "function") {
|
|
2302
|
+
try {
|
|
2303
|
+
service.startSession(workspaceId, { prompt: prompt, whenDraftExists: "replace" });
|
|
2304
|
+
resetHandoff();
|
|
2305
|
+
autoSendDraft(t("handoff.preamble").slice(0, 12));
|
|
2306
|
+
return true;
|
|
2307
|
+
} catch (error) {
|
|
2308
|
+
/* fall through to the clipboard */
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
try {
|
|
2312
|
+
if (navigator !== undefined && navigator.clipboard !== undefined) navigator.clipboard.writeText(prompt);
|
|
2313
|
+
} catch (error) {
|
|
2314
|
+
/* clipboard unavailable */
|
|
2315
|
+
}
|
|
2316
|
+
resetHandoff();
|
|
2317
|
+
return false;
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
/**
|
|
2321
|
+
* The card carries it over: open a fresh Session in the same workspace and
|
|
2322
|
+
* put the note in as its first prompt through the Host's own API.
|
|
2323
|
+
*
|
|
2324
|
+
* `connectWorkspace` creates (or reuses) the blank and returns its id
|
|
2325
|
+
* without navigating; `sessions.using` retains that session until it is
|
|
2326
|
+
* open, so the prompt is the session's real first message - nothing has to
|
|
2327
|
+
* be typed into a composer and no Enter is synthesised.
|
|
2328
|
+
*/
|
|
2222
2329
|
function carryHandoff(sessionId, block) {
|
|
2223
2330
|
var text = typeof block === "string" ? block.trim() : "";
|
|
2224
2331
|
if (text === "") return;
|
|
2225
2332
|
handoffPost({ action: "save", sessionId: sessionId, text: text }).catch(function () { return null; }).then(function () {
|
|
2226
2333
|
var owner = workspaceOfSession(sessionId);
|
|
2227
|
-
var workspaceId = owner === null ? undefined : owner.workspaceId;
|
|
2334
|
+
var workspaceId = owner === null || owner === undefined ? undefined : owner.workspaceId;
|
|
2228
2335
|
var service = data.service;
|
|
2336
|
+
var sessions = sessionsService();
|
|
2229
2337
|
var prompt = t("handoff.preamble") + "\n\n" + text;
|
|
2230
|
-
if (
|
|
2231
|
-
|
|
2232
|
-
|
|
2338
|
+
if (workspaceId !== undefined
|
|
2339
|
+
&& service !== null && service !== undefined
|
|
2340
|
+
&& typeof service.connectWorkspace === "function"
|
|
2341
|
+
&& typeof service.openSession === "function"
|
|
2342
|
+
&& sessions !== null && typeof sessions.using === "function") {
|
|
2343
|
+
service.connectWorkspace(workspaceId).then(function (newSessionId) {
|
|
2344
|
+
try { service.openSession(newSessionId); } catch (error) { /* the prompt still lands */ }
|
|
2345
|
+
return sessions.using(newSessionId, { source: HANDOFF_SOURCE }, function (reference) {
|
|
2346
|
+
var binding = reference === null || reference === undefined ? undefined : reference.binding;
|
|
2347
|
+
var session = binding === null || binding === undefined ? undefined : binding.session;
|
|
2348
|
+
if (session === undefined || session === null || typeof session.prompt !== "function") throw new Error("session unavailable");
|
|
2349
|
+
return session.prompt([{ type: "text", text: prompt }], "queue");
|
|
2350
|
+
});
|
|
2351
|
+
}).then(function (result) {
|
|
2352
|
+
if (result !== null && result !== undefined && result.ok === false) throw new Error("the session refused the prompt");
|
|
2233
2353
|
resetHandoff();
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
}
|
|
2237
|
-
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
try {
|
|
2241
|
-
if (navigator !== undefined && navigator.clipboard !== undefined) navigator.clipboard.writeText(prompt);
|
|
2242
|
-
} catch (error) {
|
|
2243
|
-
/* clipboard unavailable */
|
|
2354
|
+
}).catch(function () {
|
|
2355
|
+
startHandoffSession(workspaceId, prompt);
|
|
2356
|
+
});
|
|
2357
|
+
return;
|
|
2244
2358
|
}
|
|
2245
|
-
|
|
2359
|
+
startHandoffSession(workspaceId, prompt);
|
|
2246
2360
|
});
|
|
2247
2361
|
}
|
|
2248
2362
|
|
|
2249
2363
|
/** Ask the current Session to rewrite the handoff with the user's adjustments. */
|
|
2250
2364
|
function rewriteHandoff(sessionId, extra) {
|
|
2251
2365
|
var text = extra.trim() === "" ? t("handoff.regeneratePrompt") : t("handoff.adjustPrompt") + "\n\n" + extra.trim();
|
|
2252
|
-
|
|
2253
|
-
|
|
2366
|
+
setHandoffState({ sessionId: sessionId, phase: "running", block: "", needsEnter: false });
|
|
2367
|
+
sendToSession(sessionId, text);
|
|
2254
2368
|
handoffBaseline = 0;
|
|
2255
2369
|
handoffTries = 0;
|
|
2256
2370
|
handoffSession = sessionId;
|
|
@@ -2382,7 +2496,15 @@
|
|
|
2382
2496
|
var Icon = ui.IconDataOutlineRegular;
|
|
2383
2497
|
return h(Item, {
|
|
2384
2498
|
icon: typeof Icon === "function" ? h(Icon, {}) : undefined,
|
|
2385
|
-
onSelect: function () {
|
|
2499
|
+
onSelect: function () {
|
|
2500
|
+
/* Open the conversation first so the running handoff (and later the
|
|
2501
|
+
card) is visible; the prompt itself does not need the composer. */
|
|
2502
|
+
var service = data.service;
|
|
2503
|
+
if (service !== null && service !== undefined && typeof service.openSession === "function") {
|
|
2504
|
+
try { service.openSession(props.sessionId); } catch (error) { /* the send still lands */ }
|
|
2505
|
+
}
|
|
2506
|
+
startHandoff(props.sessionId);
|
|
2507
|
+
},
|
|
2386
2508
|
}, t("menu.handoff"));
|
|
2387
2509
|
}
|
|
2388
2510
|
|
|
@@ -3259,7 +3381,15 @@
|
|
|
3259
3381
|
}
|
|
3260
3382
|
|
|
3261
3383
|
/* Test hook: the card state is a module observable, invisible from outside. */
|
|
3262
|
-
exports.__handoff = {
|
|
3384
|
+
exports.__handoff = {
|
|
3385
|
+
current: currentHandoffState,
|
|
3386
|
+
set: setHandoffState,
|
|
3387
|
+
blockOf: handoffBlockOf,
|
|
3388
|
+
start: startHandoff,
|
|
3389
|
+
rewrite: rewriteHandoff,
|
|
3390
|
+
carry: carryHandoff,
|
|
3391
|
+
send: sendToSession,
|
|
3392
|
+
};
|
|
3263
3393
|
|
|
3264
3394
|
exports.name = "dsh-ws-recency";
|
|
3265
3395
|
exports.inject = inject;
|
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.24.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.
|
|
3
|
+
"version": "0.24.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",
|