DeepSeek Harness plugin

dsh-opencode-go-usage-qkncbot

OpenCode Go 套餐用量监控插件:输入框工具行 5 小时用量圆环 + 展开卡片(5小时/每周/每月)

Jump to install

Source facts

Repository
qknc-bot/dsh-opencode-go-usage
Latest update
Aug 16, 2026
Category
Tools & Capabilities
GitHub stars
0
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/qknc-bot/dsh-opencode-go-usage
Plugin: dsh-opencode-go-usage-qkncbot
Author: qknc-bot

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

dsh-opencode-go-usage

DeepSeek Harness (DSH) Web GUI 插件:OpenCode Go 套餐用量监控。

输入框工具行常驻一个 5 小时用量圆环(与内置"上下文已用"圆环同款交互),点击在圆环旁展开白色卡片,显示 5 小时滚动 / 每周 / 每月 三个窗口的已用百分比与重置倒计时。

功能特性

  • 工具行圆环:5 小时滚动窗口已用百分比,按阈值变色(绿 / 橙 / 红),30 秒自动刷新,悬停显示详情
  • 展开卡片:三窗口进度条、百分比、重置倒计时、最近更新时间;白色卡片样式与内置"上下文用量"卡片一致,悬浮在圆环按钮正上方
  • Agent 工具:注册 opencode_go_usage 工具,对话里直接让模型查询余额(无参数)
  • 系统提示词公告:agent 自动获知插件能力,用户提到「余额 / 用量 / quota」时主动使用工具
  • 安全:API key 经 DSH 凭据引用(OPENCODE_GO_API_KEY)解析,只留在 host 进程,浏览器永不接触;代理路由带 loopback-only 围栏,局域网暴露的部署不会泄露 key
  • 零 SDK 运行时依赖:host 半部不 import 任何 @deepseek-ai/* 包,git vendoring / 目录安装开箱即用,无构建步骤

安装

# 推荐:从 GitHub 安装(把 <ref> 固定到最新 commit SHA 以保证可复现)
dsh plugin --profile web add github:qknc-bot/dsh-opencode-go-usage#<ref>

或从本地目录安装(注意 pnpm 的 file: 协议无法解析含空格 / 中文的路径,源码需放在纯 ASCII 路径):

dsh plugin --profile web add file:C:/path/to/dsh-opencode-go-usage

安装后重启 dsh web,输入框工具行左侧出现 5h 圆环即生效。

> 首次 git 安装若被 pnpm 的 allowBuilds 拦下(git 依赖的 prepare 脚本默认被阻止),把下面这段加进 profile 的 pnpm-workspace.yaml 后重跑安装命令: > > ``yaml > allowBuilds: > dsh-opencode-go-usage: true > ` > > 从旧版本升级时,先 dsh plugin --profile web remove dsh-opencode-go-usage 再重新 add,避免新旧安装方式在 package.json` 里残留冲突。

卸载

dsh plugin --profile web remove dsh-opencode-go-usage

重启 dsh web 后圆环消失,路由与工具一并卸载。

配置

插件行配置位于 profile 的 cordis.patch.yml(安装时自动生成),可覆盖以下字段:

- id: opencode-go-usage
  name: dsh-opencode-go-usage
  config:
    baseUrl: https://opencode.ai/zen/go   # 上游网关基址,自动拼接 /v1/usage
    timeoutMs: 15000                      # 上游请求超时(毫秒)
    refreshSeconds: 30                    # 圆环自动刷新间隔(秒)
    warnPercent: 60                       # 5h 窗口达到该百分比后变橙
    dangerPercent: 85                     # 达到该百分比后变红
    announceToAgent: true                 # 是否向 agent 公告插件能力

API key 解析:DSH 凭据引用 OPENCODE_GO_API_KEY(即模型 provider 配置的 apiKeyEnv),通常零配置即可工作。

Agent 工具

opencode_go_usage(无参数)返回三个窗口的已用百分比与重置倒计时,示例输出:

OpenCode Go 用量(opencode.ai/zen/go)
滚动用量:1%,重置于 3 小时 25 分钟
每周用量:56%,重置于 16 小时 56 分钟
每月用量:78%,重置于 18 天 9 小时 48 分钟
抓取时间:2026/8/16 15:03:21

工作原理

  • 用量接口:GET {baseUrl}/v1/usage,请求头 Authorization: Bearer <API_KEY>。该接口不在 OpenCode 公开文档中,由 cc-switch 社区发现;响应包含 rolling / weekly / monthly 三个窗口的 percent(已用百分比)与 resetsAt(重置时刻)
  • 浏览器 ↔ host:浏览器半部只请求同源 /api/dsh-opencode-go-usage/usage 代理路由,key 不出 host 进程
  • UI 挂载:圆环按钮注册在 conversation.input.left(工具行),展开卡片注册在 conversation.input.overlay(输入框浮动层),均与内置 UI 共存,不替换任何部件
  • 解析防御:同时接受 usage. 前缀与裸窗口、resetsAt 与数字 resetsInSeconds 两种形式,坏窗口跳过而不是整体失败

已知限制

  • 用量接口未公开文档,响应结构可能随 opencode 演变;解析做了防御处理,非 200 / 非 JSON 以友好提示展示而非崩溃
  • 套餐限额($12 / $30 / $60)仅作展示参考,接口不返回金额
  • 圆环显示 5 小时窗口,周 / 月窗口在展开卡片中查看

许可

[MIT](LICENSE)