@jeffreyjyz/opencode-command-code 0.5.11 → 0.5.12

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 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.11",
2417
+ version: "0.5.12",
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,17 +2189,17 @@ 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, cap) {
2192
+ function zenMeterRows(label, meter, now, durSecs, spent) {
2193
2193
  const pct = meter.percent;
2194
2194
  const pctText = Number.isInteger(pct) ? String(pct) : pct.toFixed(1);
2195
- const paired = typeof cap === "number" && cap > 0;
2195
+ const local = typeof spent === "number" ? ` \xB7 ${money(spent)} local` : "";
2196
2196
  return windowRows(label, {
2197
- cap: paired ? cap : 100,
2198
- used: paired ? cap * pct / 100 : pct,
2197
+ cap: 100,
2198
+ used: pct,
2199
2199
  resetAt: meter.resetsAt,
2200
2200
  sharePct: pct,
2201
2201
  exceeded: pct >= 100 || meter.status !== "ok"
2202
- }, now, durSecs, undefined, paired ? (used, cap) => `${money(used)}/${money(cap)} (${pctText}%)` : () => `${pctText}% of limit`);
2202
+ }, now, durSecs, undefined, () => `${pctText}% of limit${local}`);
2203
2203
  }
2204
2204
  function zenRows(usage, meta, modelUsage, session, fallbackName, windows) {
2205
2205
  if (!usage)
@@ -2213,12 +2213,11 @@ function zenRows(usage, meta, modelUsage, session, fallbackName, windows) {
2213
2213
  const mine = usage.models.get(modelKey(fallbackName ?? "")) ?? (meta ? usage.models.get(modelKey(meta.name)) : undefined);
2214
2214
  const limit = oc?.allowance ?? mine?.limit;
2215
2215
  const cap = mine ? limit : undefined;
2216
- const documented = (allowance, share) => typeof allowance === "number" && allowance > 0 ? allowance * share : undefined;
2217
2216
  const period = monthPeriod(usage);
2218
2217
  if (usage.account) {
2219
- rows.push(...zenMeterRows("5-hour", usage.account.rolling, now, FIVE_HOUR_SECS, documented(limit, GO_WINDOW_SHARE.fiveHour)));
2220
- rows.push(...zenMeterRows("Weekly", usage.account.weekly, now, WEEKLY_SECS, documented(limit, GO_WINDOW_SHARE.weekly)));
2221
- rows.push(...zenMeterRows("Monthly", usage.account.monthly, now, period?.durSecs ?? 0, documented(limit, GO_WINDOW_SHARE.month)));
2218
+ rows.push(...zenMeterRows("5-hour", usage.account.rolling, now, FIVE_HOUR_SECS, usage.totals.fiveHour.cost));
2219
+ rows.push(...zenMeterRows("Weekly", usage.account.weekly, now, WEEKLY_SECS, usage.totals.weekly.cost));
2220
+ rows.push(...zenMeterRows("Monthly", usage.account.monthly, now, period?.durSecs ?? 0, usage.totals.month.cost));
2222
2221
  } else {
2223
2222
  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
2223
  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.11",
3
+ "version": "0.5.12",
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",