dsh-rewind-plugin 0.1.3 → 0.1.4
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 +2 -2
- package/lib/client.js +16 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
DeepSeek Harness 插件:**同一会话窗口的 in-place 对话回退**(Claude Code `/rewind` 语义)。主交互为**用户消息旁的「回退」按钮**,点击后选择回退模式;命令仅作辅助。
|
|
4
4
|
|
|
5
|
-
> 状态:v0.1.
|
|
5
|
+
> 状态:v0.1.4 已实现并发布(`dsh-rewind-plugin`,npm + GitHub Actions Trusted Publishing)。交互以 Claude Code 行为为参考,并贴合 dsh Web 实际 UI(利用现有 DOM 锚点与运行时快照,纯插件、不改仓库核心)。
|
|
6
6
|
|
|
7
|
-
## 实现状态(v0.1.
|
|
7
|
+
## 实现状态(v0.1.4)
|
|
8
8
|
|
|
9
9
|
- ✅ host 端 `/rewind` 命令(两步文本引导 + 直接执行 + `preview` 影响清单)
|
|
10
10
|
- ✅ host 端变更台账(`tools/execute` 捕获 before、`tools/post-execute` 提交),按会话隔离
|
package/lib/client.js
CHANGED
|
@@ -387,7 +387,12 @@ var NS = "rewind";
|
|
|
387
387
|
var USER_SEAT_SELECTOR = '[data-chat-flow-kind="user"]';
|
|
388
388
|
var CHAT_SEAT_SELECTOR = "[data-chat-anchor-key]";
|
|
389
389
|
var ACTIONS_ROOT_SELECTOR = "[data-time-hover-root]";
|
|
390
|
-
var
|
|
390
|
+
var MARKER_TEXT = "__DSH_REWIND__";
|
|
391
|
+
function targetOfOutcome(text) {
|
|
392
|
+
if (text === void 0) return void 0;
|
|
393
|
+
const match = text.match(/seq (\d+)/);
|
|
394
|
+
return match !== null ? Number(match[1]) : void 0;
|
|
395
|
+
}
|
|
391
396
|
function messagePreviewOf(node) {
|
|
392
397
|
return node.content.map((block) => block.type === "text" && typeof block.text === "string" ? block.text : "").join("").replace(/\s+/g, " ").trim().slice(0, 80);
|
|
393
398
|
}
|
|
@@ -397,19 +402,14 @@ function hiddenSeqsOf(session) {
|
|
|
397
402
|
let latest = null;
|
|
398
403
|
for (const key of snap.chat.order) {
|
|
399
404
|
const node = snap.chat.nodes.get(key);
|
|
400
|
-
if (node === void 0) continue;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
if (match !== null) {
|
|
409
|
-
hidden.add(user.seq);
|
|
410
|
-
const target = Number(match[1]);
|
|
411
|
-
if (latest === null || user.seq > latest.marker) latest = { marker: user.seq, target };
|
|
412
|
-
}
|
|
405
|
+
if (node === void 0 || node.kind !== "command") continue;
|
|
406
|
+
const command = node.data;
|
|
407
|
+
if (command.name !== "rewind") continue;
|
|
408
|
+
hidden.add(command.seq);
|
|
409
|
+
const marker = command.outcome?.sourceEventSeq;
|
|
410
|
+
const target = targetOfOutcome(command.outcome?.text);
|
|
411
|
+
if (marker !== void 0 && target !== void 0 && (latest === null || marker > latest.marker)) {
|
|
412
|
+
latest = { marker, target };
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
if (latest !== null) {
|
|
@@ -488,7 +488,8 @@ function apply(ctx) {
|
|
|
488
488
|
for (const seat of document.querySelectorAll(CHAT_SEAT_SELECTOR)) {
|
|
489
489
|
const key = seat.dataset.chatAnchorKey;
|
|
490
490
|
const anchor = key !== void 0 && session !== void 0 ? session.getSnapshot().chat.nodes.get(key)?.anchorSeq : void 0;
|
|
491
|
-
|
|
491
|
+
const isMarker = anchor === void 0 && seat.textContent?.includes(MARKER_TEXT) === true;
|
|
492
|
+
if (anchor !== void 0 && hiddenSeqs.has(anchor) || isMarker) {
|
|
492
493
|
seat.style.display = "none";
|
|
493
494
|
hidden.add(seat);
|
|
494
495
|
} else if (hidden.has(seat)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-rewind-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "DeepSeek Harness plugin: in-place conversation rewind in the same session window (Claude Code /rewind semantics) with optional workspace file restore",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|