GLFzr/dsh-opencode-go-quota
DSH插件:OpenCode Go额度圆环——位于输入框模型选择器左侧的进度圆环,点击可在5小时/每周/每月用量间切换(面向DeepSeek Harness Web的OpenCode Go配额环)
Project Overview项目介绍
This is a native DSH Web plugin that displays OpenCode Go API quota usage as a 22px progress ring on the left side of the model selector in the chat input box. Users can click the center letter (5, W, or M) to cycle between 5-hour, weekly, and monthly quota tracking windows. Hovering over the ring shows the current usage percentage and remaining time until the quota resets, and the ring changes color based on how urgent the current usage level is. When usage hits 80% or higher, the ring flashes a red pulse to alert the user that quota is running low.
The plugin also dynamically injects current quota status into the system prompt for each agent request, and only injects once when the usage enters a new threshold tier to avoid wasting tokens on redundant prompts. Alert wording gets progressively more urgent as usage increases across tiers, and escalation memory is automatically cleared once the quota resets back below the starting warning threshold. All core thresholds including warning, critical, and escalation steps can be customized by the user via a cordis.yml config file. This plugin is designed for DSH users who regularly work with the OpenCode Go API.
To install the plugin, run the dsh plugin command to install directly from the GitHub repository, then restart the DSH Web process to activate it. The plugin pulls quota data from the official OpenCode API, and prioritizes reading the API key from the OPENCODE_GO_API_KEY environment variable; if that is not set, it reads from the ~/.local/share/opencode/auth.json file that is automatically created when you log into OpenCode Go. If you see a gray exclamation mark error, you can fix it by adjusting the DSH sandbox workspace root configuration. Uninstalling uses the corresponding dsh plugin remove command, and the project is released under the open source MIT license.
这是专为 DeepSeek Harness(DSH)Web 打造的持久化插件,作用是在聊天输入框的模型选择器左侧显示一个22px大小的进度圆环,展示OpenCode Go的API额度使用情况。点击圆环中央的字母(5/W/M)可以循环切换5小时/每周/每月三种用量统计窗口,悬停时会显示已用百分比和额度重置倒计时。圆环会根据用量紧急程度变色,当额度≥80%时还会显示红色脉冲闪烁进行提醒。
本插件还会在每次Agent请求时,把当前额度状态动态注入system prompt,仅当进入新档位时注入一次,既避免重复提示浪费token,也能保证提示准确不干扰输出。根据用量档位不同,提醒措辞的紧急程度会逐步递增,窗口重置回阈值以下后会自动清除升档记忆,不会重复提醒。额度阈值、缓存时间等参数都支持用户通过cordis.yml自定义配置,适合经常使用OpenCode Go API配合DSH开发的用户。
本插件依赖宿主shell能够运行子进程,数据从OpenCode官方API拉取,优先读取环境变量OPENCODE_GO_API_KEY,不存在则读取~/.local/share/opencode/auth.json里的密钥。安装可通过dsh plugin命令直接从GitHub拉取,重启DSH Web后生效,卸载也通过对应dsh命令操作。如果遇到灰色感叹号报错,可调整DSH沙箱配置解决,项目采用MIT许可开源。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-opencode-go-quota(GLFzr/dsh-opencode-go-quota)
仓库:https://github.com/GLFzr/dsh-opencode-go-quota
本站详情页:https://www.yhbd.top/plugins/glfzr-dsh-opencode-go-quota/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 6 · 最近提交 2026-08-16 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 6 stars - very few users, little community feedback星标只有 6,几乎没人在用,遇到问题缺少社区反馈
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:GLFzr/dsh-opencode-go-quota
把 GLFzr/dsh-opencode-go-quota 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-opencode-go-quota
OpenCode Go 额度圆环 —— DSH Web 的持久化插件。
在聊天输入框模型选择器左侧显示一个 22px 进度圆环:
- 中央字母 5 / W / M,点击循环切换 5小时 / 每周 / 每月 用量窗口
- 悬停显示「5小时 已用 X% · 重置倒计时」
- 颜色按紧急程度:绿 <30% / 蓝 30-60% / 橙 60-80% / 红 ≥80%
- 每 5 分钟自动刷新,点击切换时若数据超过 1 分钟则强制刷新
- 额度告急(≥80%)时圆环红色脉冲闪烁,悬停提示「⚠ 5小时额度即将用尽,建议暂停等重置」
配合 dsh-token-ledger 使用
额度(钱)与 token 用量是两回事:本插件回答「还剩多少额度」, dsh-token-ledger 则逐请求记录 真实的输入 / 输出 / 缓存命中 token 数(会话顶部「用量」页,堆叠柱状图, 支持按请求/按小时/按天/按轮次查看)。两个插件可同时安装、互不依赖: 额度圆环在输入框左侧,token 用量在「用量」页。
对话内额度提醒(Codex CLI 式)
每次 agent 请求时,插件会把当前额度状态动态注入 system prompt,只在进入新档位时注入一次(同档内后续请求不重复,prompt 前缀稳定、省 token、利于缓存命中):
| 5小时用量 | 行为 |
|---|---|
| <60%(warnAt) | 不注入(零 prompt 成本) |
| 60%-79% | 注入一次:注意档——建议在合适节点提醒用户、暂停待恢复 |
| 80%-89% | 注入一次:告急档——主动提醒、任务边界暂停 |
| 90% 起 | 每增长 2% 递进一档(90/92/94/...),措辞紧急程度递增:严重 → 濒临耗尽 → 即将耗尽 → 几乎耗尽 → 近极限 → 已用尽(100%),每档只提醒一次 |
窗口重置回 60% 以下后,升档记忆自动清除,下次爬升会重新按档提醒。
阈值可通过 cordis.yml 配置(warnAt / criticalAt / escalateFrom / escalateStep,默认 60 / 80 / 90 / 2;cacheTtl 为用量缓存秒数,默认 60;weeklyWarnAt / monthlyWarnAt 为周/月圆环警示阈值,默认 90 / 95):
- id: dsh-opencode-go-quota
config:
warnAt: 60
criticalAt: 80
escalateFrom: 90
escalateStep: 2
cacheTtl: 60
weeklyWarnAt: 90
monthlyWarnAt: 95
数据不可用(无 key / 接口失败)时注入为空,不产生 prompt 噪声;圆环显示灰色 !,悬停可见错误原因,宿主进程与浏览器控制台均有调试日志。
数据来源
- Host 端通过
node -(stdin 脚本)读取~/.local/share/opencode/auth.json的opencode-go.key(环境变量OPENCODE_GO_API_KEY优先;auth.json 容忍 UTF-8 BOM,文件缺失 / 解析失败 / 无 key 分别报错) - 调用官方接口
GET https://opencode.ai/zen/go/v1/usage(Bearer 鉴权) - 结果经
/ocg-quota/usage路由(cacheTtl秒节流缓存,失败结果按errorCacheTtl秒短缓存,默认 5;响应含thresholds)提供给浏览器端与 prompt 注入
安装
# 本地路径安装
dsh plugin --profile web add <本目录绝对路径>
# 或直接从 GitHub 安装
dsh plugin --profile web add github:GLFzr/dsh-opencode-go-quota
# 重启 dsh web 后生效
卸载
dsh plugin --profile web remove dsh-opencode-go-quota
常见问题
圆环显示灰色感叹号(宿主报 shell.run failed / windows-acl-run ...)
插件需要宿主 shell 能运行子进程。DSH 的 Windows ACL 沙箱要求
sandbox-policy.workspaceRoot(默认取 dsh web 启动目录)不包含系统 TEMP 目录;
从用户主目录等位置启动 dsh web 会触发该限制(插件会显示友好提示)。
解决:在 ~/.dsh/profiles/<profile>/cordis.patch.yml 固定 workspace 根目录:
- id: sandbox-policy
config:
workspaceRoot: <你的 workspace 绝对路径>
然后重启 dsh web。或临时在 workspace 目录内启动 dsh web。
一直提示 "opencode-go key not found"
- 检查
~/.local/share/opencode/auth.json是否存在且含opencode-go.key(已登录 OpenCode Go 即自动生成); - 或设置环境变量
OPENCODE_GO_API_KEY(优先于 auth.json)后重启 dsh web; - auth.json 带 UTF-8 BOM 或损坏也会导致取 key 失败(0.3.2 起已容忍 BOM 并区分错误)。
许可
MIT
flizzywine/dsh-tavern
baihejiangnan/deepseek-harness-desktop
Xenia0922/dsh-opencode-go-usage
cogine-ai/dsh-claude-tui
PianoPrince/dsh-workspace-mover
BigBlueBaby/codex2dsh
xueayi/dsh-opencode-go-usage