@jeffreyjyz/opencode-command-code 0.5.9 → 0.5.11
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 +22 -15
- package/dist/sidebar/useRows.d.ts +5 -0
- package/dist/tui.js +21 -13
- package/package.json +8 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// node_modules/zod/v4/core/core.js
|
|
2
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/core/core.js
|
|
3
3
|
var NEVER = Object.freeze({
|
|
4
4
|
status: "aborted"
|
|
5
5
|
});
|
|
@@ -66,7 +66,7 @@ function config(newConfig) {
|
|
|
66
66
|
Object.assign(globalConfig, newConfig);
|
|
67
67
|
return globalConfig;
|
|
68
68
|
}
|
|
69
|
-
// node_modules/zod/v4/core/util.js
|
|
69
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/core/util.js
|
|
70
70
|
function jsonStringifyReplacer(_, value) {
|
|
71
71
|
if (typeof value === "bigint")
|
|
72
72
|
return value.toString();
|
|
@@ -240,7 +240,7 @@ function issue(...args) {
|
|
|
240
240
|
return { ...iss };
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
// node_modules/zod/v4/core/errors.js
|
|
243
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/core/errors.js
|
|
244
244
|
var initializer = (inst, def) => {
|
|
245
245
|
inst.name = "$ZodError";
|
|
246
246
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -309,7 +309,7 @@ function formatError(error, _mapper) {
|
|
|
309
309
|
return fieldErrors;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
// node_modules/zod/v4/core/parse.js
|
|
312
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/core/parse.js
|
|
313
313
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
314
314
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
315
315
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -386,7 +386,7 @@ var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
386
386
|
var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
387
387
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
388
388
|
};
|
|
389
|
-
// node_modules/zod/v4/core/regexes.js
|
|
389
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/core/regexes.js
|
|
390
390
|
var cuid = /^[cC][^\s-]{8,}$/;
|
|
391
391
|
var cuid2 = /^[0-9a-z]+$/;
|
|
392
392
|
var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
@@ -440,7 +440,7 @@ var string = (params) => {
|
|
|
440
440
|
var lowercase = /^[^A-Z]*$/;
|
|
441
441
|
var uppercase = /^[^a-z]*$/;
|
|
442
442
|
|
|
443
|
-
// node_modules/zod/v4/core/checks.js
|
|
443
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/core/checks.js
|
|
444
444
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
445
445
|
var _a;
|
|
446
446
|
inst._zod ?? (inst._zod = {});
|
|
@@ -667,14 +667,14 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
|
|
|
667
667
|
};
|
|
668
668
|
});
|
|
669
669
|
|
|
670
|
-
// node_modules/zod/v4/core/versions.js
|
|
670
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/core/versions.js
|
|
671
671
|
var version = {
|
|
672
672
|
major: 4,
|
|
673
673
|
minor: 1,
|
|
674
674
|
patch: 8
|
|
675
675
|
};
|
|
676
676
|
|
|
677
|
-
// node_modules/zod/v4/core/schemas.js
|
|
677
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/core/schemas.js
|
|
678
678
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
679
679
|
var _a;
|
|
680
680
|
inst ?? (inst = {});
|
|
@@ -1515,7 +1515,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
1515
1515
|
payload.issues.push(issue(_iss));
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
|
-
// node_modules/zod/v4/core/registries.js
|
|
1518
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/core/registries.js
|
|
1519
1519
|
var $output = Symbol("ZodOutput");
|
|
1520
1520
|
var $input = Symbol("ZodInput");
|
|
1521
1521
|
|
|
@@ -1566,7 +1566,7 @@ function registry() {
|
|
|
1566
1566
|
return new $ZodRegistry;
|
|
1567
1567
|
}
|
|
1568
1568
|
var globalRegistry = /* @__PURE__ */ registry();
|
|
1569
|
-
// node_modules/zod/v4/core/api.js
|
|
1569
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/core/api.js
|
|
1570
1570
|
function _string(Class, params) {
|
|
1571
1571
|
return new Class({
|
|
1572
1572
|
type: "string",
|
|
@@ -1940,7 +1940,7 @@ function _check(fn, params) {
|
|
|
1940
1940
|
ch._zod.check = fn;
|
|
1941
1941
|
return ch;
|
|
1942
1942
|
}
|
|
1943
|
-
// node_modules/zod/v4/classic/iso.js
|
|
1943
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/classic/iso.js
|
|
1944
1944
|
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
1945
1945
|
$ZodISODateTime.init(inst, def);
|
|
1946
1946
|
ZodStringFormat.init(inst, def);
|
|
@@ -1970,7 +1970,7 @@ function duration2(params) {
|
|
|
1970
1970
|
return _isoDuration(ZodISODuration, params);
|
|
1971
1971
|
}
|
|
1972
1972
|
|
|
1973
|
-
// node_modules/zod/v4/classic/errors.js
|
|
1973
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/classic/errors.js
|
|
1974
1974
|
var initializer2 = (inst, issues) => {
|
|
1975
1975
|
$ZodError.init(inst, issues);
|
|
1976
1976
|
inst.name = "ZodError";
|
|
@@ -2005,7 +2005,7 @@ var ZodRealError = $constructor("ZodError", initializer2, {
|
|
|
2005
2005
|
Parent: Error
|
|
2006
2006
|
});
|
|
2007
2007
|
|
|
2008
|
-
// node_modules/zod/v4/classic/parse.js
|
|
2008
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/classic/parse.js
|
|
2009
2009
|
var parse3 = /* @__PURE__ */ _parse(ZodRealError);
|
|
2010
2010
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
2011
2011
|
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -2019,7 +2019,7 @@ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
|
2019
2019
|
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
2020
2020
|
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
2021
2021
|
|
|
2022
|
-
// node_modules/zod/v4/classic/schemas.js
|
|
2022
|
+
// ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/classic/schemas.js
|
|
2023
2023
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
2024
2024
|
$ZodType.init(inst, def);
|
|
2025
2025
|
inst.def = def;
|
|
@@ -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.11",
|
|
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",
|
|
@@ -2456,6 +2456,13 @@ var package_default = {
|
|
|
2456
2456
|
"ai-sdk"
|
|
2457
2457
|
],
|
|
2458
2458
|
license: "MIT",
|
|
2459
|
+
repository: {
|
|
2460
|
+
type: "git",
|
|
2461
|
+
url: "git+https://github.com/JeffreyJYZ/cmdcode-tools.git",
|
|
2462
|
+
directory: "opencode-plugin"
|
|
2463
|
+
},
|
|
2464
|
+
homepage: "https://github.com/JeffreyJYZ/cmdcode-tools/tree/main/opencode-plugin#readme",
|
|
2465
|
+
bugs: "https://github.com/JeffreyJYZ/cmdcode-tools/issues",
|
|
2459
2466
|
publishConfig: {
|
|
2460
2467
|
access: "public"
|
|
2461
2468
|
}
|
|
@@ -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,19 +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, cap) {
|
|
2193
2193
|
const pct = meter.percent;
|
|
2194
|
-
const
|
|
2195
|
-
|
|
2196
|
-
cap: spent * 100 / pct
|
|
2197
|
-
} : undefined;
|
|
2194
|
+
const pctText = Number.isInteger(pct) ? String(pct) : pct.toFixed(1);
|
|
2195
|
+
const paired = typeof cap === "number" && cap > 0;
|
|
2198
2196
|
return windowRows(label, {
|
|
2199
|
-
cap:
|
|
2200
|
-
used:
|
|
2197
|
+
cap: paired ? cap : 100,
|
|
2198
|
+
used: paired ? cap * pct / 100 : pct,
|
|
2201
2199
|
resetAt: meter.resetsAt,
|
|
2202
2200
|
sharePct: pct,
|
|
2203
2201
|
exceeded: pct >= 100 || meter.status !== "ok"
|
|
2204
|
-
}, now, durSecs, undefined,
|
|
2202
|
+
}, now, durSecs, undefined, paired ? (used, cap) => `${money(used)}/${money(cap)} (${pctText}%)` : () => `${pctText}% of limit`);
|
|
2205
2203
|
}
|
|
2206
2204
|
function zenRows(usage, meta, modelUsage, session, fallbackName, windows) {
|
|
2207
2205
|
if (!usage)
|
|
@@ -2215,11 +2213,12 @@ function zenRows(usage, meta, modelUsage, session, fallbackName, windows) {
|
|
|
2215
2213
|
const mine = usage.models.get(modelKey(fallbackName ?? "")) ?? (meta ? usage.models.get(modelKey(meta.name)) : undefined);
|
|
2216
2214
|
const limit = oc?.allowance ?? mine?.limit;
|
|
2217
2215
|
const cap = mine ? limit : undefined;
|
|
2216
|
+
const documented = (allowance, share) => typeof allowance === "number" && allowance > 0 ? allowance * share : undefined;
|
|
2218
2217
|
const period = monthPeriod(usage);
|
|
2219
2218
|
if (usage.account) {
|
|
2220
|
-
rows.push(...zenMeterRows("5-hour", usage.account.rolling, now, FIVE_HOUR_SECS,
|
|
2221
|
-
rows.push(...zenMeterRows("Weekly", usage.account.weekly, now, WEEKLY_SECS,
|
|
2222
|
-
rows.push(...zenMeterRows("Monthly", usage.account.monthly, now, period?.durSecs ?? 0,
|
|
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)));
|
|
2223
2222
|
} else {
|
|
2224
2223
|
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)));
|
|
2225
2224
|
rows.push(...zenWindow("Weekly", mine?.weekly ?? usage.totals.weekly, cap, GO_WINDOW_SHARE.weekly, now, WEEKLY_SECS, rollingReset(windows?.weekly, WEEKLY_SECS)));
|
|
@@ -2598,9 +2597,16 @@ function rememberMeta(meta) {
|
|
|
2598
2597
|
function seededMeta() {
|
|
2599
2598
|
return lastMeta ?? new Map;
|
|
2600
2599
|
}
|
|
2600
|
+
var lastZen;
|
|
2601
|
+
function rememberZen(usage) {
|
|
2602
|
+
lastZen = usage;
|
|
2603
|
+
}
|
|
2604
|
+
function seededZen() {
|
|
2605
|
+
return lastZen;
|
|
2606
|
+
}
|
|
2601
2607
|
function useRows(activeModelId, providerID, sessionID) {
|
|
2602
2608
|
const [usage, setUsage] = createSignal(seededRows());
|
|
2603
|
-
const [zen, setZen] = createSignal();
|
|
2609
|
+
const [zen, setZen] = createSignal(seededZen());
|
|
2604
2610
|
const [meta, setMeta] = createSignal(seededMeta());
|
|
2605
2611
|
const [modelUsage, setModelUsage] = createSignal(lastModelUsage);
|
|
2606
2612
|
const [sessionUsage, setSessionUsage] = createSignal();
|
|
@@ -2651,7 +2657,9 @@ function useRows(activeModelId, providerID, sessionID) {
|
|
|
2651
2657
|
setUsage(usageRows(snapshot));
|
|
2652
2658
|
refreshModelUsage(activeModelId());
|
|
2653
2659
|
} else if (kind === "go" || kind === "zen") {
|
|
2654
|
-
|
|
2660
|
+
const snapshot = await loadZen(loadPrefs().ocPlan);
|
|
2661
|
+
rememberZen(snapshot);
|
|
2662
|
+
setZen(snapshot);
|
|
2655
2663
|
refreshModelUsage(activeModelId());
|
|
2656
2664
|
refreshModelWindows(activeModelId());
|
|
2657
2665
|
}
|
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.11",
|
|
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",
|
|
@@ -42,6 +42,13 @@
|
|
|
42
42
|
"ai-sdk"
|
|
43
43
|
],
|
|
44
44
|
"license": "MIT",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/JeffreyJYZ/cmdcode-tools.git",
|
|
48
|
+
"directory": "opencode-plugin"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/JeffreyJYZ/cmdcode-tools/tree/main/opencode-plugin#readme",
|
|
51
|
+
"bugs": "https://github.com/JeffreyJYZ/cmdcode-tools/issues",
|
|
45
52
|
"publishConfig": {
|
|
46
53
|
"access": "public"
|
|
47
54
|
}
|