Skip to content

dsh-tps

Verified

dsh-tps · v2.1.0 · MIT

Live tokens-per-second readout card for the current DeepSeek Harness session, docked to the sidebar or draggable as a floating card.

Install

dsh plugin add dsh-tps

Confirm the layer applied with dsh --profile default --dump-config — see the install guide.

Source

Tags

Readme

dsh-tps

当前会话的实时 tokens/s 读数卡片。既可以停靠到左侧栏,也可以作为悬浮卡片拖动 ——用卡片右上角的两个按钮切换。

显示什么

  • 实时 t/s:流式输出速度,来自真实的 agent/assistant-stream 增量(滑动窗口, 带分母下限,分片突发时读数不会爆表)。
  • 平均 t/s:从第一个 token 起的整场平均;卡片头部的分段按钮切换「实时 / 平均」。
  • 波形:最近 40 个采样点。
  • 会话列表:每个有读数的会话,标题后面用括号写出它所在的工作区,例如 dsh-tps (dsh-tps);点击某一行即可把读数切到那个会话,不影响当前页面。

固定左侧 / 悬浮

卡片右上角两个按钮决定形态:

  • 左侧:停靠进侧栏底部。卡片跟随侧栏——座位消失时(窄窗口、收起侧栏)临时退回 悬浮位,而不是直接消失。
  • 悬浮:固定在右下角浮动,可整张卡片拖动。

选择记在 localStorage,悬浮位置、折叠状态、实时/平均模式一并记住。

拖动

悬浮态下整张卡都能拖:标题行、数字、波形、空白处都行。只有按钮、分段切换和 会话行不参与拖动(它们是点击目标)。拖动事件挂在 document 上,指针滑出卡片也继续 跟手;刚拖完不会误触发点击。

安装

dsh plugin add TINGOD2006/dsh-tps

然后重启 harness 服务,卡片会出现在侧栏里。无需构建,无运行时依赖。

工作方式

  • lib/tracker.js:按会话维护滑动窗口,数据来自 agent/assistant-stream 与 session/event(回合边界、缓存命中用量)。
  • lib/index.js:订阅上述事件,提供 GET /dsh-tps/state.json 与 GET /dsh-tps/widget.js,并用两条注入路径把卡片塞进页面:结构化的 webserver/index-inject 注入行(Electron 桌面壳)与 ctx.webServer.tapIndex() (Host 自己渲染 index.html 的部署,如 dsh web)。
  • lib/widget.js:每次请求都从磁盘读取,改完刷新页面即可生效,不用重启;页面还在跑 旧版时会显示 ⟳ 提示。

测试

node lib/tracker.test.js

覆盖窗口分母下限、静默衰减、本步生成中读数、block-end 兜底与缓存命中累计,全部注入 固定时间戳,不依赖真实时钟、网络或测试数据。

许可证

MIT