Bundle
mc-hud
Minecraft-style token consumption HUD for the DeepSeek Harness web GUI: hearts = decode tok/s, drumsticks = DeepSeek balance, per-mode icons (sword/map/command-block/grass).
- Source
- qsjzqssh
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 14 days ago
Readme
# mc-hud
Minecraft 风格的 DeepSeek Harness 消耗 HUD 插件:侧边栏底部显示 **红心(解码速度 tok/s)+ 鸡腿(余额剩余)**,顶栏模式标签与模式选择器使用原版 Minecraft 图标。
> 📖 人类用户读本文件;**维护/修复的 AI 请读 `AI_GUIDE.md`**(架构、坑史、改法全在里面)。
> ⚠️ **声明**:本插件为**非官方粉丝项目**,与 Mojang / Microsoft 无关。HUD 图标为 Minecraft 素材的**非商业派生作品**,版权归 Mojang / Microsoft 所有;原图不随仓库分发(仅开发需要),运行只依赖内嵌的小尺寸派生像素图。请勿商用。
## 功能
- **红心 ×10**:当前解码速度 tok/s(与输入框下方统计行同源),锚点分段映射 (0→10, 100→9, 130→7, 200→3),半心粒度
- **鸡腿 ×10**:DeepSeek 余额剩余,上限 ¥100、每 ¥10 一格(半格粒度)
- **信息行**:缓存命中率(红心标签右侧)、本会话累计消耗 ≈¥(鸡腿标签右侧,按 DeepSeek-V4-Flash 官方空闲价估算)
- **模式图标**:顶栏标签 + 英雄屏选择器使用原版像素图标——普通=铁剑、极简=地图、PTC=命令方块、创造=草方块
- **明暗主题自适应**:HUD 文字颜色、MC 描边、空槽图标与模式下拉菜单底色跟随 DSH 主题(`body[data-ds-dark-theme]`)自动切换,浅色/深色下都可读
- 余额每 60 秒刷新(失败 15 秒重试);UI 每 2 秒更新;侧边栏窄栏时自动隐藏;图标自适应侧边栏宽度
## 安装
### 方式 A:npm(最简单,推荐)
```sh
dsh plugin --profile web add mc-hud
```
或直接加到 Web profile 的依赖:
```sh
cd ~/.dsh/profiles/web
pnpm add mc-hud # 或 npm install mc-hud
```
然后在 `~/.dsh/profiles/web/package.json` 的 `dsh.profile.bundles` 里加 `"mc-hud"`,重启 DSH 生效。
(npm 包名:`mc-hud`,[npm 页面](https://www.npmjs.com/package/mc-hud))
### 方式 B:从 Git 仓库
```sh
dsh plugin --profile web add "github:qsjzqssh/mc-hud#v1.0.0"
```
重启 DSH 后生效。
### 方式 C:本地目录
```sh
dsh plugin --profile web add /path/to/mc-hud
```
或手动:把 `mc-hud/` 放到 `~/.dsh/profiles/web/` 下,在 `~/.dsh/profiles/web/package.json` 的 `dependencies` 加 `"mc-hud": "file:./mc-hud"`、`dsh.profile.bundles` 加 `"mc-hud"`,然后 `cd ~/.dsh/profiles/web && corepack pnpm install`,重启。
## 卸载
从 `~/.dsh/profiles/web/package.json` 移除 `mc-hud` 依赖与 bundle 项,删除 `~/.dsh/profiles/web/mc-hud/`(及 `node_modules/mc-hud`),`corepack pnpm install`,重启。
## 技术说明
- **Host 半**(`lib/index.js`):`ctx.remote`(typert Remote)提供 `getHud` / `getPresets` / `setDefaultPreset`;余额经 `credentials.resolve('DEEPSEEK_API_KEY')` + `shell.run(curl)` 查询(key 只走 env);tok/s 与缓存命中读 `sessionProjections` 的 `sessionStats` / `tokenUsage`(与统计行同源);价格常量 `PRICE_IN_MISS/HIT/OUT`(V4-Flash 官方空闲价)。
- **Client 半**(`lib/client.js`):`window.__ModuleLoader__.load` wire 格式;插槽注册:`sidebar.footer.action`(HUD)、`conversation.session.header.actions` id `agent-preset` priority `-1`(替换官方标签)、`conversation.hero.agentPreset` priority `-1`(替换选择器)。全部注册带 try/catch,任一失败不影响启动。
- **素材**:`assets/` 内含原版 16×16 精灵图(红心/鸡腿/模式图标);客户端内嵌 base64,无需外部文件。
## 调参
价格常量在 `lib/index.js`(`PRICE_IN_MISS=1.5`、`PRICE_IN_HIT=0.05`、`PRICE_OUT=4.5`,高峰时段翻倍);红心锚点在 `lib/client.js` 的 `heartsFromTok`;`BALANCE_CAP` 为鸡腿上限。
## 开发
```sh
npm run check # 语法检查两个 lib 文件
```
改动后同步部署副本:`cp lib/*.js ~/.dsh/profiles/web/mc-hud/lib/ && cp lib/*.js ~/.dsh/profiles/web/node_modules/mc-hud/lib/`(file: 依赖是硬链接副本,必须同步),然后重启。
## License
MIT(见 `LICENSE`)。贴图素材版权归其原作者/游戏资产所有者所有,仅用于个人用途;发布分发前请自行确认素材授权。
---
*插件由 deepseek-v4-flash 在创造模式中制作并上传*
Install
dsh plugin --profile web add github:qsjzqssh/mc-hud
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install mc-hud from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.