bowenliang123/dsh-context
bowenliang123/dsh-contextDSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
DeepSeek Harness(dsh web) 的成本水晶球:余额、实时速率、波峰/低峰计费,以及 🔮 下一条消息消耗预测,全部时区感知。
English: A cost & usage crystal ball for the DeepSeek Harness web GUI — balance, real-time rate, peak/off-peak billing, and a 🔮 next-message cost forecast, all timezone-aware.
tok/s要求:DeepSeek Harness web profile(@deepseek-ai/dsh)。
# 方式一(推荐):npm 包
dsh plugin --profile web add dsh-cost-crystal
# 方式二(GitHub 源):从仓库直接装
dsh plugin --profile web add "github:xxvk/dsh-cost-crystal"
# 方式三(本地开发):本地目录
dsh plugin --profile web add /path/to/dsh-cost-crystal
然后重启 dsh web(bundle 层在启动时读取),浏览器硬刷新。包声明了 dsh.bundle,
dsh plugin 会自动把它挂进 profile 的 bundle 层,无需手动改配置。
01:00–04:00 与 06:00–10:00 UTC。GET https://api.deepseek.com/user/balance(API key)。npm install # (仅 typescript devDependency)
npm run build # 生成注入脚本模板 + tsc → lib/
npm test # 构建 + 全部测试 + 行数规则(TDD 门槛)
npm run build:profile # 生成本地 profile 热加载插件(开发时用)
架构:Host 逻辑(src/index.ts / src/pricing.ts / src/usage.ts)为 TypeScript;
浏览器注入脚本源为纯 JS(src/scripts/card.inline.js / cost.inline.js),由
scripts/build-scripts.mjs 转义生成 src/card-script.ts / cost-script.ts(生成物,禁止手改)。
实现注意:注入 index.html 必须用字符串切片拼接 —— String.replace 会把替换串中的
$& / $' / $$ 按正则语义展开,破坏含 $ 的脚本(早期版本踩过这个坑)。
每次修改代码后,必须完整通过才算完成:
npm test # = tsc 构建 + node --test(全部测试)+ check-lines 行数规则
node:test(零运行时依赖);CI(.github/workflows/test.yml)push/PR 自动执行$ 与 \n 两个历史 bug)、
插件 apply/路由(mock 服务)、活动增量检测、发布一致性(patch inject 与代码同步)lib/ 豁免。详见 CONTRIBUTING.mddsh-cost-crystal 自动从会话日志按 model 分桶统计用量,DeepSeek 与 VL(视觉语言)模型的消耗会并排显示在卡片上。存在多个模型时,卡片出现摘要行(deepseek 12.5M · ¥36.6 qwen3-vl 1.2M · ¥3.2),来源标签旁的 ▼ 按钮在已配置模型间循环切换。
接入 VL 模型(如阿里云 qwen3-vl-flash):把它配置为 DSH provider —— 例如通过 dsh-vision-router 插件(provider vision-http、model aliyun/qwen3-vl-flash、DASHSCOPE_API_KEY 写在 ~/.dsh/.credentials.yaml)。dsh-cost-crystal 无需额外配置,自动统计会话日志里出现的任何模型。
详见 ROADMAP_CN.md 与 TODO_CN.md。