dsh-rewind-plugin 0.1.8 → 0.1.9
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 +33 -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.9 已实现并发布(`dsh-rewind-plugin`,npm + GitHub Actions Trusted Publishing)。交互以 Claude Code 行为为参考,并贴合 dsh Web 实际 UI(利用现有 DOM 锚点与运行时快照,纯插件、不改仓库核心)。
|
|
6
6
|
|
|
7
|
-
## 实现状态(v0.1.
|
|
7
|
+
## 实现状态(v0.1.9)
|
|
8
8
|
|
|
9
9
|
- ✅ host 端 `/rewind` 命令(两步文本引导 + 直接执行 + `preview` 影响清单)
|
|
10
10
|
- ✅ host 端变更台账(`tools/execute` 捕获 before、`tools/post-execute` 提交),按会话隔离
|
package/lib/client.js
CHANGED
|
@@ -501,27 +501,45 @@ function apply(ctx) {
|
|
|
501
501
|
buttons.set(key, button);
|
|
502
502
|
seat.setAttribute(REWIND_ATTACHED, "");
|
|
503
503
|
};
|
|
504
|
+
let lastRewindSeq = -1;
|
|
505
|
+
let hiddenSeqsCache = null;
|
|
504
506
|
const scan = () => {
|
|
505
507
|
for (const [key, button] of buttons) {
|
|
506
508
|
if (!button.isConnected) buttons.delete(key);
|
|
507
509
|
}
|
|
508
510
|
const session = sessionFor();
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
const key
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
seat.style.display = "";
|
|
520
|
-
hidden.delete(seat);
|
|
511
|
+
let newestRewind = -1;
|
|
512
|
+
if (session !== void 0) {
|
|
513
|
+
const snap = session.getSnapshot();
|
|
514
|
+
for (const key of snap.chat.order) {
|
|
515
|
+
const node = snap.chat.nodes.get(key);
|
|
516
|
+
if (node === void 0 || node.kind !== "command") continue;
|
|
517
|
+
const command = node.data;
|
|
518
|
+
if (command.name === "rewind" && command.outcome?.kind === "success" && command.seq > newestRewind) {
|
|
519
|
+
newestRewind = command.seq;
|
|
520
|
+
}
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
|
-
if (
|
|
524
|
-
|
|
523
|
+
if (newestRewind > lastRewindSeq) {
|
|
524
|
+
lastRewindSeq = newestRewind;
|
|
525
|
+
hiddenSeqsCache = session !== void 0 ? hiddenSeqsOf(session) : null;
|
|
526
|
+
if (session !== void 0) fillComposerForRewind(session, filledTargets);
|
|
527
|
+
}
|
|
528
|
+
const hiddenSeqs = hiddenSeqsCache;
|
|
529
|
+
let hiddenCount = 0;
|
|
530
|
+
if (hiddenSeqs !== null && hiddenSeqs.size > 0 && session !== void 0) {
|
|
531
|
+
for (const seat of document.querySelectorAll(CHAT_SEAT_SELECTOR)) {
|
|
532
|
+
const key = seat.dataset.chatAnchorKey;
|
|
533
|
+
const anchor = key !== void 0 ? session.getSnapshot().chat.nodes.get(key)?.anchorSeq : void 0;
|
|
534
|
+
if (anchor !== void 0 && hiddenSeqs.has(anchor)) {
|
|
535
|
+
seat.style.display = "none";
|
|
536
|
+
hidden.add(seat);
|
|
537
|
+
hiddenCount += 1;
|
|
538
|
+
} else if (hidden.has(seat)) {
|
|
539
|
+
seat.style.display = "";
|
|
540
|
+
hidden.delete(seat);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
525
543
|
console.info(
|
|
526
544
|
`[dsh-rewind] hiding: ${hiddenCount} rows, seqs [${[...hiddenSeqs].slice(0, 20).join(", ")}${hiddenSeqs.size > 20 ? "\u2026" : ""}]`
|
|
527
545
|
);
|
|
@@ -546,7 +564,7 @@ function apply(ctx) {
|
|
|
546
564
|
}
|
|
547
565
|
};
|
|
548
566
|
observer = new MutationObserver(scan);
|
|
549
|
-
observer.observe(document.body, { childList: true, subtree: true
|
|
567
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
550
568
|
scan();
|
|
551
569
|
yield () => {
|
|
552
570
|
observer?.disconnect();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-rewind-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
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",
|