opencode-go-usage-tui 1.2.0 → 1.3.1

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,10 +6,19 @@
6
6
 
7
7
  </div>
8
8
 
9
- 在 OpenCode 侧边栏实时显示 OpenCode Go 额度用量(5小时/每周/每月)。
9
+ 在 OpenCode 侧边栏实时显示 OpenCode Go 额度用量(5小时/每周/每月)与模型请求限额。
10
10
 
11
11
  支持中英双语界面(`/go-lang` 切换,首次启动自动引导选择语言)。
12
12
 
13
+ ## 功能
14
+
15
+ - **双独立面板**:`Go 用量`(额度百分比 + 进度条)+ `模型价格`(请求限额表),可独立折叠
16
+ - **模型请求限额**:从 opencode.ai/docs/go 实时抓取各模型 5小时/每周/每月 请求数上限(无需登录)
17
+ - **关注模型**:`/go-settings` 设置关注的白名单,只显示你关心的模型
18
+ - **刷新间隔可调**:用量刷新和价格刷新间隔均可通过 `/go-settings` 设置(秒)
19
+ - **安全加密**:auth cookie 用 AES-256-GCM 加密存储,旧明文自动迁移
20
+ - **自动提醒**:价格/限额变化时弹 toast 通知,变化历史保留最近 10 次
21
+
13
22
  ## 安装
14
23
 
15
24
  ### 方式一:OpenCode 命令安装(推荐)
@@ -20,7 +29,7 @@
20
29
  opencode-go-usage-tui@latest
21
30
  ```
22
31
 
23
- 回车完成安装,重启 OpenCode 后侧边栏即可看到"Go 用量"面板。
32
+ 回车完成安装,重启 OpenCode 后侧边栏即可看到两个面板。
24
33
 
25
34
  ### 方式二:npm 全局安装
26
35
 
@@ -77,10 +86,25 @@ npm install -g opencode-go-usage-tui
77
86
  ```json
78
87
  {
79
88
  "workspace_id": "wrk_xxxxxxxxxxxx",
80
- "cookie": "Fe26.2*..."
89
+ "cookie": "Fe26.2*...",
90
+ "ui": {
91
+ "usage_panel": true,
92
+ "price_panel": true
93
+ },
94
+ "focus_models": ["grok-4-5"],
95
+ "refresh_interval_sec": 60,
96
+ "pricing_interval_sec": 1800
81
97
  }
82
98
  ```
83
99
 
100
+ | 字段 | 说明 |
101
+ | ---- | ---- |
102
+ | `ui.usage_panel` | 显示/隐藏用量面板(默认 true) |
103
+ | `ui.price_panel` | 显示/隐藏价格面板(默认 true) |
104
+ | `focus_models` | 关注模型白名单(空数组显示全部) |
105
+ | `refresh_interval_sec` | 用量刷新间隔秒数(默认 60) |
106
+ | `pricing_interval_sec` | 价格刷新间隔秒数(默认 1800) |
107
+
84
108
  ## 获取 auth cookie
85
109
 
86
110
  1. Chrome 登录 opencode.ai
@@ -91,11 +115,20 @@ Cookie 有效期约 1 年,过期后重新获取。
91
115
 
92
116
  ## 使用
93
117
 
94
- - 侧边栏面板每 60 秒自动刷新(可用 `OPENCODE_GO_CHECK_INTERVAL` 环境变量调整,单位毫秒)
118
+ - **`/go-config`**:设置 workspace_id auth cookie
119
+ - **`/go-settings`**:设置关注模型、用量刷新间隔、价格刷新间隔
120
+ - **`/go-lang`**:切换 中文 / English
95
121
  - 用量超过阈值(默认 80%,可用 `OPENCODE_GO_WARN_THRESHOLD` 调整)显示为红色
96
122
  - 点击面板标题可折叠/展开
97
- - 配置错误时面板会提示"未配置账号",输入 `/go-config` 即可设置
98
- - 面板标题显示当前插件版本号(如 `v1.1.0`)
123
+ - 面板标题显示当前插件版本号(如 `v1.3.1`)
124
+
125
+ ## 模型请求限额面板
126
+
127
+ - 独立面板显示各模型的 5小时/每周/每月 请求数上限,表格风格两端对齐(值与面板右缘对齐)
128
+ - 从 opencode.ai/docs/go 实时抓取公开数据(无需登录)
129
+ - 默认每 30 分钟自动刷新(可用 `/go-settings` 或 `pricing_interval_sec` 调整)
130
+ - 每次刷新自动对比上次数据,变化时 toast 提醒,历史保留最近 10 次到 `go-pricing-data.json`
131
+ - 额度达到 100%(`rate-limited` 状态)时仍正常显示用量与重置时间,不会出现"查询失败"
99
132
 
100
133
  ## 语言
101
134
 
package/README_EN.md CHANGED
@@ -6,10 +6,19 @@
6
6
 
7
7
  </div>
8
8
 
9
- Display your OpenCode Go quota usage (5h / weekly / monthly) in the OpenCode sidebar in real time.
9
+ Display your OpenCode Go quota usage (5h / weekly / monthly) and model request limits in the OpenCode sidebar in real time.
10
10
 
11
11
  Bilingual UI (Chinese / English) — switch with `/go-lang`, or pick a language during the first-run onboarding.
12
12
 
13
+ ## Features
14
+
15
+ - **Two independent panels**: `Go Usage` (quota percentage + progress bar) + `Model Pricing` (request limits table), each collapsible independently
16
+ - **Model request limits**: scrapes real-time 5h / weekly / monthly request caps per model from opencode.ai/docs/go (no login required)
17
+ - **Focused models**: use `/go-settings` to whitelist only the models you care about
18
+ - **Adjustable refresh intervals**: set usage and pricing refresh intervals via `/go-settings` (in seconds)
19
+ - **Secure storage**: auth cookie encrypted with AES-256-GCM, legacy plaintext auto-migrated
20
+ - **Change alerts**: toast notification when prices/limits change; last 10 changes kept
21
+
13
22
  ## Install
14
23
 
15
24
  ### Option 1: Install via OpenCode command (recommended)
@@ -20,7 +29,7 @@ In OpenCode, press **`Ctrl+P`** to open the command palette, search for **`insta
20
29
  opencode-go-usage-tui@latest
