前言¶
在 DSH 裏跑長對話時,turn、step、token 和上下文佔用往往分散在日誌或內置統計裏,Composer 旁缺少一條可掃一眼、又能展開細看的會話狀態。內置 stats 入口仍在,但若要 uncached/cached、decode 速度、上下文組成條等讀數同屏呈現,通常要自己在客戶端拼投影或改 profile。
下面介紹社區客戶端插件 dsh-status-telemetry(維護者 ags-neto):向 conversation.composer.dock 槽位貢獻獨立的 session status pill,與內置 chat stats 並列;點擊後在原位展開爲 token、性能與上下文面板。數據全部來自宿主已計算的 projection,不做客戶端日誌摺疊、不輪詢、不發起模型調用。
這是什麼¶
dsh-status-telemetry 是 DSH 客戶端插件 bundle(platform: web),在 Composer 停靠區增加一條會話遙測入口。它不替換內置 stats(禁用本 bundle 後 UI 與原先一致)。包名 @local/dsh-status-telemetry,版本 1.0.0,許可證 MIT(見倉庫 package.json)。
界面與讀數¶
收起態¶
單行展示,沿用宿主 typography 與配色,例如:
◔ ● 12 turns · 41 steps · 634k tok · 84% cached · 150 tok/s
圓點 glyph 表示由 decode 速度推導的實時健康度(ok / warn / bad)。
展開態¶
四個區塊:
| 區塊 | 內容 |
|---|---|
| Conversation | turns、steps、吞吐、output tokens |
| Token usage | 總量、billed input、uncached/cached input、cache write、cache-hit 佔比 |
| Performance | LLM 時間、tool 時間、平均首 token、decode 速度、tool 佔比 |
| Context | 窗口占用率、窗口大小、projected/reported prompt,以及 system / tools / messages 組成條 |
當前 profile 缺少某項 capability 時,面板會說明缺失,而不是顯示誤導性的 0。
數據來源¶
讀數經 slot 框架的標準 session kit(useProjection)與 locale 服務注入;bundle 在瀏覽器側僅從模塊表 import react。
| Projection | 所屬包 | 用途 |
|---|---|---|
sessionStats |
@deepseek-ai/dsh-session-stats |
turns、steps、LLM/tool/TTFT/decode 牆鍾時間 |
tokenUsage |
@deepseek-ai/dsh-token-meter |
uncached/cached/cache-write input、output |
contextPressure |
@deepseek-ai/dsh-token-meter |
佔用率、窗口、projected/reported prompt |
contextBreakdown |
@deepseek-ai/dsh-token-meter |
system / tools / messages 組成 |
安裝與啓用¶
插件安裝目標是 DSH profile,不是 /opt/dsh。README 給出的安裝方式是在該主機上執行根目錄腳本(需 root,因 / 只讀時需 remount):
sudo /srv/workspaces/infra/status-telemetry/install.sh
腳本會:臨時 remount / 可寫;將包複製到 $DSH_PROFILE_DIR/node_modules/@local/dsh-status-telemetry;向 dsh.profile.bundles 追加 bundle;恢復屬主;再 remount 只讀。支持 --uninstall,按字節還原 profile 的 package.json。
注意: 僅編輯 bundle 列表。profile 會組合各 bundle 的 dsh.bundle.patch;本包的 cordis.patch.yml 已提供 status-telemetry Loader 行,若在 profile 的 patch 裏重複添加同一行會導致同一 id/priority 二次註冊並拋錯。
安裝後 硬刷新 頁面。profile watcher 會 live 重組;dsh-client-hmr 對 client.js 的編輯約 500 ms 內重載。若槽位未出現,可重啓服務(會輪換 web token,401 時需重新拉取):
sudo systemctl restart dsh.service
卸載示例:
sudo /srv/workspaces/infra/status-telemetry/install.sh --uninstall
典型用法與自測¶
日常用法:在 Composer 停靠區找到新增的 status pill,點擊展開查看四類遙測;內置 stats 入口仍可單獨使用。
倉庫內離線測試(README 示例路徑):
cd /srv/workspaces/infra/status-telemetry
node --test test/client.test.mjs
Node 側無 React 時用 React double 測 formatters 與註冊契約;套件不覆蓋實機 GUI 視覺效果。
適用場景與注意¶
- 適合:需要在 Composer 旁快速查看會話健康度、token 分項、性能與上下文壓力,且希望與內置 stats 並存、可一鍵禁用的 DSH 用戶。
- 分類:客戶端(SkillHub 目錄歸類爲客戶端插件)。
- 權限與安全:安裝腳本以 root 修改 profile 與 remount;插件邏輯在瀏覽器 bundle 中運行,數據來自宿主 projection。安裝前請自行審閱 GitHub 源碼 與 MIT 許可證;路徑
/srv/workspaces/infra/status-telemetry來自上游 README,其他環境需對照倉庫中的install.sh與 profile 佈局調整,勿臆造dsh plugin add github:...類命令(資料未提供)。
設計要點(便於排查):新 id 註冊、不 shadow stats;樣式隨組件掛載爲 <style>,主題僅用 --dsw-* token;不 import Harness 包,僅依賴 react。
結尾¶
dsh-status-telemetry 把 session 遙測收成 Composer 旁一條可展開的 pill,讀數對齊 @deepseek-ai/dsh-session-stats 與 @deepseek-ai/dsh-token-meter 的 projection,改動可逆。目錄與倉庫:
- SkillHub 插件頁:https://www.skillhub.cn/plugins/ags-neto/dsh-status-telemetry
- GitHub:https://github.com/ags-neto/dsh-status-telemetry