@cxx42/dsh-plugin-user-question-nav 1.0.0 → 1.0.1
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 +13 -120
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,129 +1,22 @@
|
|
|
1
|
-
# dsh-plugin-user-question-nav
|
|
1
|
+
# @cxx42/dsh-plugin-user-question-nav
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A DeepSeek Harness **client** plugin that adds a right-side navigation rail to the conversation. It shows one small button per user question, top to bottom; clicking a button scrolls the chat to that question — handy for long sessions, similar to the question-jump rail on chat.deepseek.com.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 包结构
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
dsh-plugin-user-question-nav/
|
|
15
|
-
├── package.json # 桌面 bundle 插件清单(dsh.bundle + dsh.client)
|
|
16
|
-
├── cordis.patch.yml # 客户端行插入示意(本机设为 no-op,见下文“加载方式”)
|
|
17
|
-
├── lib/
|
|
18
|
-
│ ├── index.js # Host 半(空 —— 纯客户端插件)
|
|
19
|
-
│ └── client.js # Client 半(浏览器 bundle,实现导航条)
|
|
20
|
-
├── install.ps1 # 注册到 profile 的幂等脚本(写入无 BOM)
|
|
21
|
-
├── README.md
|
|
22
|
-
└── dynamic-form/ # 备选:动态 Cordis 插件形式(client.js / host.js)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### 关键字段(package.json)
|
|
26
|
-
|
|
27
|
-
- `dsh.bundle.patch: "./cordis.patch.yml"` —— 桌面 bundle 的补丁声明。
|
|
28
|
-
- `dsh.client: { platform: "web", inject: [...] }` —— 使 `client-modules` 节点把本包扫进 `window.__DSH_BOOT__` 的浏览器清单。
|
|
29
|
-
- `exports["."]` → `./lib/index.js`(Host),`exports["./client"]` → `./lib/client.js`(浏览器 bundle)。
|
|
30
|
-
- `peerDependencies`:`react`(平台种子模块)、`@deepseek-ai/dsh-client-runtime`。
|
|
31
|
-
|
|
32
|
-
### 原理
|
|
33
|
-
|
|
34
|
-
- Client 半读取会话快照 `snapshot.chat`(`order` + `nodes`),筛选 `node.kind === "user"` / `"steering"` 的提问,渲染按钮。
|
|
35
|
-
- 点击按钮用 `[data-conversation-scroll]` 与 `[data-chat-anchor-key="<node.key>"]` 计算偏移并 `scrollTo({behavior:"smooth"})`。
|
|
36
|
-
- 挂载在会话级槽位 `conversation.session.header.utilities`(list / session scope),通过 `ctx.slots.inject` 等待槽位声明,避免加载顺序问题。
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## 如何安装(desktop 与 `dsh --port` web 均适用)
|
|
41
|
-
|
|
42
|
-
1. **确认包名**:`dsh-plugin-user-question-nav`,本地路径
|
|
43
|
-
`C:/Users/cxx/Documents/DSHWorkspace/dsh_project2/dsh-plugin-user-question-nav`。
|
|
44
|
-
|
|
45
|
-
2. **编辑 profile 清单** `~/.dsh/profiles/desktop/package.json`:
|
|
46
|
-
- 在 `dependencies` 加:
|
|
47
|
-
```json
|
|
48
|
-
"dsh-plugin-user-question-nav": "file:C:/Users/cxx/Documents/DSHWorkspace/dsh_project2/dsh-plugin-user-question-nav"
|
|
49
|
-
```
|
|
50
|
-
- 在 `dsh.profile.bundles` 加:
|
|
51
|
-
```json
|
|
52
|
-
"dsh-plugin-user-question-nav"
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
3. **安装依赖**(在 profile 目录里):
|
|
56
|
-
```pwsh
|
|
57
|
-
Push-Location "$env:USERPROFILE\.dsh\profiles\desktop"
|
|
58
|
-
pnpm install
|
|
59
|
-
Pop-Location
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
4. **在 profile 的用户补丁层 `~/.dsh/profiles/desktop/cordis.patch.yml` 追加客户端行**(见下文“加载方式”,这是生效的**唯一**插入来源):
|
|
63
|
-
```yaml
|
|
64
|
-
- insert:
|
|
65
|
-
- id: ui-user-question-nav
|
|
66
|
-
name: 'dsh-plugin-user-question-nav'
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
5. **重启桌面 / 重新运行 `dsh --port <N>`**,让 profile 在启动时重新组装。
|
|
70
|
-
|
|
71
|
-
> 也可直接运行本目录的安装脚本 `install.ps1`。它会幂等完成上面第 2、3 步(清单编辑 + pnpm 安装),并且**以无 BOM 的 UTF-8 写清单**(历史上 PowerShell 5 的 `Set-Content -Encoding UTF8` 会写 BOM,导致桌面 `JSON.parse` 崩溃)。
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## 重要:本机加载方式与“副本同步”(已踩过的坑)
|
|
76
|
-
|
|
77
|
-
### 唯一插入来源 = profile 用户补丁层
|
|
78
|
-
|
|
79
|
-
在这台 desktop 上,**profile bundle 的 `- insert:` 不会被可靠地推进到浏览器清单**(证据:同样注册在 profile 里的 `dsh-context`、`@linxin666/dsh-web-ui-all` 也没进 `window.__DSH_BOOT__`;它们走的是 `dsh-market` 热挂载的另一条路)。
|
|
80
|
-
|
|
81
|
-
所以本插件的客户端行**只在** `~/.dsh/profiles/desktop/cordis.patch.yml`(用户补丁层,最后合成)里插入一次;而 **bundle 自己的 `cordis.patch.yml` 被置为 no-op**(仅注释,无 `insert`),避免重复。
|
|
82
|
-
|
|
83
|
-
> 如果你在别的部署里 profile bundle 的 `insert` 能正常进图,可以把 bundle 的 `cordis.patch.yml` 恢复为 `- insert:`,并删掉 profile 用户补丁层那行,改成单一来源。
|
|
84
|
-
|
|
85
|
-
### `duplicate loader entry id: ui-user-question-nav` 的成因
|
|
86
|
-
|
|
87
|
-
如果**同时**存在两处 insert(bundle 的 `cordis.patch.yml` + profile 用户补丁层),`dsh --port 3081` 会报:
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
failed to apply loader entry include (cordis:include):
|
|
91
|
-
duplicate loader entry id: ui-user-question-nav
|
|
7
|
+
```powershell
|
|
8
|
+
dsh plugin add @cxx42/dsh-plugin-user-question-nav
|
|
92
9
|
```
|
|
93
10
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### `file:` 依赖是复制,不是符号链接 —— 改代码后要重新同步
|
|
97
|
-
|
|
98
|
-
pnpm 对 `file:` 依赖默认**复制**到 `~/.dsh/profiles/desktop/node_modules/dsh-plugin-user-question-nav`(不是链接)。所以改过工作区里的 `lib/client.js`、`package.json`、`cordis.patch.yml` 后,**必须重新同步副本**:
|
|
99
|
-
|
|
100
|
-
```pwsh
|
|
101
|
-
Push-Location "$env:USERPROFILE\.dsh\profiles\desktop"
|
|
102
|
-
pnpm install # 或用 install.ps1,会重装 file: 依赖并重写清单(无 BOM)
|
|
103
|
-
Pop-Location
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
否则桌面/`dsh` 会继续用旧副本。
|
|
107
|
-
|
|
108
|
-
### 禁用请注意
|
|
109
|
-
|
|
110
|
-
bundle 在 `dsh.profile.bundles` 里是可修改项,可在桌面“插件清单”禁用。但因为客户端行来自 profile 用户补丁层(不在 bundle 的补丁里),**禁用该 bundle 不会移除那行 insert**。要真正关掉导航条,需删掉/注释掉 `~/.dsh/profiles/desktop/cordis.patch.yml` 里那行。
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
## 备选:动态 Cordis 插件形式
|
|
115
|
-
|
|
116
|
-
`dynamic-form/` 里是同一功能的**动态插件**版本(`code.client` / `code.host`),适合用 `cordis_define` + `cordis_run` 即改即用(无需安装/重启)。两者 Client 逻辑一致;动态版用 `styles.insert(css)` 注入样式,桌面 bundle 版按官方 bundle 规范用 `<style>` 标签注入。
|
|
117
|
-
|
|
118
|
-
---
|
|
11
|
+
Then **restart** the desktop (or `dsh --port` web) so the bundle is recomposed. The rail appears on the right once the session has more than one user message.
|
|
119
12
|
|
|
120
|
-
##
|
|
13
|
+
## Requirements / Notes
|
|
121
14
|
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
15
|
+
- It mounts into the chat conversation view (`@deepseek-ai/dsh-client-ui-conversation`), which ships with the base install.
|
|
16
|
+
- Only the already-loaded part of the conversation is navigable; earlier pages aren't reachable until loaded.
|
|
17
|
+
- Pure client plugin — no Host capabilities needed. Styling uses the DSH theme tokens, so it follows light/dark.
|
|
125
18
|
|
|
126
|
-
##
|
|
19
|
+
## How it works
|
|
127
20
|
|
|
128
|
-
-
|
|
129
|
-
-
|
|
21
|
+
- Reads the conversation snapshot (`snapshot.chat`), filters `user` / `steering` nodes, and renders one button per question.
|
|
22
|
+
- On click it scrolls the `[data-conversation-scroll]` container to the matching `[data-chat-anchor-key]` node.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cxx42/dsh-plugin-user-question-nav",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "DeepSeek Harness web plugin: a right-side navigation rail of user-question buttons that scrolls the chat to each user message (like chat.deepseek.com).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|