dsh-statusbar:爲 DSH Web 提供可配置底部狀態欄

前言

在 DSH Web 裏,會話 token、輪次、工具耗時、主機 CPU/內存和即時生成速率常散落在不同位置。dsh-statusbar 把這些信息集中到底部狀態欄,讓開發者在不頻繁切頁面的情況下查看當前會話和宿主機狀態。

這是什麼

dsh-statusbar 是 Small-Miao 維護的 DSH 插件,許可證爲 MIT。它爲 DeepSeek Harness Web 提供一個 VSCode 風格的底部狀態欄,用於展示當前會話用量、宿主 CPU/內存和即時生成速率;每個顯示項都可在設置中配置。

核心功能

底部狀態欄佈局

dsh-statusbar 通過 shell.overlay seat 渲染一個 24px 底部欄。應用框架會預留底部空間,避免覆蓋頁面內容,例如側邊設置區和 composer 輸入區。

內置狀態項

內置項目包括:

  • DSH 品牌項
  • 當前會話估算 token
  • 會話輪次 / 步數
  • 累計 LLM / 工具 wall time
  • 首 token 平均與 decode 吞吐
  • prompt 側緩存命中率
  • 計費輸入 / 輸出 token
  • 即時 TPS
  • CPU 字符條
  • MEM 字符條
  • 宿主時鐘

這些項目都可以單獨配置顯示與否、左右位置和順序。

原有狀態行處理

dsh-statusbar 會隱藏 composer 輸入框下方原有的 stats 行和 TPS 行,避免狀態信息重複出現。

配置入口

打開 Settings → 狀態欄,可以:

  • 開關每個項目的顯示
  • 選擇左側或右側對齊
  • 調整順序
  • 使用 reset-all 選項恢復默認

配置保存在宿主側,並持久化到 dsh-statusbar-config.json。

輪詢接口

狀態欄每 2 秒輪詢快照接口。HTTP 接口爲:

  • GET /dsh-statusbar/snapshot?session=<id>:返回 items、catalog 和 config
  • POST /dsh-statusbar/config:接受 id patch 或 resetAll

安裝與啓用

前提是一個帶 web profile 的 DSH 安裝,例如由 dsh web 創建的默認 web profile。

從 GitHub 安裝:

dsh plugin --profile web add https://github.com/Small-Miao/dsh-statusbar

安裝完成後重啓 DSH。插件在啓動時掛載,刷新頁面後底部狀態欄出現。

典型用法

調整狀態項

安裝並重啓後,進入 Settings → 狀態欄。可以按顯示需要關閉不需要的項,把常用項放在左側或右側,並按數值順序調整位置。如果改亂了,使用 reset-all 選項。

在其他插件中註冊狀態項

dsh-statusbar 暴露 statusbar Cordis service。其他宿主插件可以註冊自己的項目:

export function apply(ctx) {
  const statusbar = ctx.get('statusbar')
  if (statusbar === undefined) return

  ctx.effect(() => statusbar.registerItem({
    id: 'my.item',
    order: 15,
    align: 'right',
    label: () => 'value',
    style: 'bar',
    progress: () => 62,
    barChar: '|',
    barTotal: 10,
    color: '#4fc1ff',
    tooltip: 'hint',
  }))
}

示例中的字段包括 id、order、align、label、style、progress、barChar、barTotal、color、tooltip。

註冊即時數據源

如果插件需要展示自己維護的即時值,可以註冊 data source:

export function apply(ctx) {
  const statusbar = ctx.get('statusbar')
  if (statusbar === undefined) return

  ctx.effect(() => statusbar.registerDataSource({
    id: 'disk.usage',
    order: 55,
    align: 'right',
    style: 'bar',
    barChar: '|',
    barTotal: 10,
    refreshMs: 5000,
    tooltip: '磁盤用量',
    provide: async () => ({
      text: '磁盤 62%',
      progress: 62,
      color: '#4fc1ff',
      tooltip: 'updated hint',
    }),
  }))
}

字段包括 id、order、align、style、refreshMs、tooltip、provide。宿主會按自己的刷新節奏調用 provide(),並把返回值作爲狀態欄項目渲染。

適用場景與注意

適合:

  • 使用 DSH Web 的開發者
  • 需要同時查看會話 token、輪次、工具 / LLM 耗時、緩存命中、主機 CPU/內存的用戶
  • 需要在狀態欄中掛載自定義指標的宿主插件作者

注意:

  • 該插件需要 DSH 安裝中存在 web profile。
  • 即時 TPS 項需要 dsh-live-stats。
  • 插件以當前 DSH 進程權限運行,會讀取主機 CPU/內存並暴露狀態欄相關 HTTP 接口。安裝前應檢查源碼與 MIT 許可證。
  • 底部空間佈局依賴當前 web 構建中的應用框架哈希類 .pI_x6G_frame。如果 web app 重建後 CSS hash 變化,可能需要更新 lib/client.js 中的 selector。
  • 本篇未給出明確的 DSH 版本兼容承諾;安裝後建議先在自己的 web profile 中驗證加載和顯示。

結尾

dsh-statusbar 的價值在於把 DSH Web 的會話狀態和宿主機指標收斂到一個可配置的底部欄裏,同時爲其他宿主插件提供註冊入口。

GitHub 倉庫:https://github.com/Small-Miao/dsh-statusbar

DSH 社區目錄是獨立站點,與 DeepSeek / 幻方無官方從屬關係。目錄頁鏈接未在本文覈實材料中給出,可在目錄中按插件名查找。

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