Skip to content
dsh.fish
Bundle

@yinhe/dsh-message-navigator

A ChatGPT-style message navigator with hover previews for DeepSeek Harness conversations.

Source
yx-yinhe
License
MIT
Updated
Updated 2 days ago

Readme

# DSH Message Navigator

`@yinhe/dsh-message-navigator` 在 DeepSeek Harness 对话左侧增加一条接近 ChatGPT 的紧凑消息导航:

- 索引当前会话中可见的普通用户消息和插话,并按会话顺序绘制标记;
- 导航始终贴在左侧边栏右侧,并随侧栏展开、收起和拖动同步定位;
- 当前视口附近的消息自动高亮,滚动和窗口尺寸变化时同步更新;
- 标记统一左对齐并使用 2px 厚度;普通、当前、悬停标记的宽度比例为 1:1.5:4;
- 标记间距默认固定为 7px,仅在总高度超过聊天视图可用高度时动态压缩;
- 悬停当前标记时,相邻标记按距离依次缩短;
- 鼠标悬停或键盘聚焦时,在原有气泡中显示本轮问答:用户消息支持多行半粗显示,助手回答使用灰色文字;
- 点击后以平滑滚动定位到对应聊天节点,支持键盘操作和屏幕阅读器;
- 能为纯文本、图片、文件和混合附件生成稳定预览;
- 聊天视图打开后自动按 DSH 正式分页接口加载更早历史,直到当前会话的所有用户消息进入导航;
- 仅在聊天视图存在可见消息锚点时显示,切换到任意其他会话视图都会自动隐藏;
- 不替换会话视图,只占用 `conversation.session.header.utilities` 增量 Slot;
- 使用 DSH 主题 token,兼容浅色和深色主题,并适配窄屏。

## 包结构

- `src/core.js`:消息提取、预览与锚点查找的纯函数;
- `src/history.js`:历史分页加载状态判断;
- `src/layout.js`:标记固定间距和高度压缩计算;
- `src/client.js`:可读的 Client 插件源码;
- `lib/client.js`:DSH `dsh.client` 模块加载器可直接消费的浏览器 bundle;
- `lib/index.js`:空 Host half,用于 Cordis Loader 挂载。

## 验证

```powershell
npm test
npm run check
```

## 安装

从 GitHub 安装稳定版:

```sh
dsh plugin --profile web add github:yx-yinhe/dsh-message-navigator#v1.0.2
```

也可以安装最新的 `main` 分支:

```sh
dsh plugin --profile web add github:yx-yinhe/dsh-message-navigator
```

本地开发时可直接安装工作区:

```powershell
dsh plugin --profile web add file:D:/GitHub/dsh-message-navigator
```

`dsh plugin` 会识别 `cordis.patch.yml`,把 `yinhe-message-navigator` 行加入 Profile layer;Host 随后通过 `exports["./client"]` 与 `dsh.client` 声明发现浏览器 bundle。安装后重启对应 Web Profile。

## 插件市场

仓库使用 GitHub 的 `dsh-plugin` topic,可被 DSH 的 `find_dsh_plugin` 市场搜索工具发现。搜索“message navigator”“conversation navigation”或“ChatGPT navigation”即可找到本插件。

## 兼容性

点击定位使用 DSH 聊天视图公开在渲染树上的语义锚点 `data-chat-anchor-key`。若未来 DSH 更改该锚点名称,需要同步更新 `findChatAnchor`。

## 作者

[`yx-yinhe`](https://github.com/yx-yinhe)

Install

dsh plugin --profile web add github:yx-yinhe/dsh-message-navigator

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source