Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.93.6
1.94.0
2 changes: 1 addition & 1 deletion docs/2026-08-28-catalog-modalities/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Parent: [docs/2026-08-28-ci-catalog/spec.md](../2026-08-28-ci-catalog/spec.md)
- Command Code CLI catalog is the source of truth for native vision vs text-only. The public GitHub repo is a stub; the field lives on every model object in the npm `command-code` bundle as `inputModalities: ["text"]` or `["text","image"]`.
- Provider API `GET /provider/v1/models` has `context_length` only — no vision flags. Official docs Capabilities column is icons, not structured data.
- models.dev may add extra modality strings; it must not flip a CLI text-only model to vision or wipe CLI vision on unmatched ids.
- Last-resort text-only applies only when a model has **no** CLI `inputModalities` and no models.dev match (e.g. hardcoded extras).
- Last-resort text-only applies only when a model has **no** CLI `inputModalities` and no models.dev match (e.g. an entry with no CLI inputModalities and no models.dev match).
- Runtime still does not fetch models.dev. Sync writes the fields into `models.json`.
- Do not overwrite CLI `reasoning` / `reasoningEfforts` from models.dev.
- Do not inject capability text into the session prompt.
Expand Down
14 changes: 12 additions & 2 deletions docs/specs/2026-09-20-catalog-freshness.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ Provider-side resolution (2026-09-20): the availability filter shipped in `fix(c

### Callable model authority

The public `GET https://api.commandcode.ai/provider/v1/models` response is the availability authority at synchronization time. The extractor output, combining metadata read from the Command Code CLI bundle with repository-maintained hardcoded entries for known bundle gaps, remains the metadata authority for fields that the endpoint does not provide.
The public `GET https://api.commandcode.ai/provider/v1/models` response is the availability authority at synchronization time. The extractor output, which is metadata read from the Command Code CLI bundle only, remains the metadata authority for fields that the endpoint does not provide.

The publishable catalog is the exact-ID intersection of:

- candidate entries produced from the selected Command Code CLI bundle and maintained hardcoded entries; and
- candidate entries produced from the selected Command Code CLI bundle; and
- IDs in the availability response's `data` array.

Matching is case-sensitive and exact. Display names and suffixes must not be used to infer availability.
Expand All @@ -47,6 +47,16 @@ Unavailable entries are not emitted with OpenCode `status: "deprecated"`. OpenCo

Removing a model from the provider map must not edit OpenCode's favorites, recents, variants, or other local state. Existing unresolved state remains OpenCode-owned and can resolve again if the exact ID returns in a later catalog.

### Supported bundle binding shapes

The extractor evaluates the catalog object with bindings read from the 12,000 characters before the catalog anchor. It supports:

- string constants and aliases (`KR="chatComplete"`, `$R="vercel-ai-gateway"`, `tI=Qx`);
- the provider enum found by `extractBestProviderEnum` (`(Wt={...})`, `Bi={...}`); and
- inline enums assigned inside an outer member read, introduced in `command-code@1.94.0`: `X_=(Q_={ANTHROPIC:"anthropic",OPENAI:"openai",VERCEL_AI_GATEWAY:"vercel-ai-gateway",OPENROUTER:"openrouter"}).VERCEL_AI_GATEWAY`. The inner name (`Q_`) binds to the evaluated object and the outer name (`X_`) binds to the member's string value, so entries such as `provider:Q_.ANTHROPIC` and `provider:X_` evaluate.

The inline form is needed because the bundle can contain an earlier, unrelated provider enum that `extractBestProviderEnum` selects first (`Bi` in 1.94.0). A new unbound shape surfaces as `Could not evaluate model catalog: <name> is not defined` and needs a regression fixture that mirrors it.

### Safe synchronization

