@jeffreyjyz/opencode-command-code 0.5.8 → 0.5.9
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/dist/index.js +1 -1
- package/dist/tui.js +14 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2414,7 +2414,7 @@ function superRefine(fn) {
|
|
|
2414
2414
|
// package.json
|
|
2415
2415
|
var package_default = {
|
|
2416
2416
|
name: "@jeffreyjyz/opencode-command-code",
|
|
2417
|
-
version: "0.5.
|
|
2417
|
+
version: "0.5.9",
|
|
2418
2418
|
description: "Command Code provider + usage dashboard for opencode: two providers (Anthropic wire for Claude, OpenAI wire for everything else) against api.commandcode.ai, live model list, plan gating, /cmd-usage. Requires the cmduse CLI for usage rendering.",
|
|
2419
2419
|
type: "module",
|
|
2420
2420
|
main: "dist/index.js",
|
package/dist/tui.js
CHANGED
|
@@ -2189,14 +2189,19 @@ function zenWindow(label, spent, limit, share, now, durSecs, resetAt) {
|
|
|
2189
2189
|
exceeded: spent.cost >= cap
|
|
2190
2190
|
}, now, durSecs, spent.requests > 0 ? `${count(spent.requests)} req` : undefined);
|
|
2191
2191
|
}
|
|
2192
|
-
function zenMeterRows(label, meter, now, durSecs,
|
|
2192
|
+
function zenMeterRows(label, meter, now, durSecs, spent) {
|
|
2193
|
+
const pct = meter.percent;
|
|
2194
|
+
const pair = typeof spent === "number" && pct >= 0.05 ? {
|
|
2195
|
+
used: spent,
|
|
2196
|
+
cap: spent * 100 / pct
|
|
2197
|
+
} : undefined;
|
|
2193
2198
|
return windowRows(label, {
|
|
2194
|
-
cap:
|
|
2195
|
-
used:
|
|
2199
|
+
cap: pair?.cap ?? 100,
|
|
2200
|
+
used: pair?.used ?? pct,
|
|
2196
2201
|
resetAt: meter.resetsAt,
|
|
2197
|
-
sharePct:
|
|
2198
|
-
exceeded:
|
|
2199
|
-
}, now, durSecs, undefined, (used, cap) =>
|
|
2202
|
+
sharePct: pct,
|
|
2203
|
+
exceeded: pct >= 100 || meter.status !== "ok"
|
|
2204
|
+
}, now, durSecs, undefined, pair ? (used, cap) => `${money(used)}/${money(cap)} (${pct.toFixed(1)}%)` : () => `${pct.toFixed(1)}% of limit`);
|
|
2200
2205
|
}
|
|
2201
2206
|
function zenRows(usage, meta, modelUsage, session, fallbackName, windows) {
|
|
2202
2207
|
if (!usage)
|
|
@@ -2210,15 +2215,11 @@ function zenRows(usage, meta, modelUsage, session, fallbackName, windows) {
|
|
|
2210
2215
|
const mine = usage.models.get(modelKey(fallbackName ?? "")) ?? (meta ? usage.models.get(modelKey(meta.name)) : undefined);
|
|
2211
2216
|
const limit = oc?.allowance ?? mine?.limit;
|
|
2212
2217
|
const cap = mine ? limit : undefined;
|
|
2213
|
-
const windowMoney = (spent, share) => mine && typeof limit === "number" && limit > 0 ? {
|
|
2214
|
-
spent: spent.cost,
|
|
2215
|
-
cap: limit * share
|
|
2216
|
-
} : undefined;
|
|
2217
2218
|
const period = monthPeriod(usage);
|
|
2218
2219
|
if (usage.account) {
|
|
2219
|
-
rows.push(...zenMeterRows("5-hour", usage.account.rolling, now, FIVE_HOUR_SECS,
|
|
2220
|
-
rows.push(...zenMeterRows("Weekly", usage.account.weekly, now, WEEKLY_SECS,
|
|
2221
|
-
rows.push(...zenMeterRows("Monthly", usage.account.monthly, now, period?.durSecs ?? 0,
|
|
2220
|
+
rows.push(...zenMeterRows("5-hour", usage.account.rolling, now, FIVE_HOUR_SECS, usage.totals.fiveHour.cost));
|
|
2221
|
+
rows.push(...zenMeterRows("Weekly", usage.account.weekly, now, WEEKLY_SECS, usage.totals.weekly.cost));
|
|
2222
|
+
rows.push(...zenMeterRows("Monthly", usage.account.monthly, now, period?.durSecs ?? 0, usage.totals.month.cost));
|
|
2222
2223
|
} else {
|
|
2223
2224
|
rows.push(...zenWindow("5-hour", mine?.fiveHour ?? usage.totals.fiveHour, cap, GO_WINDOW_SHARE.fiveHour, now, FIVE_HOUR_SECS, rollingReset(windows?.fiveHour, FIVE_HOUR_SECS)));
|
|
2224
2225
|
rows.push(...zenWindow("Weekly", mine?.weekly ?? usage.totals.weekly, cap, GO_WINDOW_SHARE.weekly, now, WEEKLY_SECS, rollingReset(windows?.weekly, WEEKLY_SECS)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffreyjyz/opencode-command-code",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "Command Code provider + usage dashboard for opencode: two providers (Anthropic wire for Claude, OpenAI wire for everything else) against api.commandcode.ai, live model list, plan gating, /cmd-usage. Requires the cmduse CLI for usage rendering.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|