dsh-conversation-navigator 0.1.21 → 0.1.23
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 +12 -2
- package/lib/client.js +46 -9
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# DSH 会话导航插件(dsh-conversation-navigator)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-conversation-navigator)
|
|
4
|
+
[](https://www.npmjs.com/package/dsh-conversation-navigator)
|
|
5
|
+
[](https://github.com/gjj-star/dsh-conversation-navigator)
|
|
6
|
+
[](https://github.com/gjj-star/dsh-conversation-navigator)
|
|
7
|
+
[](https://www.npmjs.com/package/dsh-conversation-navigator)
|
|
8
|
+
[](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
|
|
9
|
+
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
10
|
+
|
|
11
|
+
**DeepSeek Harness(DSH)Web 端会话导航面板**:在对话页**右侧**悬浮展示按轮折叠的对话大纲,点击任意节点平滑跳转,滚动对话时实时高亮当前阅读位置,步次徽标配色与内置"轨迹"视图统一。
|
|
4
12
|
|
|
5
13
|
纯浏览器插件(无宿主行为)、纯 JavaScript、零构建、零 npm 依赖(按钮/Tooltip 复用 DSH 内核 seed 的官方 primitives)。
|
|
6
14
|
|
|
@@ -21,7 +29,7 @@ Codex 风格的 **DeepSeek Harness(DSH)Web 端会话导航面板**:在对话页*
|
|
|
21
29
|
- **位置跟踪**:手动滚动对话时,面板自动高亮并跟随当前正在阅读的轮次
|
|
22
30
|
- **右侧定位**:面板锚定视口右侧,收起/展开左侧边栏时纹丝不动
|
|
23
31
|
- **回到最新 / 全部折叠**:面板底部两个快捷按钮
|
|
24
|
-
- **轨迹配色**:用户/插话 = 业务蓝、上下文 = 成功绿、助手 = 紫罗兰、工具 = 琥珀、压缩 = 中性灰(
|
|
32
|
+
- **轨迹配色**:用户/插话 = 业务蓝、上下文 = 成功绿、助手 = 紫罗兰、工具 = 琥珀、压缩 = 中性灰(与内置轨迹视图一致的 `--dsw` 主题 token,自动适配明暗主题)
|
|
25
33
|
- **DSH 原生风格**:操作按钮复用官方 `Button`/`Tooltip` 组件与官方图标(搜索、关闭);其余操作图标(导航、加载更早、加载全部、回到最新、全部折叠、切换轮次等)为按 DSH 描边风格手绘的内联 SVG,`currentColor` 自动适配明暗主题
|
|
26
34
|
- 切换工作区/会话自动跟随并重建大纲
|
|
27
35
|
|
|
@@ -73,6 +81,8 @@ dsh plugin --profile web add ./dsh-conversation-navigator-<version>.tgz
|
|
|
73
81
|
lib/
|
|
74
82
|
index.js # 宿主侧空入口(纯浏览器插件)
|
|
75
83
|
client.js # 浏览器端完整实现(window.__ModuleLoader__ 模块格式)
|
|
84
|
+
assets/
|
|
85
|
+
screenshots/ # 截图(README 主图 + 市场截图墙)
|
|
76
86
|
cordis.patch.yml # 组合包补丁层(插入插件行)
|
|
77
87
|
example.patch.yml # 手动安装时的补丁示例
|
|
78
88
|
```
|
package/lib/client.js
CHANGED
|
@@ -92,6 +92,7 @@ window.__ModuleLoader__.load({
|
|
|
92
92
|
transition: opacity .18s ease, transform .18s ease;
|
|
93
93
|
}
|
|
94
94
|
.cnvnav-panel-hidden { opacity: 0; transform: translateY(-6px) scale(.985); pointer-events: none; }
|
|
95
|
+
.cnvnav-panel-unplaced { visibility: hidden; }
|
|
95
96
|
.cnvnav-head {
|
|
96
97
|
display: flex; align-items: center; gap: 8px;
|
|
97
98
|
padding: 10px 12px;
|
|
@@ -571,23 +572,59 @@ window.__ModuleLoader__.load({
|
|
|
571
572
|
|
|
572
573
|
React.useEffect(() => {
|
|
573
574
|
if (!snap.open) return;
|
|
575
|
+
let lastKey = null;
|
|
576
|
+
let stableTicks = 0;
|
|
577
|
+
let misses = 0;
|
|
574
578
|
function place() {
|
|
575
579
|
const panel = panelEl;
|
|
576
|
-
if (panel === null) return;
|
|
580
|
+
if (panel === null) return false;
|
|
577
581
|
const vw = document.documentElement.clientWidth || 1000;
|
|
578
582
|
const vh = document.documentElement.clientHeight || 800;
|
|
579
583
|
const sp = document.querySelector("[data-conversation-scroll]");
|
|
580
|
-
const rect = sp !== null ? sp.getBoundingClientRect() : { top: 60, height: vh - 90 };
|
|
581
584
|
const width = 288;
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
585
|
+
if (sp === null) {
|
|
586
|
+
/* 会话视图可能尚未挂载(刷新/重启/切会话时面板先就位);
|
|
587
|
+
非会话页(设置页等)则永远没有该容器。
|
|
588
|
+
连续 15 次(约 6s)仍未出现才回退到视口定位, 否则保持隐藏等待校准。 */
|
|
589
|
+
misses += 1;
|
|
590
|
+
if (misses >= 15) {
|
|
591
|
+
panel.style.left = Math.max(8, vw - width - 12) + "px";
|
|
592
|
+
panel.style.top = Math.max(8, 60) + "px";
|
|
593
|
+
panel.style.maxHeight = Math.round(vh - 90) + "px";
|
|
594
|
+
panel.classList.remove("cnvnav-panel-unplaced");
|
|
595
|
+
return true;
|
|
596
|
+
}
|
|
597
|
+
return false;
|
|
598
|
+
}
|
|
599
|
+
const r = sp.getBoundingClientRect();
|
|
600
|
+
const key = [Math.round(r.top), Math.round(r.height), Math.round(vw), Math.round(vh)].join("|");
|
|
601
|
+
if (key !== lastKey) {
|
|
602
|
+
lastKey = key;
|
|
603
|
+
panel.style.left = Math.max(8, vw - width - 12) + "px";
|
|
604
|
+
panel.style.top = Math.max(8, Math.round(r.top + 8)) + "px";
|
|
605
|
+
panel.style.maxHeight = Math.round(Math.min(r.height - 24, vh - 40)) + "px";
|
|
606
|
+
}
|
|
607
|
+
panel.classList.remove("cnvnav-panel-unplaced");
|
|
608
|
+
return true;
|
|
586
609
|
}
|
|
587
610
|
place();
|
|
611
|
+
/* 每 400ms 复查: 容器出现即校准; 布局连续 3 次无变化后停止 */
|
|
612
|
+
let id = setInterval(() => {
|
|
613
|
+
const before = lastKey;
|
|
614
|
+
if (!place()) return;
|
|
615
|
+
if (lastKey !== null && lastKey === before) {
|
|
616
|
+
stableTicks += 1;
|
|
617
|
+
if (stableTicks >= 3) clearInterval(id);
|
|
618
|
+
} else {
|
|
619
|
+
stableTicks = 0;
|
|
620
|
+
}
|
|
621
|
+
}, 400);
|
|
588
622
|
window.addEventListener("resize", place);
|
|
589
|
-
return () =>
|
|
590
|
-
|
|
623
|
+
return () => {
|
|
624
|
+
clearInterval(id);
|
|
625
|
+
window.removeEventListener("resize", place);
|
|
626
|
+
};
|
|
627
|
+
}, [snap.open, snap.sessionId]);
|
|
591
628
|
|
|
592
629
|
React.useEffect(() => {
|
|
593
630
|
if (!snap.open) return;
|
|
@@ -821,7 +858,7 @@ window.__ModuleLoader__.load({
|
|
|
821
858
|
|
|
822
859
|
return React.createElement("div", {
|
|
823
860
|
ref: (el) => { panelEl = el; },
|
|
824
|
-
className: "cnvnav-panel" + (snap.open ? "" : " cnvnav-panel-hidden"),
|
|
861
|
+
className: "cnvnav-panel cnvnav-panel-unplaced" + (snap.open ? "" : " cnvnav-panel-hidden"),
|
|
825
862
|
role: "complementary",
|
|
826
863
|
"aria-label": "会话导航",
|
|
827
864
|
"aria-hidden": !snap.open,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-conversation-navigator",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.23",
|
|
4
|
+
"description": "DSH(DeepSeek Harness)会话导航插件:按轮折叠的对话大纲面板,支持节点点击跳转、滚动位置高亮与轨迹视图同款配色。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
7
7
|
"deepseek-harness",
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"会话导航"
|
|
15
15
|
],
|
|
16
16
|
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/gjj-star/dsh-conversation-navigator.git"
|
|
20
|
+
},
|
|
17
21
|
"type": "module",
|
|
18
22
|
"main": "lib/index.js",
|
|
19
23
|
"exports": {
|