DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

LCspax /

LCspax/dsh-ocgo-ring

Verified

OpenCode Go quota ring for DeepSeek Harness: three windows beside the composer context meter.

★ 1 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@85c9aafd

dsh-ocgo-ring

给 DeepSeek Harness 的 OpenCode Go 套餐余量环:常驻在输入框下方、上下文用量环的右侧(圆环 + 百分比),点击展开三个窗口的余量小浮窗,并可直接点选圆环显示哪一个。

dsh-ocgo-ring:OpenCode Go 余量环,常驻输入框旁的三个计费窗口余量

preview

功能

  • 紧凑常驻:14px 圆环 + 百分比,紧挨 DSH 自带的上下文用量环右侧;圆环填充和数字都表示剩余(100% − 已用)。
  • 默认滚动窗口:默认显示 rolling(5 小时)窗口;点击圆环打开小浮窗。
  • 三个窗口:浮窗里列出 滚动 / 每周 / 每月,每行显示余量百分比、4px 进度条和重置倒计时。
  • 点选切换:点击任意一行即可切换圆环显示的窗口;选择写入 localStorage(键 ocgo-ring.metric),刷新/重启后保留。
  • rate-limited 提示:窗口进入限流状态时,圆环和行内数字使用琥珀色(--dsw-alias-state-warn-primary)。
  • 与上下文用量浮窗同款样式:复用同一套 UI 令牌和 useDismissOnOutsidePointer,面板圆角、阴影、字号一致;浮窗位置按圆环的 getBoundingClientRect() 自行测量(DSH 0.2.2 起 useAnchoredPosition 已从 @deepseek-ai/dsh-client-ui-primitives 移除)。
  • API key 不出主机:浏览器只拿百分比;Host 端 60 秒缓存,多标签页不会重复请求上游。

安装

要求:DSH 0.2.1-rc.2 及以上(Web / Desktop),已在 0.2.2-rc.3 上验证,以及 OpenCode Go 订阅。

  1. 克隆仓库:

    git clone https://github.com/LCspax/dsh-ocgo-ring.git
    
  2. 把 OpenCode Go 的 API key 写进 DSH 凭据存储(~/.dsh/.credentials.yaml):

    OPENCODE_GO_API_KEY: sk-...
    
  3. 安装插件(仓库根目录就是插件包):

    • DSH 桌面版:侧栏「插件」→「添加插件」→ 填本地目录的绝对路径;
    • 或 CLI:dsh plugin --profile <profile> add <path-to-repo>。
  4. 首次安装完成后重启一次 DSH(Host 路由需要重新加载),再刷新页面。

配置

当前为固定配置(改 index.js 顶部常量即可):

项 值
凭据引用 OPENCODE_GO_API_KEY
上游接口 https://opencode.ai/zen/go/v1/usage
Host 缓存 60 秒
前端轮询 60 秒
同源路由 GET /ocgo-ring/usage

工作方式

DSH 浏览器
  └─ client.js  注册到 conversation.composer.dock(order 1 → 上下文用量环右侧)
        │  fetch('/ocgo-ring/usage') 每 60s
        ▼
DSH Host
  └─ index.js   读 ctx.credentials('OPENCODE_GO_API_KEY')
        │  GET https://opencode.ai/zen/go/v1/usage(缓存 60s)
        ▼
OpenCode Go
  • 上游返回每个窗口的已用百分比;插件在浏览器端换算成余量。
  • client.js 是手写的 window.__ModuleLoader__.load bundle(不依赖构建工具),改完 DSH 客户端会自动热重载(约 1 秒)。
  • Host 半改动需要重启 DSH 或触发一次重组。

目录结构

.
├── index.js            # Host 半:同源代理路由
├── client.js           # 浏览器半:圆环 + 浮窗
├── cordis.patch.yml    # Loader 补丁
├── package.json
├── locale/
│   ├── zh.json         # 插件标题 / 描述
│   └── en.json
├── icon.svg
├── docs/
│   ├── promo.svg       # 宣传图矢量源文件(1600×900,黑白)
│   ├── promo.png       # 宣传图导出(3200×1800,README 使用)
│   ├── promo-square.svg  # 小红书方图源文件(1024×1024)
│   ├── promo-square.png  # 小红书方图(1024×1024)
│   └── preview.png     # 真实界面裁图

开发

node --check index.js
node --check client.js

改 client.js 保存即可看到 DSH 页面热更新;改 index.js 需要重启 DSH。

已知限制

  • 在 DSH 0.2.2-rc.3(Windows)上验证;依赖 conversation.composer.dock、@deepseek-ai/dsh-client-ui-primitives 的 Tooltip / useDismissOnOutsidePointer 两个公开导出,以及 ctx.locale.register 与 ctx.slots.register 的 locale 选项。
  • 上游接口字段若发生变化,浮窗会显示「暂时取不到用量」,圆环保持空环。
  • 当前显示的是余量;若更习惯「已用」,改 remainingOf() 及行内百分比即可。

隐私

  • API key 只在 Host 进程内使用,从不下发到浏览器。
  • 不采集遥测;插件只访问 OpenCode Go 的官方 usage 接口。

License

MIT © 2026 LCspax


English

A quota ring for the OpenCode Go plan, sitting right of DeepSeek Harness's own context meter under the composer: ring + percentage of remaining quota. Click the ring to open a small popover listing the rolling (5h), weekly, and monthly windows; click a row to choose which window the ring shows (persisted in localStorage). The host proxies GET /ocgo-ring/usage with OPENCODE_GO_API_KEY, caches for 60 s, and never exposes the key to the browser.

Requires DSH >= 0.2.1-rc.2. Clone, add OPENCODE_GO_API_KEY to ~/.dsh/.credentials.yaml, install the repo directory as a plugin, restart DSH once.

—/ 5

No ratings yet

Verified DSH bundle

Commit 85c9aafd1b45

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout