diff --git a/_version.txt b/_version.txt index aabddb9..8db4a57 100644 --- a/_version.txt +++ b/_version.txt @@ -1 +1 @@ -1.93.6 +1.94.0 diff --git a/docs/2026-08-28-catalog-modalities/spec.md b/docs/2026-08-28-catalog-modalities/spec.md index 6956b9c..1c26245 100644 --- a/docs/2026-08-28-catalog-modalities/spec.md +++ b/docs/2026-08-28-catalog-modalities/spec.md @@ -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. diff --git a/docs/specs/2026-09-20-catalog-freshness.md b/docs/specs/2026-09-20-catalog-freshness.md index 08b1728..31d7299 100644 --- a/docs/specs/2026-09-20-catalog-freshness.md +++ b/docs/specs/2026-09-20-catalog-freshness.md @@ -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. @@ -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: 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. diff --git a/manifest.json b/manifest.json index 7c93937..680b9eb 100644 --- a/manifest.json +++ b/manifest.json @@ -1,11 +1,11 @@ { "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", @@ -13,7 +13,7 @@ }, "costSources": { "cli": 0, - "officialDocs": 105, + "officialDocs": 106, "thirdParty": 0, "free": 0, "fallback": 0, diff --git a/models.json b/models.json index f177142..a9b8c01 100644 --- a/models.json +++ b/models.json @@ -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": { @@ -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" ] }, { @@ -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" diff --git a/src/catalog.ts b/src/catalog.ts index 6613893..e46916e 100644 --- a/src/catalog.ts +++ b/src/catalog.ts @@ -74,18 +74,6 @@ export const FALLBACK_LIMITS: Record = { anthropic: "premium", openai: "premium", @@ -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 { + const before = source.slice(Math.max(0, endIdx - window), endIdx); + const out: Record = {}; + const re = /(?)[member] : undefined; + if (typeof memberValue === "string") out[outer] = memberValue; + } + return out; +} + export function extractSpecConstants(source: string): { chatComplete: string; responses: string; @@ -309,6 +347,7 @@ export function extractSpecConstants(source: string): { function buildEvalContext(source: string, catalogIdx: number): Record { const ctx: Record = { + ...extractEnumBindings(source, catalogIdx), ...extractStringBindings(source, catalogIdx), }; @@ -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); } diff --git a/tests/unit/catalog.test.ts b/tests/unit/catalog.test.ts index c1c338e..7035e8b 100644 --- a/tests/unit/catalog.test.ts +++ b/tests/unit/catalog.test.ts @@ -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. @@ -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"]); }); });