pk7j7sqryy-ops/dsh-token-pet 预览 preview

pk7j7sqryy-ops/dsh-token-pet

Plugin插件 Native原生 ⭐ 3 MIT Pets & Fun桌宠与娱乐Usage & Cost用量与计费

DSH动态Cordis插件:卡通用量小部件+天气/预报/预警(Token Pet布布玩偶)

Project Overview项目介绍

This repository hosts dsh-token-pet, a plugin built exclusively for DeepSeek Harness (DSH). It adds an interactive cartoon pet named Bubu to the top-right utilities section of the DSH conversation header. Bubu displays real-time token usage for the current active session, alongside helpful utilities like the current date and day of the week, real-time local weather, a 3-day forecast, and extreme weather warnings. All UI elements automatically adapt to DSH’s active theme color and dark/light mode setting.

The plugin integrates seamlessly with DSH’s native layout by mounting to the existing conversation header utilities slot, so it sits alongside native buttons like Download Log without altering core DSH functionality. It provides detailed breakdowns of token usage, including context window pressure, total session input and output tokens, and a breakdown of context composition by type. Bubu’s facial expression changes based on how much of the context window is used, giving users an intuitive at-a-glance reminder of their current token usage.

To install the plugin, users can run the DSH CLI command dsh plugin --profile web add github:pk7j7sqryy-ops/dsh-token-pet for a permanent install, or use the dynamic temporary installation method for testing. It reuses token data already projected by DSH to the frontend, so it does not generate any extra token requests. Weather data is pulled from Open-Meteo via IP-based location, cached for 30 minutes to avoid unnecessary API calls, and falls back gracefully if the fetch request fails. The project is open source under the permissive MIT license.

dsh-token-pet 是专为 DeepSeek Harness (DSH) 开发的原生插件,它会在 DSH 会话头部的右上角添加一个名为「布布」的卡通玩偶挂件,实时展示当前会话的 Token 用量,同时提供今日日期星期、实时天气、未来三天预报和极端天气预警功能,所有元素自动适配 DSH 的主题深浅色。

插件挂载在 DSH 原生会话头部工具区,和「下载日志」等原生按钮并排,不影响原有界面布局。它会展示详细的 Token 用量拆解,包括上下文占用占比、当前会话输入输出总用量、上下文构成明细。玩偶「布布」的表情会随着 Token 用量变化,从微笑到出汗,给用户直观的用量提醒。

安装方式简单,可通过 DSH 命令行直接安装为常驻包,也支持动态临时加载测试。插件复用 DSH 前端已投影的 Token 数据,不会产生额外的 Token 请求。天气数据通过 IP 定位获取,调用 Open-Meteo 接口,缓存 30 分钟,获取失败会优雅降级,项目采用 MIT 开源许可。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:pk7j7sqryy-ops/dsh-token-pet

把 pk7j7sqryy-ops/dsh-token-pet 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

Token 泡泡 (Token Pet) 🐻

Token Pet 截图

DeepSeek Harness (DSH) 插件 · dsh-plugin

一个给 DeepSeek Harness (DSH) 用的插件,在会话头部右上角嵌一个卡通「布布」玩偶,实时展示当前会话的 Token 用量,并附带 今天日期/周几 + 实时天气 + 未来 3 天预报 + 极端天气预警,全程跟随主题色自适应深浅色。

