@jeffreyjyz/opencode-command-code 0.3.3 → 0.3.4

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
@@ -3041,6 +3041,7 @@ async function loadModels(key) {
3041
3041
  }
3042
3042
  }
3043
3043
  let plan = { planId: "", purchasedCredits: 0, freeCredits: 0 };
3044
+ let gated = true;
3044
3045
  try {
3045
3046
  const [sub, cr] = await Promise.all([subscriptions(key), credits(key)]);
3046
3047
  plan = {
@@ -3048,10 +3049,12 @@ async function loadModels(key) {
3048
3049
  purchasedCredits: cr.credits.purchasedCredits ?? 0,
3049
3050
  freeCredits: cr.credits.freeCredits ?? 0
3050
3051
  };
3051
- } catch {}
3052
+ } catch {
3053
+ gated = false;
3054
+ }
3052
3055
  const allowed = models.filter((m) => evaluateModelAccess(m.id, plan).allowed);
3053
3056
  const { claude, open } = splitModels(allowed);
3054
- return { claude, open };
3057
+ return { claude, open, gated };
3055
3058
  }
3056
3059
 
3057
3060
  // src/provider/stream.ts
@@ -3940,6 +3943,7 @@ var commandCodeV2 = {
3940
3943
  let refreshing = false;
3941
3944
  let appliedClaude = cached?.claude ?? [];
3942
3945
  let appliedOpen = cached?.open ?? [];
3946
+ let canTransform = false;
3943
3947
  const logTimings = (refreshMs, modelCount) => void writeStartupLine(setupTimingLine({
3944
3948
  key: keyMs,
3945
3949
  register: registerMs,
@@ -3959,9 +3963,13 @@ var commandCodeV2 = {
3959
3963
  const split = await loadModels(key);
3960
3964
  if (controller.signal.aborted)
3961
3965
  return;
3962
- writeModelsCache({ fetchedAt: Date.now(), claude: split.claude, open: split.open });
3963
3966
  const modelCount = split.claude.length + split.open.length;
3964
- if (!idsDiffer(split.claude, appliedClaude) && !idsDiffer(split.open, appliedOpen)) {
3967
+ if (!split.gated) {
3968
+ logTimings(Date.now() - refreshStart, modelCount);
3969
+ return;
3970
+ }
3971
+ writeModelsCache({ fetchedAt: Date.now(), claude: split.claude, open: split.open });
3972
+ if (!canTransform || !idsDiffer(split.claude, appliedClaude) && !idsDiffer(split.open, appliedOpen)) {
3965
3973
  logTimings(Date.now() - refreshStart, modelCount);
3966
3974
  return;
3967
3975
  }
@@ -3976,6 +3984,7 @@ var commandCodeV2 = {
3976
3984
  console.warn("[command-code] live model list unavailable, keeping the snapshot:", e);
3977
3985
  } finally {
3978
3986
  refreshing = false;
3987
+ canTransform = true;
3979
3988
  }
3980
3989
  };
3981
3990
  const firstRefresh = setTimeout(() => void refresh(), 3000);
@@ -3990,7 +3999,7 @@ var commandCodeV2 = {
3990
3999
  // package.json
3991
4000
  var package_default = {
3992
4001
  name: "@jeffreyjyz/opencode-command-code",
3993
- version: "0.3.3",
4002
+ version: "0.3.4",
3994
4003
  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.",
3995
4004
  type: "module",
3996
4005
  main: "dist/index.js",
package/dist/models.d.ts CHANGED
@@ -6,6 +6,10 @@ export type CmdModel = {
6
6
  export type ModelSplit = {
7
7
  claude: CmdModel[];
8
8
  open: CmdModel[];
9
+ /** True when the billing lookup succeeded and the plan gate really ran. A
10
+ * false here means "show everything", which is the API-enforced fallback —
11
+ * callers must not treat that as a new model list. */
12
+ gated: boolean;
9
13
  };
10
14
  export declare function isClaude(id: string): boolean;
11
15
  export declare function splitModels(models: CmdModel[]): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeffreyjyz/opencode-command-code",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
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",