@jeffreyjyz/opencode-command-code 0.3.18 → 0.4.0

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/access.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { canonicalizeModelId, PLAN_RULES } from "./gating";
1
+ import { PLAN_RULES } from "./constants/gating";
2
+ import { canonicalizeModelId } from "./gating";
2
3
  export { canonicalizeModelId, PLAN_RULES };
3
4
  export type PlanLike = {
4
5
  planId: string;
package/dist/api.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export declare const API_BASE = "https://api.commandcode.ai";
2
1
  export declare function authHeaders(key: string): Record<string, string>;
3
2
  export declare function getJson(path: string, key: string, timeoutMs?: number): Promise<unknown>;
4
3
  export type Whoami = {
package/dist/catalog.d.ts CHANGED
@@ -15,7 +15,7 @@ export interface CatalogEntry {
15
15
  /** Cheapest plan that serves the model; plans.md names this the access rule. */
16
16
  minPlan: string | null;
17
17
  }
18
- export declare const CATALOG_VERSION: "1.65.2";
18
+ export declare const CATALOG_VERSION: "1.74.1";
19
19
  /** Every model the CLI table carried, keyed by the API's model id. */
20
20
  export declare const MODEL_CATALOG: Readonly<Record<string, CatalogEntry>>;
21
21
  /** Text-only default for any id this table does not list. */
@@ -0,0 +1,6 @@
1
+ /** Fallback lookup paths for the cmduse CLI (CMDUSE_BIN wins when set). */
2
+ export declare const CMDUSE_BIN_CANDIDATES: readonly string[];
3
+ /** Fallback lookup paths for mpc, the per-model catalog scraper. */
4
+ export declare const MPC_BIN_CANDIDATES: readonly string[];
5
+ /** Fallback lookup paths for ocuse (OCUSE_BIN wins when set). */
6
+ export declare const OCUSE_BIN_CANDIDATES: readonly string[];
@@ -0,0 +1,12 @@
1
+ import type { spawn } from "node:child_process";
2
+ /** Default invocation: one-shot dashboard, no colors / no live redraw. */
3
+ export declare const DEFAULT_ARGS: readonly string[];
4
+ /** cmduse subcommands — when the arg starts with one, pass it through
5
+ * untouched; otherwise it is extra flags for the one-shot dashboard. */
6
+ export declare const SUBCOMMANDS: ReadonlySet<string>;
7
+ /** `detached` is load-bearing, not tidiness: it starts the child in its own
8
+ * session, so it has no controlling terminal. cmduse's snapshot() paints a
9
+ * "fetching usage…" spinner straight to /dev/tty — piping stdout/stderr does
10
+ * not stop it — which would corrupt the opencode TUI this process inherits its
11
+ * tty from. Detaching makes that open fail; stdout/stderr stay piped. */
12
+ export declare const SPAWN_OPTIONS: Parameters<typeof spawn>[2];
@@ -0,0 +1,6 @@
1
+ /** Command Code account/billing API. */
2
+ export declare const API_BASE = "https://api.commandcode.ai";
3
+ /** Provider (inference) API root; the lanes append their wire path. */
4
+ export declare const PROVIDER_BASE = "https://api.commandcode.ai/provider/v1";
5
+ /** Default provider base URL used when the host passes none. */
6
+ export declare const DEFAULT_BASE_URL = "https://api.commandcode.ai";
@@ -0,0 +1,22 @@
1
+ import type { Category } from "../gating";
2
+ /** model id -> category (models absent from this table have unknown category) */
3
+ export declare const MODEL_CATEGORIES: Record<string, Category>;
4
+ /** planId -> access rules; plan ids absent from this table get everything */
5
+ export declare const PLAN_RULES: Record<string, {
6
+ allowedCategories: Category[];
7
+ blockedModels: string[];
8
+ }>;
9
+ /** Models the API hard-blocks (403 MODEL_NOT_IN_PLAN) per plan, beyond the
10
+ * category rules. Empirically probed — the CLI bundle misses these because it
11
+ * tracks category via serving lane, not per-model plan entitlements. */
12
+ export declare const HARD_BLOCKED: Record<string, string[]>;
13
+ /** canonical known model ids (lowercase compare) */
14
+ export declare const KNOWN_MODELS: string[];
15
+ /** deprecated/aliased model id -> canonical id */
16
+ export declare const MODEL_ALIASES: Record<string, string>;
17
+ /** ISO timestamp the snapshot was extracted (absent on pre-metadata files). */
18
+ export declare const GATE_EXTRACTED_AT: string | undefined;
19
+ /** Command Code CLI version the snapshot was scraped from. */
20
+ export declare const GATE_CLI_VERSION: string | undefined;
21
+ /** Warn once a process when gating.json is older than this many days. */
22
+ export declare const GATE_STALE_DAYS = 30;
@@ -0,0 +1,29 @@
1
+ /** Every Command Code model shares these capabilities; hoisted so each record
2
+ * does not rebuild them. Vision (`attachment` + `input.image`) is applied per
3
+ * model from the generated catalog in the two model builders. */
4
+ export declare const MODEL_CAPABILITIES: {
5
+ temperature: boolean;
6
+ reasoning: boolean;
7
+ attachment: boolean;
8
+ toolcall: boolean;
9
+ input: {
10
+ text: boolean;
11
+ audio: boolean;
12
+ image: boolean;
13
+ video: boolean;
14
+ pdf: boolean;
15
+ };
16
+ output: {
17
+ text: boolean;
18
+ audio: boolean;
19
+ image: boolean;
20
+ video: boolean;
21
+ pdf: boolean;
22
+ };
23
+ };
24
+ /** Context window advertised when the listing API gives no length. */
25
+ export declare const DEFAULT_CONTEXT_LENGTH = 128000;
26
+ /** Max output tokens advertised per model. */
27
+ export declare const DEFAULT_OUTPUT_TOKENS = 32000;
28
+ /** Provider wire ceiling for a request's max tokens. */
29
+ export declare const DEFAULT_MAX_TOKENS = 64000;
@@ -0,0 +1,18 @@
1
+ /** Dir segment under an XDG base that holds our caches/diagnostics. */
2
+ export declare const CACHE_DIR = "command-code";
3
+ /** Live model list disk cache file (under CACHE_DIR). */
4
+ export declare const MODELS_CACHE_FILE = "models.json";
5
+ /** Startup timing log file (under CACHE_DIR). */
6
+ export declare const STARTUP_LOG_FILE = "startup.log";
7
+ /**
8
+ * mpc per-model catalog disk cache file (under CACHE_DIR), one per OpenCode Go
9
+ * plan: mpc bakes the selected plan's per-model allowance into the rows, so a
10
+ * cached catalog is only valid for the plan it was fetched under.
11
+ */
12
+ export declare function ccCatalogFile(plan: string): string;
13
+ /** opencode's own config/data dir segment. */
14
+ export declare const OPENCODE_DIR = "opencode";
15
+ /** opencode's message store file (under OPENCODE_DIR in the data root). */
16
+ export declare const OPENCODE_DB_FILE = "opencode.db";
17
+ /** Sidebar prefs file (under OPENCODE_DIR in the config root). */
18
+ export declare const PREFS_FILE = "command-code.json";
@@ -0,0 +1,28 @@
1
+ /** Provider-id prefix shared by both Command Code lanes and the plugin id. */
2
+ export declare const PROVIDER_ID_PREFIX = "command-code";
3
+ /** Plugin id (stable contract; the v2 `setup` definition and the TUI share it). */
4
+ export declare const PLUGIN_ID = "command-code";
5
+ /** Integration id backing both lanes' credentials (/connect + env). */
6
+ export declare const INTEGRATION_ID = "command-code";
7
+ /** Display name for the integration and the no-key warning. */
8
+ export declare const INTEGRATION_NAME = "Command Code";
9
+ /** OpenCode Go provider id (ocuse reads its store). */
10
+ export declare const GO_PROVIDER_ID = "opencode-go";
11
+ /** OpenCode Zen provider id and its `opencode-zen` alias prefix. */
12
+ export declare const ZEN_PROVIDER_ID = "opencode";
13
+ export declare const ZEN_PROVIDER_PREFIX = "opencode-zen";
14
+ /** TUI plugin id (stable contract; test/tui.test.ts pins it). */
15
+ export declare const TUI_ID = "command-code.tui";
16
+ /** The cmd_usage tool description, shared by the v1 and v2 halves. */
17
+ export declare const TOOL_DESCRIPTION = "Fetch live Command Code plan/usage: plan name, monthly credits, 5-hour & weekly windows, billing-period summary. Pass arg='plans' for the plan comparison table only, or extra cmduse flags (e.g. '--tz +05:30 daily').";
18
+ export type Lane = {
19
+ id: "command-code-anthropic" | "command-code-openai";
20
+ name: string;
21
+ /** v2 runtime package (first-party, distinct from the v1 `npm` value). */
22
+ pkg: string;
23
+ /** Wire field reasoning must round-trip through on the openai-compatible
24
+ * lane; v2 spells the old `interleaved: {field}` as `compatibility`. */
25
+ reasoningField?: string;
26
+ };
27
+ /** The Anthropic and OpenAI-compatible provider lanes this plugin owns. */
28
+ export declare const LANES: [Lane, Lane];
@@ -0,0 +1,33 @@
1
+ import type { Category } from "../gating";
2
+ import type { Prefs } from "../sidebar/prefs";
3
+ /**
4
+ * The sidebar is 42 columns wide with 2+2 padding, and our panel keeps one more
5
+ * column clear on the right, so a rendered row must stay within this. Rows that
6
+ * cannot fit are split across an indented continuation rather than wrapping in
7
+ * the host's renderer, which is what made the panel look broken.
8
+ */
9
+ export declare const ROW_WIDTH = 37;
10
+ /** Tier label per gating category. */
11
+ export declare const TIER_DISPLAY: Readonly<Record<Category, string>>;
12
+ /**
13
+ * OpenCode Go plans the panel can render: the same token rates, different
14
+ * per-model monthly limits. Which one a user is on is not discoverable (Go has
15
+ * no usage API and the store records no subscription), so it is a setting.
16
+ */
17
+ export declare const OC_PLANS: readonly ["go", "go-plus"];
18
+ export type OcPlan = (typeof OC_PLANS)[number];
19
+ /** Plan used when the user has not set one: behaviour is unchanged for them. */
20
+ export declare const OC_PLAN_DEFAULT: OcPlan;
21
+ /** Go's documented per-model window shares of the monthly allowance. */
22
+ export declare const GO_WINDOW_SHARE: {
23
+ readonly fiveHour: 0.2;
24
+ readonly weekly: 0.5;
25
+ readonly month: 1;
26
+ };
27
+ /** 5-hour window length in seconds. Mirrors cmduse_core::FIVE_HOUR_SECS. */
28
+ export declare const FIVE_HOUR_SECS: number;
29
+ /** Weekly window length in seconds. Mirrors cmduse_core::WEEKLY_SECS. */
30
+ export declare const WEEKLY_SECS: number;
31
+ /** Colour is OFF unless asked for; the OpenCode Go plan defaults to `go` (see
32
+ * sidebar/prefs.ts). */
33
+ export declare const PREF_DEFAULTS: Prefs;
@@ -0,0 +1,13 @@
1
+ /** Sidebar poll cadence: one cmduse/ocuse spawn plus the local store reads. */
2
+ export declare const POLL_MS = 5000;
3
+ /** How long one sidebar CLI spawn may run before it is killed. An outage can
4
+ * leave a fetch hanging through cmduse's retry ladder, and the poll interval
5
+ * would otherwise stack spawns on top of each other. */
6
+ export declare const CHILD_TIMEOUT_MS = 30000;
7
+ /** Process-lifetime cache for the live model list (src/models.ts). */
8
+ export declare const MODELS_CACHE_TTL_MS: number;
9
+ /** Disk cache for mpc's per-model catalog (src/sidebar/data.ts). An hour, not
10
+ * six: a running panel then picks up new models and promotions. */
11
+ export declare const CATALOG_CACHE_TTL_MS: number;
12
+ /** Re-read window for the sidebar colour prefs file (src/sidebar/prefs.ts). */
13
+ export declare const PREFS_CACHE_MS = 5000;
package/dist/gating.d.ts CHANGED
@@ -1,23 +1,5 @@
1
1
  export type Category = "opensource" | "premium";
2
- /** model id -> category (models absent from this table have unknown category) */
3
- export declare const MODEL_CATEGORIES: Record<string, Category>;
4
- /** planId -> access rules; plan ids absent from this table get everything */
5
- export declare const PLAN_RULES: Record<string, {
6
- allowedCategories: Category[];
7
- blockedModels: string[];
8
- }>;
9
- /** Models the API hard-blocks (403 MODEL_NOT_IN_PLAN) per plan, beyond the
10
- * category rules. Empirically probed — the CLI bundle misses these because it
11
- * tracks category via serving lane, not per-model plan entitlements. */
12
- export declare const HARD_BLOCKED: Record<string, string[]>;
13
- /** canonical known model ids (lowercase compare) */
14
- declare const KNOWN_MODELS: string[];
15
- export { KNOWN_MODELS };
16
- /** ISO timestamp the snapshot was extracted (absent on pre-metadata files). */
17
- export declare const GATE_EXTRACTED_AT: string | undefined;
18
- /** Command Code CLI version the snapshot was scraped from. */
19
- export declare const GATE_CLI_VERSION: string | undefined;
20
- /** Warn once per process when gating.json is older than 30 days. */
2
+ /** Warn once per process when gating.json is older than GATE_STALE_DAYS. */
21
3
  export declare function warnIfGatingStale(): void;
22
4
  export declare function canonicalizeModelId(model: string): string;
23
5
  /** Bare model id with any provider qualifier stripped: everything after the
package/dist/index.d.ts CHANGED
@@ -2,9 +2,9 @@ import type { Plugin as PluginV1 } from "@opencode-ai/plugin";
2
2
  export declare const CommandCodePlugin: PluginV1;
3
3
  export { createCommandCode } from "./provider";
4
4
  declare const _default: {
5
- /** v1 entrypoint (opencode >=1.18.29 object entrypoints). */
6
- server: PluginV1;
7
5
  id: string;
8
6
  setup: (context: import("@opencode/plugin/promise/plugin").Context) => Promise<import("@opencode/plugin/promise/plugin").Cleanup | void> | import("@opencode/plugin/promise/plugin").Cleanup | void;
7
+ /** v1 entrypoint (opencode >=1.18.29 object entrypoints). */
8
+ server: PluginV1;
9
9
  };
10
10
  export default _default;