功能特性

  • 嵌入右上角,不悬浮:挂在 conversation.session.header.utilities(会话头部右上角工具区),和「下载日志」等原生按钮并排。
  • 今天日期 / 周几:📅 8月15日 · 周五,浏览器本地时区实时计算,零网络。
  • 实时天气:☀️ 晴 26°C(点击可刷新),IP 定位(ipwho.is)+ Open-Meteo,缓存 30 分钟,失败优雅降级。
  • 未来 3 天预报:今天 / 明天 / 后天逐日天气(图标 + 最高/最低温)。
  • 卡通用量小部件(展开态):
    • 🎯 上下文占用:主题色进度条 + 已用 / 窗口上限。
    • 📊 本会话累计:输入 / 输出 / 缓存读 / 缓存写(含合计)。
    • 🧩 上下文构成:系统提示 / 工具定义 / 消息内容。
  • 表情玩偶「布布」:内联 SVG 圆脸小布偶,表情随用量变化(闭眼微笑 → 大笑 → 微笑 → 皱眉 → 快满冒汗)。
  • 极端天气预警:暴雨 / 雷暴 / 大雪触发红色警告条 + 动画雨滴(🌧)或雪花(🌨)粒子;未来 3 天有严重天气也提前预警,折叠药丸上亮闪烁图标。
  • 跟随主题色:全部颜色走 --dsw-alias-* CSS 变量,深浅色自适应。
  • Token 零请求:token 数据直接复用宿主已投射到前端的投影。

安装

💡 直接复制这个仓库的 GitHub 地址(github:pk7j7sqryy-ops/dsh-token-pet)发给 AI 助手,让它帮你安装,也可以按照以下方法:

方式 A(推荐):作为包安装

dsh plugin --profile web add github:pk7j7sqryy-ops/dsh-token-pet

安装后重启 dsh --profile web,会话头部右上角就会出现布布。也可以 dsh plugin --profile web add dsh-token-pet(若已发布到 npm)。

方式 B:动态插件(进程内临时)

把 dynamic/client.js 粘进 cordis_define 的 code.client、dynamic/host.js 粘进 code.host,再 cordis_run 即可(重启失效)。详见 dynamic/ 下两份文件头部的注释。

日常使用

  • 折叠态:右上角小药丸 = 布布玩偶 + 占用百分比;有极端天气/未来预警时多一个闪烁图标。
  • 展开:点药丸打开卡片;点外部 / 按 Esc / 点 ✕ 收起。
  • 天气刷新:点卡片里的天气那一格手动刷新(缓存 30 分钟)。

常见问题

  • 天气显示「不可用」? 本机 web 服务无 fetch provider 且 curl 不可用/被沙箱拦截;token 部分不受影响。
  • 定位城市不对? 定位走 IP(ipwho.is),挂 VPN/代理会漂移;改 lib/index.js 的 locate() 可固定经纬度。
  • 为什么没有政府红/橙预警? 气象局/和风天气等官方预警需 API key,无法无 key 直连;当前用 WMO 代码判断当前 + 未来 3 天严重天气。
  • 想要长期内置? 用方式 A 装成包即可随 profile 常驻。

技术实现

能力 选型
挂载位置 conversation.session.header.utilities Slot(additive)
Token 数据 useProjection 标准 prop(contextPressure / tokenUsage / contextBreakdown)
占用口径 projectedTokens ?? pressureTokens ÷ contextWindow
天气 Host RPC(connection.rpc.handle("/token-pet")):ipwho.is → Open-Meteo
网络能力 web.fetch 优先,回退 shell + curl
主题 --dsw-alias-* CSS 变量

文件结构

.
├── package.json        # npm 包 + dsh.bundle.patch / dsh.client 声明
├── cordis.patch.yml    # 组合补丁:把插件按 id 插进 profile
├── lib/
│   ├── index.js        # Host 半:天气 RPC(真实 ESM 模块)
│   └── client.js       # Client 半:UI + 布布玩偶(__ModuleLoader__ bundle)
├── dynamic/            # 动态插件源码(备选安装方式 B)
│   ├── client.js
│   └── host.js
├── LICENSE
└── README.md

衍生功能规划(Roadmap)

  • 用量预警:70%/90% 时弹动 + toast,建议 /compact
  • 一键压缩:卡片内直接放「压缩上下文」按钮
  • 成本估算:接模型单价,token 换算 ¥/$
  • 天气增强:空气质量 / 手动指定城市 / 接官方预警 API key
  • 用量历史曲线 / 工具调用成本拆解 / 跨会话汇总 / 宠物养成

许可

MIT

← 上一个 Prev dsh-plugin-notify 下一个 Next dsh-mcp-bridge →