@jeffreyjyz/opencode-command-code 0.5.10 → 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 +1 -1
- package/dist/sidebar/useRows.d.ts +5 -0
- package/dist/tui.js +19 -11
- 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.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",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ModelMeta, type ModelUsage, type SidebarRow, type Usage } from "./rows";
|
|
2
|
+
import { type ZenUsage } from "./zen";
|
|
2
3
|
/**
|
|
3
4
|
* Which family a session's provider belongs to, as far as this panel is
|
|
4
5
|
* concerned. `unknown` is the frame during a session switch, before the host has
|
|
@@ -35,4 +36,8 @@ export declare function seededModelUsage(id: string | undefined, session?: strin
|
|
|
35
36
|
export declare function rememberMeta(meta: Map<string, ModelMeta>): void;
|
|
36
37
|
/** Rows to paint before mpc's catalog is read again. */
|
|
37
38
|
export declare function seededMeta(): Map<string, ModelMeta>;
|
|
39
|
+
/** Keep a Go/Zen snapshot for the next panel that needs it. */
|
|
40
|
+
export declare function rememberZen(usage: ZenUsage): void;
|
|
41
|
+
/** The remembered Go/Zen snapshot, or undefined on the first panel. */
|
|
42
|
+
export declare function seededZen(): ZenUsage | undefined;
|
|
38
43
|
export declare function useRows(activeModelId: () => string | undefined, providerID: () => string | undefined, sessionID: () => string | undefined): import("solid-js").Accessor<SidebarRow[]>;
|
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,
|
|
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
|
|
2195
|
+
const local = typeof spent === "number" ? ` \xB7 ${money(spent)} local` : "";
|
|
2196
2196
|
return windowRows(label, {
|
|
2197
|
-
cap:
|
|
2198
|
-
used:
|
|
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,
|
|
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,
|
|
2220
|
-
rows.push(...zenMeterRows("Weekly", usage.account.weekly, now, WEEKLY_SECS,
|
|
2221
|
-
rows.push(...zenMeterRows("Monthly", usage.account.monthly, now, period?.durSecs ?? 0,
|
|
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)));
|
|
@@ -2597,9 +2596,16 @@ function rememberMeta(meta) {
|
|
|
2597
2596
|
function seededMeta() {
|
|
2598
2597
|
return lastMeta ?? new Map;
|
|
2599
2598
|
}
|
|
2599
|
+
var lastZen;
|
|
2600
|
+
function rememberZen(usage) {
|
|
2601
|
+
lastZen = usage;
|
|
2602
|
+
}
|
|
2603
|
+
function seededZen() {
|
|
2604
|
+
return lastZen;
|
|
2605
|
+
}
|
|
2600
2606
|
function useRows(activeModelId, providerID, sessionID) {
|
|
2601
2607
|
const [usage, setUsage] = createSignal(seededRows());
|
|
2602
|
-
const [zen, setZen] = createSignal();
|
|
2608
|
+
const [zen, setZen] = createSignal(seededZen());
|
|
2603
2609
|
const [meta, setMeta] = createSignal(seededMeta());
|
|
2604
2610
|
const [modelUsage, setModelUsage] = createSignal(lastModelUsage);
|
|
2605
2611
|
const [sessionUsage, setSessionUsage] = createSignal();
|
|
@@ -2650,7 +2656,9 @@ function useRows(activeModelId, providerID, sessionID) {
|
|
|
2650
2656
|
setUsage(usageRows(snapshot));
|
|
2651
2657
|
refreshModelUsage(activeModelId());
|
|
2652
2658
|
} else if (kind === "go" || kind === "zen") {
|
|
2653
|
-
|
|
2659
|
+
const snapshot = await loadZen(loadPrefs().ocPlan);
|
|
2660
|
+
rememberZen(snapshot);
|
|
2661
|
+
setZen(snapshot);
|
|
2654
2662
|
refreshModelUsage(activeModelId());
|
|
2655
2663
|
refreshModelWindows(activeModelId());
|
|
2656
2664
|
}
|
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.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",
|