Game-style floating HUD: balance HP bar, context MP bar, official peak/valley pricing with countdown, auto-compaction under 5% remaining, and memory-carrying new conversation.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:guoliyuan97-png/dsh-game-hud
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
游戏风格悬浮 HUD 插件(DeepSeek Harness)。
- ❤ 血条:实时显示 DeepSeek 账户余额(官方
user/balance接口),满格金额可配置(默认 ¥20)。 - ✦ 蓝条:当前会话上下文剩余(与官方 UI 同源的
contextPressure投影),随对话增长从满格减少。 - 🚨 低余额告警:余额(血条)低于阈值(默认 10%)时,悬浮窗四周闪烁红光(可配置开关)。
- 🗜️ 折叠迷你视图:折叠后显示紧凑的血条 + 蓝条,随时扫一眼余额与上下文。
- ▲▼ 峰谷定价:官方规则(北京时间周一至周五 09:00–12:00 / 14:00–18:00 为高峰,其余时段含周末全天为空闲时段、价格为高峰的一半),显示当前单价与距下次切换倒计时(每秒跳动)。
- ⚡ 自动压缩:上下文剩余 < 5% 时自动触发
/compact;压缩满 2 轮后出现「开启新对话(携带记忆)」按钮;不点击则继续自动压缩。 - 🔁 携带记忆新对话:点击后用当前模型生成记忆摘要 → 新建会话并注入记忆(不回答旧问题、不丢记忆),新会话上下文重新累计。
配置
所有配置项都有默认值,可通过 DSH 设置 → 插件 → dsh-game-hud 界面编辑(保存后 HUD 实时生效,无需重启),或在 profile 的 cordis.patch.yml 中覆盖:
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
maxBalance |
number | 20 |
血条满格金额(CNY)。余额超过此值显示满格,低于按比例减少 |
lowAlert |
boolean | true |
低余额红光告警开关:余额(血条)低于 lowThreshold 时,悬浮窗四周闪烁红光 |
lowThreshold |
number | 10 |
告警阈值(%)。仅血条触发,蓝条(上下文)不触发 |
priceTable |
object | {} |
可选:按模型覆盖峰谷单价(元/百万 tokens)。未覆盖的模型用内置价格表 |
cordis.patch.yml 示例:
- insert:
- id: game-hud
name: 'dsh-game-hud'
config:
maxBalance: 50
lowAlert: true
lowThreshold: 10
priceTable:
# 官方价(元/百万 tokens),2026-09-10 12:00 起生效
deepseek-v4-flash:
peak: { input: 2.0, output: 8.0, cacheHit: 0.04 }
valley: { input: 1.0, output: 4.0, cacheHit: 0.02 }
实时机制
| 数据 | 刷新机制 | 实时粒度 |
|---|---|---|
| ❤ 血条(余额) | 客户端每 3 秒轮询宿主 → 宿主缓存 30 秒后重查官方余额接口 | 花钱后 ≤30s 内血条下降 |
| ✦ 蓝条(上下文) | 每 3 秒重新测量会话(与官方 UI 同源投影数据) | 每发一条消息就变 |
| ▲▼ 峰谷 + 倒计时 | 峰/谷时段按官方规则即时计算;单价来自内置价格表(可用 priceTable 覆盖) |
时段秒级;单价随插件版本更新 |
| ⚡ 压缩轮数 / 按钮 | 每 3 秒从会话事件日志统计 compaction/end |
压缩完成后 3 秒内出现 |
⚠️ 单价不是实时拉取的:内置价格表写死在
lib/index.js的PRICE_TABLE。官方调价后 HUD 仍会显示旧价,需要更新插件版本(或在设置里用priceTable覆盖)。只有余额(血条)是走官方user/balance接口实时获取的。
数据通道
- 宿主注册三个同源 HTTP 路由:
GET /hud/state?sessionId=<id>— 实时状态:余额 / 上下文 / 峰谷定价 / 压缩轮数 /maxBalancePOST /hud/digest— 用当前模型生成记忆摘要(携带记忆新对话的数据源)POST /hud/seed— 向新会话静默注入记忆(user/messageappend,不触发 agent 回复、不回答旧问题)
- API Key 经宿主
credentials服务解析(默认DEEPSEEK_API_KEY,自动读取llm-deepseek配置中的apiKeyEnv)。 - 客户端以
window.__ModuleLoader__.load()手写格式打包,无需构建器。
安装
方式一:dsh 命令安装(推荐)
dsh plugin --profile web add github:guoliyuan97-png/dsh-game-hud#v1.2.0
安装后重启 DSH:HUD 面板出现在浏览器右下角;配置入口在 设置 → 插件 → dsh-game-hud。
方式二:从 GitHub 直接安装
在 DSH 的 web profile(如 E:\.dsh\profiles\web)中:
// package.json
{
"dependencies": {
"dsh-game-hud": "github:guoliyuan97-png/dsh-game-hud#v1.2.0"
},
"dsh": { "profile": { "bundles": ["dsh-game-hud"] } }
}
然后 pnpm install 并重启 DSH,浏览器右下角会出现可拖动的 HUD 面板。
方式三:本地开发(file: 引用)
// package.json
{
"dependencies": { "dsh-game-hud": "file:./packages/dsh-game-hud" },
"dsh": { "profile": { "bundles": ["dsh-game-hud"] } }
}
许可
MIT
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 8405
Task board for the dsh web GUI: a sidebar multi-column kanban whose cards run in real DSH agent sessions and can also be scheduled with cron expressions, executed host-side even with the browser closed.
zhu1090093659/dsh-web#packages/dsh-web-all★ 8405
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
ccch1mneyyy/dsh-TUI★ 4088
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 4076
A fixed-corner whale widget for the DSH web GUI — balance, today's usage and per-turn cost with peak/off-peak pricing, editable balance-alert and daily-budget bubbles, a module-based custom bubble queue with A/B weighted choices and random lines or images, 30+ vendor templates (OpenAI, OpenRouter, Kimi, SiliconFlow, Ark, Zhipu, MiniMax and more) with per-model balance and subscription quota, plus task-end sound, imported audio, custom roles and a resource manager. Local-only, no telemetry.
omdsh-dev/DSH-better-sidebar★ 4009
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
Devin-AXIS/deepseek-design#deepseek-idesign★ 1423
Visual design studio for websites, app prototypes, posters, cards, reports, and magazines, with templates, direct element editing, selection-aware AI draft handoff, and export.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.