Availability filtering occurs in CI and explicit maintainer synchronization, never during plugin startup.
Expand Down
12 changes: 6 additions & 6 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"schemaVersion": 1,
"generatedAt": "2026-12-01T18:02:14.723Z",
"generatedAt": "2026-12-04T18:34:26.642Z",
"pluginVersion": "0.12.54",
"commandCodeVersion": "1.93.6",
"commandCodeTarball": "https://registry.npmjs.org/command-code/-/command-code-1.93.6.tgz",
"modelCount": 105,
"reasoningModelCount": 94,
"commandCodeVersion": "1.94.0",
"commandCodeTarball": "https://registry.npmjs.org/command-code/-/command-code-1.94.0.tgz",
"modelCount": 106,
"reasoningModelCount": 95,
"extraction": {
"modelCatalog": "ok",
"costCatalog": "docs",
"costCatalogError": null
},
"costSources": {
"cli": 0,
"officialDocs": 105,
"officialDocs": 106,
"thirdParty": 0,
"free": 0,
"fallback": 0,
Expand Down
68 changes: 57 additions & 11 deletions models.json
Original file line number Diff line number Diff line change
Expand Up @@ -1394,19 +1394,26 @@
]
},
{
"id": "recursive/flint-v1.0:free",
"name": "Flint",
"id": "amazon/ergo-1.0",
"name": "Ergo 1.0",
"tier": "open-source",
"reasoning": true,
"reasoningEfforts": [
"low",
"medium",
"high",
"xhigh",
"max"
],
"tool_call": true,
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
"input": 1,
"output": 3,
"cache_read": 0.03
},
"limit": {
"context": 262144,
"output": 65536
"context": 1048576,
"output": 131072
},
"attachment": false,
"modalities": {
Expand All @@ -1417,11 +1424,12 @@
"text"
]
},
"family": "flint-free",
"release_date": "2026-10-21",
"family": "ergo",
"release_date": "2026-12-01",
"supported_endpoints": [
"/chat/completions",
"/responses"
"/responses",
"/messages"
]
},
{
Expand Down Expand Up @@ -2076,7 +2084,45 @@
]
},
"family": "glm-flash",
"release_date": "2026-08-26",
"release_date": "2026-09-18",
"supported_endpoints": [
"/chat/completions",
"/responses"
]
},
{
"id": "zai-org/GLM-5.4",
"name": "GLM-5.4",
"tier": "open-source",
"reasoning": true,
"reasoningEfforts": [
"low",
"high",
"max"
],
"tool_call": true,
"cost": {
"input": 1.4,
"output": 4.4,
"cache_read": 0.26
},
"limit": {
"context": 1000000,
"output": 128000
},
"attachment": true,
"modalities": {
"input": [
"text",
"image",
"video"
],
"output": [
"text"
]
},
"family": "glm",
"release_date": "2026-11-23",
"supported_endpoints": [
"/chat/completions",
"/responses"
Expand Down
74 changes: 51 additions & 23 deletions src/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,6 @@ export const FALLBACK_LIMITS: Record<string, { context: number; output: number }
"google/gemini-3.1-flash-lite": { context: 1000000, output: 65536 },
};

export const HARDCODED_EXTRAS: SnEntry[] = [
{
id: "Qwen/Qwen3.7-Max",
provider: "vercel-ai-gateway",
spec: "chatComplete",
label: "Qwen 3.7 Max",
name: "Qwen 3.7 Max",
description: "latest Qwen Max model",
reasoning: true,
},
];

export const TIER_MAP: Record<string, "premium" | "open-source"> = {
anthropic: "premium",
openai: "premium",
Expand Down Expand Up @@ -281,6 +269,56 @@ export function extractStringBindings(
return bindings;
}

/** Index of the `}` that closes the `{` at `start`, or -1 when unbalanced. */
function closingBraceIndex(source: string, start: number): number {
let depth = 0;
for (let i = start; i < source.length; i++) {
if (source[i] === "{") depth++;
else if (source[i] === "}") {
depth--;
if (depth === 0) return i;
}
}
return -1;
}

/**
* Collect inline enums assigned inside an outer member read, e.g. command-code
* 1.94's `X_=(Q_={ANTHROPIC:"anthropic",...}).VERCEL_AI_GATEWAY`. The catalog
* reads both names (`provider:Q_.ANTHROPIC`, `provider:X_`), so `Q_` binds to
* the object and `X_` to the member value.
*/
export function extractEnumBindings(
source: string,
endIdx: number,
window = 12000,
): Record<string, unknown> {
const before = source.slice(Math.max(0, endIdx - window), endIdx);
const out: Record<string, unknown> = {};
const re = /(?<![A-Za-z0-9_$])([A-Za-z_$][\w$]*)=\(([A-Za-z_$][\w$]*)=\{/g;
let m: RegExpExecArray | null;
while ((m = re.exec(before))) {
const outer = m[1];
const inner = m[2];
if (outer === undefined || inner === undefined) continue;
const braceStart = m.index + m[0].length - 1;
const braceEnd = closingBraceIndex(before, braceStart);
if (braceEnd < 0 || before[braceEnd + 1] !== ")") continue;
let value: unknown;
try {
value = evaluateWithContext(normalizeForEval(before.slice(braceStart, braceEnd + 1)), {});
} catch {
continue; // not a plain literal object
}
if (!value || typeof value !== "object" || Array.isArray(value)) continue;
out[inner] = value;
const member = before.slice(braceEnd + 2).match(/^\.([A-Za-z_$][\w$]*)/)?.[1];
const memberValue = member ? (value as Record<string, unknown>)[member] : undefined;
if (typeof memberValue === "string") out[outer] = memberValue;
}
return out;
}

export function extractSpecConstants(source: string): {
chatComplete: string;
responses: string;
Expand Down Expand Up @@ -309,6 +347,7 @@ export function extractSpecConstants(source: string): {

function buildEvalContext(source: string, catalogIdx: number): Record<string, unknown> {
const ctx: Record<string, unknown> = {
...extractEnumBindings(source, catalogIdx),
...extractStringBindings(source, catalogIdx),
};

Expand Down Expand Up @@ -563,17 +602,6 @@ export function loadCatalogFromBundle(
if (entry) entries.push(entry);
}

for (const extra of HARDCODED_EXTRAS) {
if (!entries.some((e) => e.id === extra.id)) {
const entry = buildModelEntry(
extra,
costMap,
vendorContextLengths?.get(extra.id.toLowerCase()),
);
if (entry) entries.push(entry);
}
}

return sortModelEntries(entries);
}

Expand Down
34 changes: 29 additions & 5 deletions tests/unit/catalog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,29 @@ describe("loadCatalogFromBundle", () => {
expect(sonnet!.reasoningEfforts).toEqual(["low", "high"]);
});

test("binds the inline provider enum assigned inside an outer member read (1.94 shape)", () => {
// command-code 1.94.0: an earlier rich `Bi={...}` enum wins extractBestProviderEnum,
// while the catalog reads the inline `X_=(Q_={...}).VERCEL_AI_GATEWAY` enum.
const source = [
'zs=[(qs={ANTHROPIC:"anthropic",COPILOT:"github-copilot"}).ANTHROPIC,qs.COPILOT],',
'__name(getLabel,"getLabel"),Bi={ANTHROPIC:"anthropic",OPENAI:"openai",VERCEL_AI_GATEWAY:"vercel-ai-gateway",OPENROUTER:"openrouter"},Ui={[qs.ANTHROPIC]:{models:[Bi.ANTHROPIC]}};',
'x$=__esm({"constants.ts"(){__name(getBinaryCommand,"getBinaryCommand"),',
'X_=(Q_={ANTHROPIC:"anthropic",OPENAI:"openai",VERCEL_AI_GATEWAY:"vercel-ai-gateway",OPENROUTER:"openrouter"}).VERCEL_AI_GATEWAY,',
'n$="responses",o$=t$="chatComplete",r$={',
'SONNET_4_6:{id:"claude-sonnet-4-6",inputModalities:["text","image"],provider:Q_.ANTHROPIC,spec:t$,label:"Sonnet",name:"Claude Sonnet 4.6",description:"d",reasoningEfforts:["low","high"],contextWindow:1e6},',
'GPT_X:{id:"gpt-5.5",provider:Q_.OPENAI,spec:n$,label:"GPT",name:"GPT-5.5",description:"d",inputModalities:["text"]},',
'GLM_X:{id:"zai-org/GLM-5.1",provider:X_,spec:t$,label:"GLM",name:"GLM-5.1",description:"d"}',
"}}});",
].join("");

const entries = loadCatalogFromBundle(source);
const byId = new Map(entries.map((e) => [e.id, e]));
expect(byId.get("claude-sonnet-4-6")?.tier).toBe("premium");
expect(byId.get("claude-sonnet-4-6")?.limit.context).toBe(1000000);
expect(byId.get("gpt-5.5")?.tier).toBe("premium");
expect(byId.get("zai-org/GLM-5.1")?.tier).toBe("open-source");
});

test("surfaces the real eval error when no candidate evaluates", () => {
// Bundle shape where the catalog references an unbindable identifier:
// the thrown error must name it, not the generic extraction failure.
Expand Down Expand Up @@ -666,11 +689,12 @@ describe("filterCatalogByAvailability", () => {
expect(unavailable).toEqual(["GPT-5.5", "retired-promo"]);
});

test("CLI-derived and HARDCODED_EXTRAS candidates pass through the same filter", () => {
const { retained } = filterCatalogByAvailability(
[entry("Qwen/Qwen3.7-Max"), entry("cli-model")],
["Qwen/Qwen3.7-Max", "cli-model"],
test("namespaced ids match only on the full id, not a prefix or bare suffix", () => {
const { retained, unavailable } = filterCatalogByAvailability(
[entry("vendor/model-x"), entry("model-y"), entry("vendor/model-z")],
["vendor/model-x", "vendor/model-y", "model-z"],
);
expect(retained.map((e) => e.id).sort()).toEqual(["Qwen/Qwen3.7-Max", "cli-model"]);
expect(retained.map((e) => e.id)).toEqual(["vendor/model-x"]);
expect(unavailable).toEqual(["model-y", "vendor/model-z"]);
});
});