secyborg/dsh-command-rail0

dsh-command-rail

DSH web plugin: a Codex-style command-history rail covering the WHOLE session. Walks the full durable history through the official client API (not just the ~50-event window the DOM keeps), so every user instruction gets its tick on the left edge of the conversation; hover previews the instruction, click loads older pages via conversation.loadOlder() and jumps to the message.

包名
dsh-command-rail
版本
0.3.9
许可证
MIT
最近更新
2026年8月25日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:secyborg/dsh-command-rail

dsh-command-rail

Codex 风格的「用户指令历史轨道」插件 for DSH。

会话区左缘出现一列低对比度短横条,每根对应当前会话中的一条用户指令—— 覆盖整个会话的完整历史,而不只是当前渲染出来的最近几十条:

  • 全量数据 — 通过官方客户端 API(connection.api.sessions.history + beforeSeq 翻页)走完整持久历史;DOM 只保留最近 ~50 个事件的窗口,轨道不受此限
  • 悬浮 — 横条变宽变亮,Popover 显示「第 N / M 条指令」+ 指令摘要(取自历史记录, 未加载进 DOM 的旧指令同样有摘要)
  • 点击 — 平滑滚动定位到该条指令;若目标不在当前窗口内,先通过 sessions.scope(id).conversation.loadOlder() 逐页加载更早历史,直到该消息进入 DOM 再跳转并高亮
  • 当前位置 — 阅读位置对应的横条保持品牌色高亮(DOM 行与历史条目按文本签名 对齐,容忍截断差异)
  • 会话切换 — 订阅 sessions 列表自动检测,切换即重走历史
  • 降级 — 历史 API 不可用时退回 DOM 采集模式,轨道不会消失
  • 自适应 — 指令多时逐级压缩条高/间距(最低 2px);超过 400 条时均匀采样

实现要点

  • 渲染行锚定 MessageItem css-module 稳定后缀 [class*="_userRow"]_userStack 子节点双重校验,排除 pending-steering 瞬态行),构建哈希变化不影响识别
  • 仅使用官方服务接口(sessions / connection),不做任何内部 patch
  • 纯逻辑函数全部导出供测试:test/rail-logic.test.mjs(35 项断言)

安装

dsh plugin --profile desktop add dsh-command-rail-0.3.1.tgz

新插件首次安装需要重启 DSH Desktop;已装插件的更新走 HMR 热生效 (版本号不变时 pnpm 会跳过重装,务必升版本号)。

测试

node test/rail-logic.test.mjs