@mcd0luo/celes-dsh-thread-rail
v0.1.6
Published
Codex-style thread rail for dsh (Celestea series): a compact vertical selector on the left blank area of the chat, each bar maps to a user conversation and jumps to its start on click
Downloads
1,088
Maintainers
Readme
@mcd0luo/celes-dsh-thread-rail
dsh 聊天左侧“对话灵动选择器”(Codex-style thread rail,Celestea 系列成员)。
在聊天栏左侧空白处显示一列紧凑的小横条:
- 每个横条对应一次用户提问/对话回合;
- 默认所有横条都是短条;
- 鼠标移到某个横条上:当前条变白、变最长,周围横条按距离逐级递减回基准宽度, 同时旁边浮出该条消息的截断预览气泡(最多 3 行,超长省略);
- 点击横条:聊天区滚动到对应对话的开头(该用户消息)。
实现方式
- 不 patch 官方 client bundle:使用官方
conversation.input.dock槽位挂载 (session 作用域,直接拿到完整ConversationSnapshot),再用position: fixed浮动渲染到聊天区左缘。 - 从
session.chat.order+session.chat.nodes过滤kind === "user"得到对话锚点; 点击通过官方 DOM 锚点data-chat-anchor-key定位消息行并滚动。 - Host 半注册
celestea-thread-rail设置命名空间 +/api/thread-rail/status, 可在 设置 → Celestea → thread-rail 调整位置/宽度/间距等,浏览器半启动时读取。
安装
Celestea 系列由基座 @mcd0luo/dsh-celestea 的 bundle 统一挂载(基座补丁给每个
成员预留带条件的挂载行,本包装进 profile 后下次启动自动启用)。
⚠️ 基座必须显式安装一次。
# 1. 一次性:安装基座(设置中心 + 系列挂载点)
dsh plugin --profile web add @mcd0luo/dsh-celestea
# 2. 安装本包,重启后自动挂载
dsh plugin --profile web add @mcd0luo/celes-dsh-thread-rail
# 3. 重启 desk(或 dsh web + 硬刷新)不装基座、单独使用本包时(不推荐),需要手动在
~/.dsh/profiles/web/cordis.patch.yml 添加:
- insert:
- id: thread-rail
name: "@mcd0luo/celes-dsh-thread-rail"走了基座 bundle 路线就不要再加这行,否则 loader 会报
duplicate loader entry id。
配置(设置 → Celestea → thread-rail)
| 字段 | 默认 | 说明 |
|---|---|---|
| enabled | true | 是否启用 |
| position | left-center | left-center / left-bottom |
| offsetX | 16 | 距聊天滚动区左缘偏移(px) |
| offsetY | 0 | 额外垂直偏移(px,正数向下) |
| baseWidth | 12 | 未 hover 基准条宽(px) |
| hoverWidth | 40 | hover 当前条最长宽度(px) |
| falloff | 6 | 每远离一级递减宽度(px) |
| gap | 8 | 条间距(px) |
| snapWidth | 80 | 条右侧横向吸附判定长度(px),空白区也触发 |
| maxItems | 20 | 最多显示条数(超出只显示最近 N 条) |
| minWindowWidth | 960 | 窗口宽度低于该值(px)时隐藏选择条,拉宽后自动恢复 |
开发
npm run build # src/ → lib/(host + client 都生成)
npm publish # 发版后 dsh plugin --profile web update @mcd0luo/celes-dsh-thread-rail兼容性
基于 @deepseek-ai/dsh 0.1.0-rc.6 的 conversation.input.dock 槽位与
data-chat-anchor-key DOM 锚点,属于官方内部契约,后续 dsh 升级可能需要同步。
License
MIT
