dsh-rewind-plugin 0.1.5 → 0.1.6
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/lib/client.js +28 -4
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -422,6 +422,23 @@ function hiddenSeqsOf(session) {
|
|
|
422
422
|
}
|
|
423
423
|
return hidden;
|
|
424
424
|
}
|
|
425
|
+
function hideMarkerRows(hidden) {
|
|
426
|
+
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
|
|
427
|
+
const rows = [];
|
|
428
|
+
while (walker.nextNode()) {
|
|
429
|
+
const text = walker.currentNode.textContent ?? "";
|
|
430
|
+
if (!text.includes(MARKER_TEXT)) continue;
|
|
431
|
+
let el2 = walker.currentNode.parentElement;
|
|
432
|
+
while (el2 !== null && el2 !== document.body && el2.dataset?.chatAnchorKey === void 0 && el2.dataset?.chatFlowKind === void 0 && !el2.classList.contains("dsh-rewind-popover")) {
|
|
433
|
+
el2 = el2.parentElement;
|
|
434
|
+
}
|
|
435
|
+
if (el2 !== null && el2 !== document.body && !hidden.has(el2)) rows.push(el2);
|
|
436
|
+
}
|
|
437
|
+
for (const row of rows) {
|
|
438
|
+
row.style.display = "none";
|
|
439
|
+
hidden.add(row);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
425
442
|
function apply(ctx) {
|
|
426
443
|
ctx.effect(function* () {
|
|
427
444
|
yield ctx.locale.register(NS, { zh, en });
|
|
@@ -485,24 +502,31 @@ function apply(ctx) {
|
|
|
485
502
|
}
|
|
486
503
|
const session = sessionFor();
|
|
487
504
|
const hiddenSeqs = session !== void 0 ? hiddenSeqsOf(session) : /* @__PURE__ */ new Set();
|
|
505
|
+
let hiddenCount = 0;
|
|
488
506
|
for (const seat of document.querySelectorAll(CHAT_SEAT_SELECTOR)) {
|
|
489
507
|
const key = seat.dataset.chatAnchorKey;
|
|
490
508
|
const anchor = key !== void 0 && session !== void 0 ? session.getSnapshot().chat.nodes.get(key)?.anchorSeq : void 0;
|
|
491
|
-
|
|
492
|
-
if (anchor !== void 0 && hiddenSeqs.has(anchor) || isMarker) {
|
|
509
|
+
if (anchor !== void 0 && hiddenSeqs.has(anchor)) {
|
|
493
510
|
seat.style.display = "none";
|
|
494
511
|
hidden.add(seat);
|
|
495
|
-
|
|
512
|
+
hiddenCount += 1;
|
|
513
|
+
} else if (hidden.has(seat) && !seat.textContent?.includes(MARKER_TEXT)) {
|
|
496
514
|
seat.style.display = "";
|
|
497
515
|
hidden.delete(seat);
|
|
498
516
|
}
|
|
499
517
|
}
|
|
518
|
+
hideMarkerRows(hidden);
|
|
519
|
+
if (hiddenSeqs.size > 0 || hiddenCount > 0) {
|
|
520
|
+
console.info(
|
|
521
|
+
`[dsh-rewind] hiding: ${hiddenCount} rows, seqs [${[...hiddenSeqs].slice(0, 20).join(", ")}${hiddenSeqs.size > 20 ? "\u2026" : ""}]`
|
|
522
|
+
);
|
|
523
|
+
}
|
|
500
524
|
for (const seat of document.querySelectorAll(USER_SEAT_SELECTOR)) {
|
|
501
525
|
if (!hidden.has(seat)) attach(seat);
|
|
502
526
|
}
|
|
503
527
|
};
|
|
504
528
|
observer = new MutationObserver(scan);
|
|
505
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
529
|
+
observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["style"] });
|
|
506
530
|
scan();
|
|
507
531
|
yield () => {
|
|
508
532
|
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.6",
|
|
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",
|