21
30
  ```
22
31
 
23
- Press Enter, restart OpenCode, and the "Go Usage" panel will appear in the sidebar.
32
+ Press Enter, restart OpenCode, and both panels will appear in the sidebar.
24
33
 
25
34
  ### Option 2: npm global install
26
35
 
@@ -77,10 +86,25 @@ Create `~/.config/opencode/go-usage-config.json` manually:
77
86
  ```json
78
87
  {
79
88
  "workspace_id": "wrk_xxxxxxxxxxxx",
80
- "cookie": "Fe26.2*..."
89
+ "cookie": "Fe26.2*...",
90
+ "ui": {
91
+ "usage_panel": true,
92
+ "price_panel": true
93
+ },
94
+ "focus_models": ["grok-4-5"],
95
+ "refresh_interval_sec": 60,
96
+ "pricing_interval_sec": 1800
81
97
  }
82
98
  ```
83
99
 
100
+ | Field | Description |
101
+ | ----- | ----------- |
102
+ | `ui.usage_panel` | Show/hide usage panel (default true) |
103
+ | `ui.price_panel` | Show/hide pricing panel (default true) |
104
+ | `focus_models` | Focused model whitelist (empty array shows all) |
105
+ | `refresh_interval_sec` | Usage refresh interval in seconds (default 60) |
106
+ | `pricing_interval_sec` | Pricing refresh interval in seconds (default 1800) |
107
+
84
108
  ## Getting the auth cookie
85
109
 
86
110
  1. Log into opencode.ai in Chrome
@@ -91,11 +115,20 @@ The cookie is valid for about 1 year; get a new one after it expires.
91
115
 
92
116
  ## Usage
93
117
 
94
- - The sidebar panel auto-refreshes every 60 seconds (adjustable via `OPENCODE_GO_CHECK_INTERVAL`, in milliseconds)
118
+ - **`/go-config`**: set workspace_id and auth cookie
119
+ - **`/go-settings`**: set focused models, usage refresh interval, pricing refresh interval
120
+ - **`/go-lang`**: switch between 中文 / English
95
121
  - Usage above the threshold (default 80%, adjustable via `OPENCODE_GO_WARN_THRESHOLD`) is shown in red
96
122
  - Click the panel title to collapse/expand
97
- - If misconfigured, the panel shows "Not configured" run `/go-config` to set up
98
- - The panel title shows the current plugin version (e.g. `v1.1.0`)
123
+ - The panel title shows the current plugin version (e.g. `v1.3.1`)
124
+
125
+ ## Model request limits panel
126
+
127
+ - Independent panel showing each model's 5h / weekly / monthly request caps, table style with values right-aligned to the panel edge
128
+ - Scraped live from opencode.ai/docs/go (public data, no login)
129
+ - Auto-refreshes every 30 minutes by default (adjustable via `/go-settings` or `pricing_interval_sec`)
130
+ - Each refresh diffs against the last snapshot; toast on change; last 10 changes kept in `go-pricing-data.json`
131
+ - When quota hits 100% (`rate-limited` status), usage and reset time still display normally - no "query failed" error
99
132
 
100
133
  ## Language
101
134