opencode-usage-limits 0.3.1 → 0.3.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/CHANGELOG.en.md CHANGED
@@ -6,6 +6,51 @@ All notable changes to `usage-limits` are documented here. The format is based o
6
6
 
7
7
  [简体中文](./CHANGELOG.md) · [English](./CHANGELOG.en.md)
8
8
 
9
+ ## 0.3.3 - 2026-11-05
10
+
11
+ ### Changed
12
+
13
+ - **Go allowance table synced with the official 2026-11 table**
14
+ ([docs](https://opencode.ai/v2/docs/console/go/)): **DeepSeek V4.1 Flash is now $100/month**
15
+ (Go Plus $200, up from $80/$160) — the only price change in this release.
16
+ - **Six models added**: `gemini-4-argon` ($30/$120), `kimi-k3.1-pro` ($15/$60),
17
+ `minimax-m3.1-flash` ($20/$80), `hy4` ($60/$240), plus `beam-free` and `iceman-contributor-free` (free).
18
+ - **`step-5-preview-free` corrected to `step-5-preview`**: the model is paid now ($15/$60), so showing `∞`
19
+ was wrong.
20
+ - **Six delisted models removed**: `grok-4.6`, `space-bunny`, `minimax-m2.7`, `deepseek-v4-flash`,
21
+ `deepseek-v4-flash-vision-exp`, `longcat-2.5-preview-free`. Unknown models keep rendering `—`.
22
+ - The table is now **sorted by model ID** so it can be diffed against the docs page; the source link in
23
+ the comment points at `https://opencode.ai/v2/docs/console/go/`.
24
+ - Go Teams (Go + $5 per model) is not part of the reference line, which keeps showing `$Go/$Go Plus`.
25
+
26
+ ## 0.3.2 - 2026-11-05
27
+
28
+ ### Fixed
29
+
30
+ - **The plugin failed to load entirely when installed from npm**
31
+ ([#2](https://github.com/GamingNowEdward/opencode-usage-limits/issues/2)): 0.3.1 shipped raw `.tsx`
32
+ source, but OpenCode only runs its own Solid Babel transform on plugin files that live **outside**
33
+ `node_modules`. In an npm-installed plugin directory the source is transpiled by Bun alone, which
34
+ injects an `@opentui/solid/jsx-dev-runtime` import from the `@jsxImportSource` pragma. That injection
35
+ happens *after* the host rewrote the source imports, so it falls back to Bun's native resolution —
36
+ and `@opentui/solid` is an optional peer that npm never installs. The result was a `stage=load`
37
+ failure: no sidebar block and no entry in the plugin list. The package now ships **compiled output**:
38
+ `tui.tsx` is compiled with `babel-preset-solid { generate: "universal", moduleName: "@opentui/solid" }`
39
+ and bundled into `dist/tui.js`, which `exports["./tui"]` points at. The artifact only contains explicit
40
+ `@opentui/solid` / `solid-js` / `@opencode/plugin/tui` imports, which the host rewrites to its own runtime.
41
+
42
+ ### Changed
43
+
44
+ - Added `scripts/build.mjs` (`npm run build`; `npm run dev` watches), run automatically before publishing
45
+ through `prepack`.
46
+ - The published package no longer contains `tui.tsx` / `tui.ts` / `core.ts`, only `dist/tui.js` and
47
+ `index.ts`. The `.tsx` source stays in the repository for local development.
48
+
49
+ ### Thanks
50
+
51
+ - Thanks to [@third774](https://github.com/third774) for reporting the problem, pinpointing the injected
52
+ JSX runtime path, and verifying the compiled-output approach — 0.3.2 adopts that option.
53
+
9
54
  ## 0.3.1 - 2026-10-26
10
55
 
11
56
  ### Fixed
package/CHANGELOG.md CHANGED
@@ -4,6 +4,45 @@
4
4
 
5
5
  [简体中文](./CHANGELOG.md) · [English](./CHANGELOG.en.md)
6
6
 
7
+ ## 0.3.3 - 2026-11-05
8
+
9
+ ### 变更
10
+
11
+ - **Go 额度表同步官方 2026-11 版**([官方表](https://opencode.ai/v2/docs/console/go/)):
12
+ **DeepSeek V4.1 Flash 月度额度 $80 → $100**(Go Plus $160 → $200),这是本次唯一的金额上调。
13
+ - **新增 6 个模型**:`gemini-4-argon`($30/$120)、`kimi-k3.1-pro`($15/$60)、
14
+ `minimax-m3.1-flash`($20/$80)、`hy4`($60/$240)、`beam-free` 与 `iceman-contributor-free`(免费)。
15
+ - **`step-5-preview-free` 修正为 `step-5-preview`**:该模型已转为付费($15/$60),原先按免费显示 `∞` 有误。
16
+ - **移除 6 个官方已下架模型**:`grok-4.6`、`space-bunny`、`minimax-m2.7`、`deepseek-v4-flash`、
17
+ `deepseek-v4-flash-vision-exp`、`longcat-2.5-preview-free`。未收录模型继续显示 `—`。
18
+ - 额度表改为**按模型 ID 升序**排列,便于与官方表逐条对照;注释中的出处链接更新为
19
+ `https://opencode.ai/v2/docs/console/go/`。
20
+ - Go Teams 档(每个模型比 Go 高 $5)不纳入参考行,参考行仍显示 `$Go/$Go Plus`。
21
+
22
+ ## 0.3.2 - 2026-11-05
23
+
24
+ ### 修复
25
+
26
+ - **npm 安装后插件完全无法加载**([#2](https://github.com/GamingNowEdward/opencode-usage-limits/issues/2)):
27
+ 0.3.1 直接发布 `.tsx` 源码,而 OpenCode 只对 **node_modules 之外**的插件文件运行自带的 Solid
28
+ Babel 转换。npm 安装的插件目录里,源码由 Bun 自行转译,会按 `@jsxImportSource` 注入
29
+ `@opentui/solid/jsx-dev-runtime` 导入;该注入发生在宿主重写 import 之后,于是回到 Bun 原生解析,
30
+ 而 `@opentui/solid` 是可选 peer、npm 不会安装,最终 `stage=load` 失败,侧边栏不出现、插件列表也没有条目。
31
+ 现在改为**发布编译产物**:`tui.tsx` 经 `babel-preset-solid { generate: "universal",
32
+ moduleName: "@opentui/solid" }` 编译并打包为 `dist/tui.js`,`exports["./tui"]` 指向该文件。
33
+ 产物中只有显式的 `@opentui/solid` / `solid-js` / `@opencode/plugin/tui` 导入,宿主可以正常重写到自己的运行时。
34
+
35
+ ### 变更
36
+
37
+ - 新增构建脚本 `scripts/build.mjs`(`npm run build`;`npm run dev` 为监听模式),发布前由 `prepack` 自动执行。
38
+ - 发布包不再包含 `tui.tsx` / `tui.ts` / `core.ts`,仅包含 `dist/tui.js` 与 `index.ts`。
39
+ 仓库内仍保留 `.tsx` 源码,供本地开发使用。
40
+
41
+ ### 致谢
42
+
43
+ - 感谢 [@third774](https://github.com/third774) 报告该问题、定位到 JSX 运行时注入路径,并先行
44
+ 验证了「发布编译产物」这一方案;0.3.2 采用的是该方案。
45
+
7
46
  ## 0.3.1 - 2026-10-26
8
47
 
9
48
  ### 修复
package/README.en.md CHANGED
@@ -17,15 +17,17 @@ the percentage, a progress bar and the reset countdown for three rolling windows
17
17
  ▾ USAGE · OpenCode Go
18
18
  5 hours 0%
19
19
  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
20
- ↻ 5h $0.00 / $12.00
20
+ ↻ 5h
21
21
 
22
22
  Weekly 1%
23
23
  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
24
- ↻ 6d 4h $0.30 / $30.00
24
+ ↻ 6d 4h
25
25
 
26
26
  Monthly 60%
27
27
  ███████████████████░░░░░░░░░░░░░░░░░
28
- ↻ 7d 14h $36.00 / $60.00
28
+ ↻ 7d 14h
29
+
30
+ deepseek-v4.1-flash $100/$200
29
31
  ```
30
32
 
31
33
  ## Features
@@ -34,7 +36,7 @@ Monthly 60%
34
36
  - **Three windows**: rolling 5 hours / weekly / monthly, with percentage, bar and reset countdown.
35
37
  - **Green / yellow / red**: < 50% green, 50–79% yellow, ≥ 80% red (thresholds live in `core.ts`).
36
38
  - **Spend display**: ClinePass shows `used / limit` (caps read live from `/users/me/plan`, $10 / $25 / $50);
37
- OpenCode Go shows percentages only, with the selected model's allowance (e.g. `$80/$160`) noted at the bottom
39
+ OpenCode Go shows percentages only, with the selected model's allowance (e.g. `$100/$200`) noted at the bottom
38
40
  as a reference.
39
41
  - **Collapsible**: click the title row to collapse to a single line; the state is persisted.
40
42
  - **Unobtrusive**: nothing is rendered for any other provider, so it never takes up space.
@@ -127,14 +129,22 @@ and needs no key at all.
127
129
 
128
130
  | File | Purpose |
129
131
  | --- | --- |
130
- | [`tui.tsx`](./tui.tsx) | The TUI plugin itself |
132
+ | [`tui.tsx`](./tui.tsx) | The TUI plugin itself (JSX source) |
131
133
  | [`core.ts`](./core.ts) | Auth, API client, formatting, thresholds (pure logic, no JSX) |
132
134
  | [`index.ts`](./index.ts) | Server entrypoint (no-op) |
133
- | [`tui.ts`](./tui.ts) | Discovery entrypoint, re-exports `tui.tsx` |
135
+ | [`tui.ts`](./tui.ts) | Local-development discovery entry, re-exports `tui.tsx` |
136
+ | [`dist/tui.js`](./dist/tui.js) | **Published artifact**: `tui.tsx` compiled and bundled (`exports["./tui"]` points here) |
137
+ | [`scripts/build.mjs`](./scripts/build.mjs) | Build script (babel-preset-solid + esbuild) |
134
138
  | [`preview.mjs`](./preview.mjs) | Offline preview script |
135
139
  | [`AGENTS.md`](./AGENTS.md) | Development conventions |
136
140
  | [`CHANGELOG.md`](./CHANGELOG.md) | Changelog |
137
141
 
142
+ > Why the package ships compiled output: OpenCode only applies its Solid JSX transform to plugin files
143
+ > **outside** `node_modules`. Shipping raw `.tsx` meant Bun transpiled the plugin on the user's machine,
144
+ > injecting an unresolvable `@opentui/solid/jsx-dev-runtime` import, so the plugin failed at load time
145
+ > (see [#2](https://github.com/GamingNowEdward/opencode-usage-limits/issues/2)). After editing `tui.tsx`,
146
+ > run `npm run build` and commit `dist/tui.js`.
147
+
138
148
  ## Offline preview
139
149
 
140
150
  Verify the API and layout without starting the TUI (it reads your real local key):
@@ -147,8 +157,12 @@ node preview.mjs cline-pass # a single source
147
157
  ## Troubleshooting
148
158
 
149
159
  1. Make sure the current model belongs to `opencode-go` or `cline-pass`.
150
- 2. Plugin files **hot reload on save** — no restart needed. Only adding or removing an imported file requires restarting the TUI.
160
+ 2. When developing from a local directory, plugin files **hot reload on save**, but the bundle must be
161
+ rebuilt first: run `npm run dev` to watch the source and update `dist/tui.js`. The host loads that
162
+ artifact, not `tui.tsx`.
151
163
  3. Check the log: `~/.local/share/opencode/log/opencode.log`, filter by `role=cli` and `plugin`.
164
+ A `stage=load` failure mentioning `Cannot find package '@opentui/solid'` means you are on 0.3.1 or
165
+ earlier; upgrading to 0.3.2+ fixes it (see the [CHANGELOG](./CHANGELOG.en.md)).
152
166
  4. If the panel shows **API key not found**, check the login first:
153
167
 
154
168
  ```sh
package/README.md CHANGED
@@ -17,15 +17,17 @@
17
17
  ▾ USAGE · OpenCode Go
18
18
  5 hours 0%
19
19
  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
20
- ↻ 5h $0.00 / $12.00
20
+ ↻ 5h
21
21
 
22
22
  Weekly 1%
23
23
  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
24
- ↻ 6d 4h $0.30 / $30.00
24
+ ↻ 6d 4h
25
25
 
26
26
  Monthly 60%
27
27
  ███████████████████░░░░░░░░░░░░░░░░░
28
- ↻ 7d 14h $36.00 / $60.00
28
+ ↻ 7d 14h
29
+
30
+ deepseek-v4.1-flash $100/$200
29
31
  ```
30
32
 
31
33
  ## 功能
@@ -33,7 +35,7 @@ Monthly 60%
33
35
  - **两个用量来源**:OpenCode Go、ClinePass,按当前模型自动切换。
34
36
  - **三个窗口**:5 小时滚动 / 周 / 月,含百分比、进度条、重置倒计时。
35
37
  - **绿黄红提醒**:< 50% 绿、50–79% 黄、≥ 80% 红(阈值见 `core.ts`)。
36
- - **金额显示**:ClinePass 显示 `已用 / 限额`(限额从 `/users/me/plan` 实时读取,$10 / $25 / $50);OpenCode Go 只显示百分比,并在**底部**标注当前模型的额度(如 `$80/$160`)供参考。
38
+ - **金额显示**:ClinePass 显示 `已用 / 限额`(限额从 `/users/me/plan` 实时读取,$10 / $25 / $50);OpenCode Go 只显示百分比,并在**底部**标注当前模型的额度(如 `$100/$200`)供参考。
37
39
  - **整体折叠**:点标题行收起,只留一行;状态持久化,重启保持。
38
40
  - **不打扰**:选中其他 provider 时**完全不渲染**,不占空间。
39
41
  - **限流退避**:遇 429 / 5xx / 网络失败自动指数退避(最长 5 分钟),并显示 `retry in Ns`。
@@ -121,14 +123,21 @@ CLI 插件在本地 TUI 进程内运行,因此可以调用 OpenCode 的凭据
121
123
 
122
124
  | 文件 | 说明 |
123
125
  | --- | --- |
124
- | [`tui.tsx`](./tui.tsx) | TUI 插件主体 |
126
+ | [`tui.tsx`](./tui.tsx) | TUI 插件主体(JSX 源码) |
125
127
  | [`core.ts`](./core.ts) | 鉴权、API 客户端、格式化、阈值(纯逻辑,无 JSX) |
126
128
  | [`index.ts`](./index.ts) | server 入口(no-op) |
127
- | [`tui.ts`](./tui.ts) | 发现入口,re-export `tui.tsx` |
129
+ | [`tui.ts`](./tui.ts) | 本地开发用的发现入口,re-export `tui.tsx` |
130
+ | [`dist/tui.js`](./dist/tui.js) | **发布产物**:`tui.tsx` 编译打包后的入口(`exports["./tui"]` 指向它) |
131
+ | [`scripts/build.mjs`](./scripts/build.mjs) | 构建脚本(babel-preset-solid + esbuild) |
128
132
  | [`preview.mjs`](./preview.mjs) | 离线预览脚本 |
129
133
  | [`AGENTS.md`](./AGENTS.md) | 开发约定 |
130
134
  | [`CHANGELOG.md`](./CHANGELOG.md) | 变更日志 |
131
135
 
136
+ > 为什么发布编译产物:OpenCode 只对 `node_modules` **之外**的插件文件应用自带的 Solid JSX 转换。
137
+ > 若直接发布 `.tsx`,npm 安装后由 Bun 自行转译,会注入无法解析的 `@opentui/solid/jsx-dev-runtime`
138
+ > 导入,插件在加载阶段即失败(见 [#2](https://github.com/GamingNowEdward/opencode-usage-limits/issues/2))。
139
+ > 修改 `tui.tsx` 后请运行 `npm run build` 并提交 `dist/tui.js`。
140
+
132
141
  ## 离线预览
133
142
 
134
143
  无需启动 TUI 即可验证接口与排版(会读取你本机的真实密钥):
@@ -141,8 +150,11 @@ node preview.mjs cline-pass # 只预览一个
141
150
  ## 排障
142
151
 
143
152
  1. 确认当前模型属于 `opencode-go` 或 `cline-pass`。
144
- 2. 插件文件**保存即热重载**,无需重启;只有新增/删除被 import 的文件时才需退出 TUI 重进。
153
+ 2. 从本地目录开发时,插件文件**保存即热重载**,但需要先重建产物:`npm run dev` 监听源码并更新
154
+ `dist/tui.js`;宿主加载的是该产物,不是 `tui.tsx`。
145
155
  3. 查看日志:`~/.local/share/opencode/log/opencode.log`,筛 `role=cli` 与 `plugin`。
156
+ 若出现 `stage=load` 且报 `Cannot find package '@opentui/solid'`,说明装到了 0.3.1 或更早版本,
157
+ 升级到 0.3.2+ 即可(详见 [CHANGELOG](./CHANGELOG.md))。
146
158
  4. 面板显示 **API key not found** 时,先确认登录状态:
147
159
 
148
160
  ```sh