dsh-ws-recency 0.23.2 → 0.24.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 CHANGED
@@ -135,6 +135,8 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
135
135
 
136
136
  交接块按 markdown 围栏解析:**只有独占一行的 ``` 才算结束**,正文里引用「```handoff 块」不会把内容截半(0.23.2 修)。
137
137
 
138
+ 交接块用 `~~~handoff` 围栏(三个波浪线,CommonMark 与反引号等价,展示仍是代码块):正文里提到标记不会切断内容,写了一半的回复也不会被提前抓取;旧的 ```handoff 回复仍兼容。
139
+
138
140
  两处发送都是模拟 Enter:当前会话里先写入、等 250ms 再按回车,并按需再补两次(共 3 次);草稿会话在 14 秒内重试。始终送不出去时文本仍留在输入框,手动回车即可。
139
141
 
140
142
  ## 设置
@@ -173,7 +175,7 @@ dsh plugin --profile <profile> add github:chyxhtc/dsh-ws-recency
173
175
  或固定版本的预构建包:
174
176
 
175
177
  ```powershell
176
- dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.23.2/dsh-ws-recency-0.23.2.tgz
178
+ dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.24.0/dsh-ws-recency-0.24.0.tgz
177
179
  ```
178
180
 
179
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": "我要把这个会话交接给一个新会话继续推进。请按下面的要求输出一份交接说明,写进一个 ```handoff 代码块里,我会原样交给新会话:\n\n1. 只给文档路径和一句话说明「读它为什么」,不要粘贴文档内容;\n2. 文档按重要性排序,标注哪些必读、哪些按需;\n3. 包含:目标、当前进度、尚未完成与下一步、关键决策与约束、踩过的坑、验证方式;\n4. 交接正文控制在 400 字以内(文档引用除外)。",
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": "这份交接说明需要重写。请按最初同样的要求再输出一份,同样写进 ```handoff 代码块,路径与要点保持精炼。",
324
- "handoff.adjustPrompt": "请按下面的补充要求重写交接说明,保持 ```handoff 代码块格式:",
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 ```handoff code block, 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).",
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 ```handoff block.",
456
- "handoff.adjustPrompt": "Rewrite the handoff note following these adjustments, keeping the ```handoff block format:",
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.",
@@ -2133,19 +2133,38 @@
2133
2133
  return blocks;
2134
2134
  }
2135
2135
 
2136
- function handoffBlockOf(text) {
2137
- if (typeof text !== "string") return "";
2138
- var blocks = fencedBlocks(text);
2139
- for (var i = 0; i < blocks.length; i += 1) {
2140
- if (blocks[i].label === "handoff") return blocks[i].body;
2141
- }
2142
- /* A reply that forgot the label still counts if it reads like the note. */
2143
- for (var j = 0; j < blocks.length; j += 1) {
2144
- if (blocks[j].body.indexOf("#") !== -1) return blocks[j].body;
2145
- }
2146
- return "";
2147
- }
2148
-
2136
+ /**
2137
+ * Pull the handoff block out of an assistant reply.
2138
+ *
2139
+ * Both fence kinds are read: the prompt asks for `~~~handoff` (three tildes
2140
+ * rarely appear in prose), `' + '```handoff` stays supported for older replies.
2141
+ * A fence only counts when it owns its line and is closed by the same kind,
2142
+ * so a note that mentions the marker in a sentence cannot cut itself short,
2143
+ * and a reply that is still streaming is not captured half-written.
2144
+ */
2145
+ function handoffBlockOf(text) {
2146
+ if (typeof text !== "string") return "";
2147
+ var bodyOf = function (openedAt, openedLength, mark) {
2148
+ var closer = new RegExp("^[ \\t]*" + mark + "[ \\t]*$", "m");
2149
+ var rest = text.slice(openedAt + openedLength);
2150
+ var closed = closer.exec(rest);
2151
+ if (closed === null) return "";
2152
+ return rest.slice(0, closed.index).replace(/^\r?\n/, "").trim();
2153
+ };
2154
+ var tagged = /^[ \t]*(```|~~~)[ \t]*handoff[ \t]*$/m.exec(text);
2155
+ if (tagged !== null) return bodyOf(tagged.index, tagged[0].length, tagged[1]);
2156
+ var fence = /^[ \t]*(```|~~~)[ \t]*[a-zA-Z0-9_-]*[ \t]*$/gm;
2157
+ var opened;
2158
+ while ((opened = fence.exec(text)) !== null) {
2159
+ var candidate = bodyOf(opened.index, opened[0].length, opened[1]);
2160
+ if (candidate !== "" && candidate.indexOf("#") !== -1) return candidate;
2161
+ var next = text.indexOf("\n", opened.index + opened[0].length);
2162
+ if (next === -1) return "";
2163
+ fence.lastIndex = next + 1;
2164
+ }
2165
+ return "";
2166
+ }
2167
+
2149
2168
  /** Start the watch: the next reply that carries a handoff block becomes the card. */
2150
2169
  function watchHandoff(sessionId) {
2151
2170
  handoffSession = sessionId;
@@ -2165,7 +2184,8 @@
2165
2184
  setHandoffState({ sessionId: sessionId, phase: "ready", block: found, needsEnter: false });
2166
2185
  return;
2167
2186
  }
2168
- handoffBaseline = replies;
2187
+ /* Keep looking at this same reply: it may still be streaming, and a
2188
+ reply without a block is not a reason to move past it. */
2169
2189
  }
2170
2190
  }
2171
2191
  if (handoffTries > 150) {
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.23.2";
35
+ export const HOST_VERSION = "0.24.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.23.2",
3
+ "version": "0.24.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",