dsh-statusbar
为 DeepSeek Harness Web 打造的 VSCode 风格底部状态条:展示当前对话用量、宿主机 CPU/内存,以及实时生成速率——每个项目都可配置。
!DSH Web !License  
English | 简体中文
功能
- 24px 底部状态条(
shell.overlay席位渲染);应用主框架预留底部空间,页面内容(侧栏设置、输入框)永不被遮挡。 - 内置项目(每一项都可单独配置,见[配置](#配置)):
- DSH 品牌标识(左侧) - ⧉ Tokens — 当前对话估算 Token(tokenMeter) - 7 轮 · 64 步 — 会话轮数 / 步数(sessionStats) - LLM 14m12s · 工具调用 48.4s — LLM / 工具调用累计耗时 - 首 token 平均 1.3s · 129 tok/s — 首 token 平均耗时与生成速率 - 缓存命中 97% — 提示词侧缓存命中率(tokenUsage) - 输入 7.4M tok · 输出 98.9K tok — 计费侧累计输入 / 输出 token - TPS 363 tok/s — 实时生成速率(liveTokenUsage,需安装 [dsh-live-stats])
| - `CPU 20% [ | ]` — Linux 风格字符进度条(绿 → 黄 → 红渐变) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| - `MEM 55% (8.2G/14.8G) [ | ]` — 内存占用 + 字符进度条 |
- 宿主机时钟
- 隐藏输入框下方原有的统计行与 TPS 行(状态条已包含,避免重复)。
- 每 2 秒轮询
/dsh-statusbar/snapshot?session=<id>。
[dsh-live-stats]: https://github.com/zhu1090093659/dsh-web-ui
安装
前置条件:已安装 DSH 且存在 web profile(例如 dsh web 创建的默认 web profile)。
# 从 GitHub 仓库安装
dsh plugin --profile web add https://github.com/Small-Miao/dsh-statusbar
# 或通过 SSH(本机需已配置 GitHub SSH 访问)
dsh plugin --profile web add git@github.com:Small-Miao/dsh-statusbar.git
# 或本地开发目录
dsh plugin --profile web add /path/to/dsh-statusbar该命令会在 profile 中执行 pnpm add,把插件安装到 ~/.dsh/profiles/web/node_modules, 并自动追加到 dsh.profile.bundles。然后重启 DSH,插件随启动自动挂载,刷新页面即可看到状态条。
> 手动安装(不用 dsh plugin):pnpm --dir ~/.dsh/profiles/web add <路径或地址> 同样可行—— > 本插件就是标准的 dsh.bundle 包。
配置
设置 → 状态栏:切换每个项目的显示与否、位置(左侧 / 右侧)与顺序 (数字越小越靠左),并提供「全部重置」按钮。
配置由宿主保存,持久化到 profile 组合目录旁的 dsh-statusbar-config.json。 HTTP 接口:GET /dsh-statusbar/snapshot?session=<id> 返回 { items, catalog, config }; POST /dsh-statusbar/config 接受 { id, patch }(patch 为 { visible?, align?, order? }, 传 null 表示清除)或 { resetAll: true }。
给其他插件使用的公共 API
宿主侧暴露 statusbar Cordis 服务,其他宿主插件可以注册自己的条目——支持实时文本与字符进度条:
export function apply(ctx) {
const statusbar = ctx.get('statusbar')
if (statusbar === undefined) return // 插件未安装时优雅降级
ctx.effect(() => statusbar.registerItem({
id: 'my.item', // 必填,唯一
order: 15, // 排序,越小越靠左(用户可再配置)
align: 'right', // 'left' | 'right'
label: () => '值', // 静态字符串或惰性函数
style: 'bar', // 'text'(默认)| 'bar'
progress: () => 62, // 0-100,数字或惰性函数(bar 样式)
barChar: '|', // 可选,默认 '|'
barTotal: 10, // 可选,默认 10
color: '#4fc1ff', // 可选,标签颜色
tooltip: '提示', // 可选,悬浮文本
}))
// 另有:statusbar.updateItem(id, patch) / statusbar.removeItem(id) / statusbar.list()
}注册新的数据源
如果你拥有一个实时值(自己的指标、服务读数、投影等),可以用 registerDataSource 把 provide() 回调交给状态条,按自己的刷新节奏取数并渲染为条目(文本或字符进度条):
export function apply(ctx) {
const statusbar = ctx.get('statusbar')
if (statusbar === undefined) return
ctx.effect(() => statusbar.registerDataSource({
id: 'disk.usage', // 必填,唯一——同时也是配置项的 key
order: 55, // 默认位置
align: 'right', // 'left' | 'right'
style: 'bar', // 'text'(默认)| 'bar'
barChar: '|', // 可选,默认 '|'
barTotal: 10, // 可选,默认 10
refreshMs: 5000, // 可选,默认 2000——过期后宿主才会重新调用 provide()
tooltip: '磁盘用量',
provide: async () => ({ // 必填——宿主调用;返回最新值
text: '磁盘 62%',
progress: 62, // 0-100,style 为 'bar' 时生效
color: '#4fc1ff', // 可选
tooltip: '更新的提示', // 可选,覆盖默认 tooltip
}),
}))
// 另有:statusbar.removeDataSource(id)
}数据源与内置条目完全一致:出现在状态条中,也能在「设置 → 状态栏」里开关 / 调整位置; provide() 较慢时,宿主会先渲染最近一次已知值。
开发
git clone https://github.com/Small-Miao/dsh-statusbar
dsh plugin --profile web add ./dsh-statusbar # 或软链进 profilelib/index.js— 宿主侧:statusbar服务、/dsh-statusbar/*HTTP 路由、
node:os 采集 CPU/内存、会话投影(sessionStats / tokenUsage / liveTokenUsage)按会话缓存 4 秒。
lib/client.js— 浏览器侧(__ModuleLoader__bundle):shell.overlay中的状态条
与 settings.section 中的设置页。
布局说明
预留底部空间依赖应用主框架的哈希类名(当前 Web 构建为 .pI_x6G_frame)。 如果 Web 应用重新构建导致 CSS 哈希变化,请同步更新 lib/client.js 中的选择器。
许可证
[MIT](./LICENSE)