dsh-opencode-go-usage 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,8 @@ English | [中文](README.zh.md)
6
6
 
7
7
  A [DSH](https://github.com/deepseek-ai/deepseek-harness) (DeepSeek Harness) plugin that watches your **OpenCode GO plan** quota — the $10/month subscription that gives you usage limits on open-source models (rolling 5-hour, weekly, and monthly windows).
8
8
 
9
+ Compatible with DSH `0.1.1-rc.2` and `0.1.2-alpha.2`.
10
+
9
11
  ## Features
10
12
 
11
13
  - **Sidebar widget** — a live widget pinned at the bottom of the DSH web sidebar (`sidebar.footer.action` slot) showing three usage bars: rolling (5h), weekly, and monthly, each with a relative countdown to its window reset. When the sidebar is collapsed it shrinks to a compact percentage badge.
@@ -19,7 +21,7 @@ The plugin is a **dual-half DSH package**:
19
21
  | half | file | role |
20
22
  |---|---|---|
21
23
  | host (Node) | `lib/index.js` | registers the `/opencode-go/usage` web route (`ctx.webServer`) and the `/opencode-go` command (`ctx.commands`); resolves the key through DSH credentials; caches the upstream call (30 s) |
22
- | browser | `lib/client.js` | a hand-authored `window.__ModuleLoader__.load({ id, factory })` bundle that registers into the `sidebar.footer.action` list slot and polls the same-origin route every 60 s |
24
+ | browser | `lib/client.js` | a hand-authored `window.__ModuleLoader__.load({ id, factory })` bundle that waits for and registers into the `sidebar.footer.action` list slot, then polls the same-origin route every 60 s |
23
25
 
24
26
  `package.json` declares `"dsh": { "client": { "platform": "web" } }`, so DSH's client-modules node half scans it into the browser boot graph (`window.__DSH_BOOT__`) and serves the bundle at `/plugins/dsh-opencode-go-usage/client.js`.
25
27
 
package/README.zh.md CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  [DSH](https://github.com/deepseek-ai/deepseek-harness)(DeepSeek Harness)插件:监控你的 **OpenCode GO 套餐**额度 —— 10 美元/月的订阅,按模型提供滚动 5 小时 / 每周 / 每月三个窗口的用量限额。
8
8
 
9
+ 兼容 DSH `0.1.1-rc.2` 与 `0.1.2-alpha.2`。
10
+
9
11
  ## 功能
10
12
 
11
13
  - **侧边栏小组件**:常驻 DSH Web 侧边栏底部(`sidebar.footer.action` 槽位),三条用量进度条:滚动窗口(5h)、周窗口、月窗口,每条带重置倒计时;侧边栏收起时收缩为紧凑的百分比徽标。
@@ -19,7 +21,7 @@
19
21
  | 端 | 文件 | 职责 |
20
22
  |---|---|---|
21
23
  | host(Node) | `lib/index.js` | 注册 `/opencode-go/usage` Web 路由(`ctx.webServer`)与 `/opencode-go` 命令(`ctx.commands`);通过 DSH credentials 解析 key;上游调用带 30s 缓存 |
22
- | 浏览器 | `lib/client.js` | 手写的 `window.__ModuleLoader__.load({ id, factory })` bundle,注册进 `sidebar.footer.action` 列表槽,每 60s 轮询同源路由 |
24
+ | 浏览器 | `lib/client.js` | 手写的 `window.__ModuleLoader__.load({ id, factory })` bundle,等待 `sidebar.footer.action` 列表槽就绪后注册,每 60s 轮询同源路由 |
23
25
 
24
26
  `package.json` 声明了 `"dsh": { "client": { "platform": "web" } }`,DSH 的 client-modules 节点端会把它扫描进浏览器启动图(`window.__DSH_BOOT__`),并在 `/plugins/dsh-opencode-go-usage/client.js` 提供该 bundle。
25
27
 
package/lib/client.js CHANGED
@@ -235,13 +235,18 @@ window.__ModuleLoader__.load({
235
235
 
236
236
  function apply(ctx) {
237
237
  ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-opencode-go-usage: dictionaries");
238
- ctx.effect(() => ctx.slots.register({
238
+ const registerWidget = () => ctx.slots.register({
239
239
  name: "sidebar.footer.action",
240
240
  id: "dsh-opencode-go-usage",
241
241
  order: 0,
242
242
  label: "OpenCode GO",
243
243
  locale: NS
244
- }, Widget), "dsh-opencode-go-usage: widget registration");
244
+ }, Widget);
245
+ if (typeof ctx.slots.inject === "function") {
246
+ ctx.slots.inject("sidebar.footer.action", registerWidget);
247
+ } else {
248
+ ctx.effect(registerWidget, "dsh-opencode-go-usage: widget registration");
249
+ }
245
250
  }
246
251
 
247
252
  exports.apply = apply;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-opencode-go-usage",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "DSH (DeepSeek Harness) plugin: OpenCode GO plan quota widget in the sidebar, same-origin usage proxy, and a /opencode-go chat command",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",