opencode-usage-report 0.6.2 → 0.6.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 +5 -0
- package/package.json +7 -3
- package/src/providers/kimi.ts +16 -7
package/README.md
CHANGED
|
@@ -302,6 +302,11 @@ so a failing check blocks the stage.
|
|
|
302
302
|
|
|
303
303
|
## Changelog
|
|
304
304
|
|
|
305
|
+
- **0.6.3** — Kimi Code CN (`kimi-code-plan-cn`): the 5-hour window falls back
|
|
306
|
+
to the `usages.limit_5h` ratio when the `limits[]` row carries no counts,
|
|
307
|
+
instead of rendering an empty `—` bar; a monthly window is also read from a
|
|
308
|
+
counted 30-day `limits[]` entry when the endpoint reports it there. Includes
|
|
309
|
+
the outstanding Dependabot dev-dependency bumps.
|
|
305
310
|
- **0.6.2** — OpenCode 2 context panel fixes: the V2 adapter now reads the
|
|
306
311
|
model id from the store's `model.id`, so the model lookup succeeds and the
|
|
307
312
|
cell grid, per-category percentages and compaction-headroom line render
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-usage-report",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "opencode plugin: /usage command showing subscription quota windows for configured providers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kimi",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@opencode-ai/plugin": "^1.0.0",
|
|
51
|
-
"@opentui/core": "^0.
|
|
51
|
+
"@opentui/core": "^0.6.2",
|
|
52
52
|
"@opentui/solid": "^0.5.11",
|
|
53
53
|
"@types/node": "^26.6.2",
|
|
54
|
-
"oxfmt": "^0.
|
|
54
|
+
"oxfmt": "^0.72.0",
|
|
55
55
|
"oxlint": "^1.85.0",
|
|
56
56
|
"solid-js": "1.9.12",
|
|
57
57
|
"tsx": "^4.19.0",
|
|
@@ -63,5 +63,9 @@
|
|
|
63
63
|
"@opentui/core": ">=0.5.11",
|
|
64
64
|
"@opentui/solid": ">=0.5.11",
|
|
65
65
|
"solid-js": ">=1.9.0"
|
|
66
|
+
},
|
|
67
|
+
"overrides": {
|
|
68
|
+
"seroval": "1.6.9",
|
|
69
|
+
"seroval-plugins": "1.6.9"
|
|
66
70
|
}
|
|
67
71
|
}
|
package/src/providers/kimi.ts
CHANGED
|
@@ -161,13 +161,18 @@ function parse(body: Record<string, unknown>, cred: Credential): AdapterResult {
|
|
|
161
161
|
|
|
162
162
|
// Count-based windows are authoritative when present; the `usages.limit_*`
|
|
163
163
|
// ratios are the primary wire on the post-2026-09 quota model, where the
|
|
164
|
-
// absolute `usage`/`limits[]` rows were removed.
|
|
164
|
+
// absolute `usage`/`limits[]` rows were removed. Some regional responses
|
|
165
|
+
// send a limits[] 5h row with no counts, so fall back to its ratio instead
|
|
166
|
+
// of rendering an empty bar.
|
|
165
167
|
const detail5h = findLimitDetail(limits, 300);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
const limit5h = pick(usages, "limit_5h");
|
|
169
|
+
const fiveHour = detail5h === undefined ? undefined : detailWindow("5h", "5-hour", detail5h);
|
|
170
|
+
if (fiveHour !== undefined && fiveHour.usedPercent !== null) {
|
|
171
|
+
windows.push(fiveHour);
|
|
172
|
+
} else if (limit5h !== undefined) {
|
|
173
|
+
windows.push(ratioWindow("5h", "5-hour", limit5h));
|
|
174
|
+
} else if (fiveHour !== undefined) {
|
|
175
|
+
windows.push(fiveHour);
|
|
171
176
|
}
|
|
172
177
|
|
|
173
178
|
if (usage !== undefined) {
|
|
@@ -179,12 +184,16 @@ function parse(body: Record<string, unknown>, cred: Credential): AdapterResult {
|
|
|
179
184
|
|
|
180
185
|
// The monthly total joined the quota model; `totalQuota` is the legacy shape.
|
|
181
186
|
// `limit_month_code` is the code-typed share the official client shows as a
|
|
182
|
-
// breakdown under the monthly row.
|
|
187
|
+
// breakdown under the monthly row. Some regional responses carry the monthly
|
|
188
|
+
// window as a counted 30-day entry in `limits[]` instead.
|
|
183
189
|
const monthTotal = pick(usages, "limit_month_total");
|
|
190
|
+
const detailMonth = findLimitDetail(limits, 43200);
|
|
184
191
|
if (monthTotal !== undefined) {
|
|
185
192
|
windows.push(ratioWindow("monthly", "Monthly", monthTotal));
|
|
186
193
|
const codePercent = ratioPercent(pick(usages, "limit_month_code"));
|
|
187
194
|
if (codePercent !== null) extras["Monthly code"] = `${codePercent}%`;
|
|
195
|
+
} else if (detailMonth !== undefined) {
|
|
196
|
+
windows.push(detailWindow("monthly", "Monthly", detailMonth));
|
|
188
197
|
} else {
|
|
189
198
|
const totalQuota = pick(body, "totalQuota", "total_quota");
|
|
190
199
|
const quotaUsed = toNumber(pick(totalQuota, "used"));
|