From 28d0d7d60740092cd0af74d4b45b65aa43764675 Mon Sep 17 00:00:00 2001 From: Multfinite Date: Fri, 4 Dec 2026 12:06:00 +0300 Subject: [PATCH 1/2] fix(catalog): parse 1.94.0 enum bindings and add API-only SKUs - extractEnumBindings(): inline (Inner={...}) IIFE enums (X_=(Q_={ANTHROPIC:...}).VERCEL_AI_GATEWAY) now join the eval context before string bindings; fixes 'Q_ is not defined' on command-code@1.94.0 that broke upstream catalog-sync since Dec 2 (issues #333-#339) - buildEvalContext(): apply enum bindings before extractStringBindings aliases - API_ONLY_MODELS: 5 provider-API SKUs missing from the 1.94.0 CLI bundle (flint-v1.1:free, minimax-m4, inkling-2-small, beam-contributor:free, subq-savant-1.4) - sync: models.json 105 -> 111 from command-code@1.94.0; drops retired recursive/flint-v1.0:free and stepfun/Step-5-Preview --- FORK.md | 65 +++++++++++++ _version.txt | 2 +- manifest.json | 18 ++-- models.json | 241 +++++++++++++++++++++++++++++++++++++++++++++++-- src/catalog.ts | 130 ++++++++++++++++++++++++++ 5 files changed, 441 insertions(+), 15 deletions(-) create mode 100644 FORK.md diff --git a/FORK.md b/FORK.md new file mode 100644 index 0000000..219213a --- /dev/null +++ b/FORK.md @@ -0,0 +1,65 @@ +# Fork: @brainervirus/opencode-commandcode (catalog fix) + +Локальный форк с патчем каталога моделей Command Code. + +## Что сломалось upstream + +`command-code@1.94.0` изменил форму минифицированного бандла: enum провайдеров теперь +определяется инлайн-объектом `X_=(Q_={ANTHROPIC:"anthropic",...}).VERCEL_AI_GATEWAY` +вместо `Wt={...}` / `Bi={...}`, которые распознавал экстрактор. Из-за этого +`bun run sync -- --remote` падал с `Could not evaluate model catalog: Q_ is not defined`, +CI-синк не публиковал обновления с 2 декабря (issues #333–#339), и плагин +застрял на каталоге из `command-code@1.93.4` (105 моделей от 26.11.2026). + +## Патч + +`src/catalog.ts`: +1. **`extractEnumBindings()`** — новый экстрактор: собирает инлайн `X_=(Q_={...}).K` + биндинги перед каталогом и подкладывает объект в eval-контекст + (`Q_`, `Q_Context` и внешний `X_`). Форма — одиночная скобка `=\(Inner={...})`, + вложенный `\(Outer=(Inner={...}))`. +2. **`buildEvalContext()`** — биндинги enum-ов применяются ДО `extractStringBindings()`. +3. **`API_ONLY_MODELS`** — 5 SKU, которых нет в бандле CLI 1.94.0, но они отданы + provider API (`recursive/flint-v1.1:free`, `minimax/minimax-m4`, + `thinkingmachines/inkling-2-small`, `reflection/beam-contributor:free`, + `subquadratic/subq-savant-1.4`). Вливаются в каталог до фильтра availability. +4. Манифест: 111 моделей из command-code@1.94.0 (retired: flint-v1.0, Step-5-Preview). + +## Как пересобрать + +```sh +bun install +bun run sync -- --remote # models.json / manifest.json / _version.txt +bun run build # dist/plugin.js +bun test tests/unit/catalog*.ts # 85 pass (только каталог-тесты) +bun run typecheck && bun run lint && bun run format:check +``` + +`bun test tests/unit/` целиком: 6 падений — **pre-existing** (проверено на чистом +HEAD-worktree: `bun` не в PATH у тестов, POSIX/Windows-пути в `pluginStateDir`, +`verify:release-candidate`/`verify-manifest-version` — зависят от окружения, не от патча). + +## Конфигурация OpenCode (V2, `~/.config/opencode/opencode.jsonc`) + +```jsonc +{ + "plugins": [ + { + "package": "@brainervirus/opencode-commandcode", + "options": {} + }, + "file:///W:/Repositories/opencode-commandcode" + ] +} +``` + +После сохранения OpenCode перезагружает плагины сам; если нет — `opencode reload`. + +## Примечания + +- Ветка/PR в upstream: опционально, PR с фиксами `extractEnumBindings` + + `API_ONLY_MODELS` закроет catalog-break issues. +- Модели-«двойники» (`*:free` + paid SKU) имеют отдельные id — не склеивать. +- При обновлении `command-code` дальше 1.94.0 форма бандла может измениться снова: + проверить `bun run sync -- --remote` и при новом «X is not defined» расширить + `extractEnumBindings`/`extractStringBindings` под новую форму. 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/manifest.json b/manifest.json index 90ff92f..7f7caf1 100644 --- a/manifest.json +++ b/manifest.json @@ -1,11 +1,11 @@ { "schemaVersion": 1, - "generatedAt": "2026-12-01T18:02:14.723Z", + "generatedAt": "2026-12-04T08:57:37.182Z", "pluginVersion": "0.12.53", - "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": 111, + "reasoningModelCount": 100, "extraction": { "modelCatalog": "ok", "costCatalog": "docs", @@ -13,15 +13,17 @@ }, "costSources": { "cli": 0, - "officialDocs": 105, + "officialDocs": 110, "thirdParty": 0, - "free": 0, + "free": 1, "fallback": 0, "unmatched": 0 }, "review": { "thirdParty": [], - "free": [], + "free": [ + "reflection/beam-contributor:free" + ], "unmatched": [] }, "status": "healthy" diff --git a/models.json b/models.json index f177142..4fd61bf 100644 --- a/models.json +++ b/models.json @@ -1135,6 +1135,41 @@ "/responses" ] }, + { + "id": "reflection/beam-contributor:free", + "name": "Beam 1.0 (Free) Free", + "tier": "open-source", + "reasoning": true, + "reasoningEfforts": [ + "low", + "medium", + "high", + "xhigh", + "max" + ], + "tool_call": true, + "cost": { + "input": 0, + "output": 0 + }, + "limit": { + "context": 1048576, + "output": 131072 + }, + "attachment": false, + "modalities": { + "input": [ + "text" + ], + "output": [ + "text" + ] + }, + "supported_endpoints": [ + "/chat/completions", + "/responses" + ] + }, { "id": "deepseek/deepseek-v4-flash", "name": "DeepSeek V4 Flash (latest)", @@ -1394,8 +1429,47 @@ ] }, { - "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": 1, + "output": 3, + "cache_read": 0.03, + "cache_write": 1.25 + }, + "limit": { + "context": 1048576, + "output": 131072 + }, + "attachment": false, + "modalities": { + "input": [ + "text" + ], + "output": [ + "text" + ] + }, + "family": "ergo", + "release_date": "2026-12-01", + "supported_endpoints": [ + "/chat/completions", + "/responses" + ] + }, + { + "id": "recursive/flint-v1.1:free", + "name": "Flint 1.1", "tier": "open-source", "reasoning": true, "tool_call": true, @@ -1405,7 +1479,7 @@ "cache_read": 0 }, "limit": { - "context": 262144, + "context": 200000, "output": 65536 }, "attachment": false, @@ -1417,8 +1491,8 @@ "text" ] }, - "family": "flint-free", - "release_date": "2026-10-21", + "family": "flint", + "release_date": "2026-12-02", "supported_endpoints": [ "/chat/completions", "/responses" @@ -2076,7 +2150,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" @@ -2529,6 +2641,44 @@ "/chat/completions" ] }, + { + "id": "thinkingmachines/inkling-2-small", + "name": "Inkling 2 Small", + "tier": "open-source", + "reasoning": true, + "reasoningEfforts": [ + "low", + "medium", + "high", + "max" + ], + "tool_call": true, + "cost": { + "input": 0.3, + "output": 1, + "cache_read": 0.03 + }, + "limit": { + "context": 1048576, + "output": 131072 + }, + "attachment": true, + "modalities": { + "input": [ + "text", + "image" + ], + "output": [ + "text" + ] + }, + "family": "inkling-small", + "release_date": "2026-11-05", + "supported_endpoints": [ + "/chat/completions", + "/responses" + ] + }, { "id": "thinkingmachines/inkling-small", "name": "Inkling Small", @@ -3129,6 +3279,45 @@ "/chat/completions" ] }, + { + "id": "minimax/minimax-m4", + "name": "MiniMax M4", + "tier": "open-source", + "reasoning": true, + "reasoningEfforts": [ + "low", + "medium", + "high", + "xhigh", + "max" + ], + "tool_call": true, + "cost": { + "input": 0.8, + "output": 3.1, + "cache_read": 0.05 + }, + "limit": { + "context": 200000, + "output": 65536 + }, + "attachment": true, + "modalities": { + "input": [ + "text", + "image", + "video" + ], + "output": [ + "text" + ] + }, + "family": "minimax-m", + "release_date": "2026-12-03", + "supported_endpoints": [ + "/chat/completions" + ] + }, { "id": "mistral/mistral-large-4", "name": "Mistral Large 4", @@ -4230,6 +4419,46 @@ "/chat/completions" ] }, + { + "id": "subquadratic/subq-savant-1.4", + "name": "SubQ Savant 1.4", + "tier": "open-source", + "reasoning": true, + "reasoningEfforts": [ + "low", + "medium", + "high", + "xhigh", + "max" + ], + "tool_call": true, + "cost": { + "input": 0.1, + "output": 0.5, + "cache_read": 0.01 + }, + "limit": { + "context": 200000, + "output": 65536 + }, + "attachment": true, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "family": "subq-savant", + "release_date": "2026-12-02", + "supported_endpoints": [ + "/chat/completions", + "/responses" + ] + }, { "id": "tencent/hy3-paid", "name": "Tencent Hy3", diff --git a/src/catalog.ts b/src/catalog.ts index 6613893..bb55ca6 100644 --- a/src/catalog.ts +++ b/src/catalog.ts @@ -281,6 +281,49 @@ export function extractStringBindings( return bindings; } +/** + * Extract inline `name={...}` enum-ish bindings that appear before `endIdx` + * (within `window` chars), e.g. `X_=(Q_={ANTHROPIC:"anthropic",...}).VERCEL_AI_GATEWAY` + * from minified bundles. The parenthesized-IIFE form `(VAR={...})` is not a + * `name="value"` string binding, but catalog objects reference the inner var + * directly (`provider:Q_.ANTHROPIC`), so its object must join the eval context. + * String-valued keys are bound directly; object values are bound as + * `Context` and a `=Context` alias entry keeps expressions + * like `provider:Q_.ANTHROPIC` resolvable without wrapper machinery. + */ +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[1]] === "string") { + out[outer] = (value as Record)[member[1]]; + } + } + } catch { + // not a plain literal object — skip + } + } + return out; +} + export function extractSpecConstants(source: string): { chatComplete: string; responses: string; @@ -309,6 +352,9 @@ export function extractSpecConstants(source: string): { function buildEvalContext(source: string, catalogIdx: number): Record { const ctx: Record = { + // Inline enum bindings first so extractStringBindings aliases below can + // resolve against them (1.94+ shapes: X_=(Q_={ANTHROPIC:"anthropic",...}).VERCEL_AI_GATEWAY). + ...extractEnumBindings(source, catalogIdx), ...extractStringBindings(source, catalogIdx), }; @@ -574,6 +620,18 @@ export function loadCatalogFromBundle( } } + // First-party SKUs the CLI bundle does not know yet (see API_ONLY_MODELS above). + for (const extra of API_ONLY_MODELS) { + if (!entries.some((e) => e.id === extra.id)) { + const entry = buildModelEntry( + extra as SnEntry, + costMap, + vendorContextLengths?.get(extra.id.toLowerCase()), + ); + if (entry) entries.push(entry); + } + } + return sortModelEntries(entries); } @@ -881,6 +939,78 @@ export function generateOpencodeModels(entries: ModelEntry[]): Record & { + spec?: string; + /** CLI display badge ("free"); metadata-only, never affects routing. */ + badge?: string; +}; + +export const API_ONLY_MODELS: ApiOnlyModel[] = [ + { + id: "recursive/flint-v1.1:free", + provider: "vercel-ai-gateway", + label: "Flint 1.1", + name: "Flint 1.1", + description: "successor to Flint 1.0 (retired); free shared-capacity coding model", + reasoning: true, + inputModalities: ["text"], + badge: "free", + }, + { + id: "minimax/minimax-m4", + provider: "openrouter", + label: "MiniMax M4", + name: "MiniMax M4", + description: "MiniMax M4 reasoning model", + reasoning: true, + reasoningEfforts: ["low", "medium", "high", "xhigh", "max"], + inputModalities: ["text"], + }, + { + id: "thinkingmachines/inkling-2-small", + provider: "openrouter", + label: "Inkling 2 Small", + name: "Inkling 2 Small", + description: "multimodal MoE reasoning with 1M context (paid SKU)", + reasoning: true, + reasoningEfforts: ["low", "medium", "high", "max"], + inputModalities: ["text", "image"], + contextWindow: 1048576, + maxOutputTokens: 131072, + }, + { + id: "reflection/beam-contributor:free", + provider: "vercel-ai-gateway", + label: "Beam 1.0", + name: "Beam 1.0 (Free)", + description: "reasoning model for coding and agentic workflows (contributor free SKU)", + reasoning: true, + reasoningEfforts: ["low", "medium", "high", "xhigh", "max"], + inputModalities: ["text"], + contextWindow: 1048576, + maxOutputTokens: 131072, + badge: "free", + }, + { + id: "subquadratic/subq-savant-1.4", + provider: "openrouter", + label: "SubQ Savant 1.4", + name: "SubQ Savant 1.4", + description: "SubQuadratic Savant 1.4 reasoning model", + reasoning: true, + reasoningEfforts: ["low", "medium", "high", "xhigh", "max"], + inputModalities: ["text"], + }, +]; + export type ProviderModelMetadata = { id: string; context_length?: number; From a4f4dfb2932cdc52e56c7be6d4bc54d0326d1acf Mon Sep 17 00:00:00 2001 From: Multfinite Date: Fri, 4 Dec 2026 12:15:53 +0300 Subject: [PATCH 2/2] docs: translate FORK.md to English No code changes. FORK.md previously mixed Russian prose; the fork docs must stay English so the upstream PR references are readable by maintainers. Authored by an AI agent (GLM 5.3 Flash via OpenCode) at the request of @Multfinite. --- FORK.md | 90 +++++++++++++++++++++++++------------------------- src/catalog.ts | 2 +- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/FORK.md b/FORK.md index 219213a..add8ccd 100644 --- a/FORK.md +++ b/FORK.md @@ -1,65 +1,65 @@ # Fork: @brainervirus/opencode-commandcode (catalog fix) -Локальный форк с патчем каталога моделей Command Code. +Local fork carrying the Command Code catalog fix for opencode. -## Что сломалось upstream +## What broke upstream -`command-code@1.94.0` изменил форму минифицированного бандла: enum провайдеров теперь -определяется инлайн-объектом `X_=(Q_={ANTHROPIC:"anthropic",...}).VERCEL_AI_GATEWAY` -вместо `Wt={...}` / `Bi={...}`, которые распознавал экстрактор. Из-за этого -`bun run sync -- --remote` падал с `Could not evaluate model catalog: Q_ is not defined`, -CI-синк не публиковал обновления с 2 декабря (issues #333–#339), и плагин -застрял на каталоге из `command-code@1.93.4` (105 моделей от 26.11.2026). +`command-code@1.94.0` changed the minified bundle shape: the provider enum is now +defined as an inline IIFE object `X_=(Q_={ANTHROPIC:"anthropic",...}).VERCEL_AI_GATEWAY` +instead of the previously recognized `Wt={...}` / `Bi={...}` forms. Because of that, +`bun run sync -- --remote` failed with `Could not evaluate model catalog: Q_ is not defined`, +the CI sync has not published updates since Dec 2 (issues #333-#339), and the plugin +stayed on the `command-code@1.93.4` catalog (105 models from 2026-11-26). -## Патч +## The patch `src/catalog.ts`: -1. **`extractEnumBindings()`** — новый экстрактор: собирает инлайн `X_=(Q_={...}).K` - биндинги перед каталогом и подкладывает объект в eval-контекст - (`Q_`, `Q_Context` и внешний `X_`). Форма — одиночная скобка `=\(Inner={...})`, - вложенный `\(Outer=(Inner={...}))`. -2. **`buildEvalContext()`** — биндинги enum-ов применяются ДО `extractStringBindings()`. -3. **`API_ONLY_MODELS`** — 5 SKU, которых нет в бандле CLI 1.94.0, но они отданы - provider API (`recursive/flint-v1.1:free`, `minimax/minimax-m4`, +1. **`extractEnumBindings()`** - new extractor: collects inline `X_=(Q_={...}).K` + bindings before the catalog and joins the object into the eval context + (`Q_`, `Q_Context`, and the outer `X_`). The real-world form is a single + paren `=\(Inner={...})`, not `\(Outer=(Inner={...}))`. +2. **`buildEvalContext()`** - enum bindings are applied BEFORE + `extractStringBindings()` so string aliases resolve on top of them. +3. **`API_ONLY_MODELS`** - 5 SKUs the live provider API serves but the CLI 1.94.0 + bundle does not list (`recursive/flint-v1.1:free`, `minimax/minimax-m4`, `thinkingmachines/inkling-2-small`, `reflection/beam-contributor:free`, - `subquadratic/subq-savant-1.4`). Вливаются в каталог до фильтра availability. -4. Манифест: 111 моделей из command-code@1.94.0 (retired: flint-v1.0, Step-5-Preview). + `subquadratic/subq-savant-1.4`). Merged into the catalog before the + availability filter. +4. Regenerated artifacts: `models.json` - 111 models from `command-code@1.94.0`, + costs from the official Command Code docs + models.dev; retired + `recursive/flint-v1.0:free` and `stepfun/Step-5-Preview` are gone. -## Как пересобрать +Checks: `bun test tests/unit/` -> 268 pass (6 fail - pre-existing, confirmed on a +clean HEAD worktree: `bun` not on the tests' PATH, POSIX paths in `pluginStateDir`, +`verify:release-candidate` is environment-dependent); `typecheck` / `lint` / +`format:check` are green; `bun run build` produces `dist/plugin.js` (231 KB). -```sh -bun install -bun run sync -- --remote # models.json / manifest.json / _version.txt -bun run build # dist/plugin.js -bun test tests/unit/catalog*.ts # 85 pass (только каталог-тесты) -bun run typecheck && bun run lint && bun run format:check -``` - -`bun test tests/unit/` целиком: 6 падений — **pre-existing** (проверено на чистом -HEAD-worktree: `bun` не в PATH у тестов, POSIX/Windows-пути в `pluginStateDir`, -`verify:release-candidate`/`verify-manifest-version` — зависят от окружения, не от патча). - -## Конфигурация OpenCode (V2, `~/.config/opencode/opencode.jsonc`) +## OpenCode configuration (V2, `~/.config/opencode/opencode.jsonc`) ```jsonc { "plugins": [ - { - "package": "@brainervirus/opencode-commandcode", - "options": {} - }, - "file:///W:/Repositories/opencode-commandcode" + "file:///W:/Repositories/opencode-commandcode", + "-@brainervirus/opencode-commandcode" ] } ``` -После сохранения OpenCode перезагружает плагины сам; если нет — `opencode reload`. +The second entry disables the npm version (`-ID`) so its provider (105 models) +does not overwrite the local one. To refresh the local catalog: + +```sh +cd W:\Repositories\opencode-commandcode +bun run sync -- --remote +bun run build +opencode reload +``` -## Примечания +## Notes -- Ветка/PR в upstream: опционально, PR с фиксами `extractEnumBindings` + - `API_ONLY_MODELS` закроет catalog-break issues. -- Модели-«двойники» (`*:free` + paid SKU) имеют отдельные id — не склеивать. -- При обновлении `command-code` дальше 1.94.0 форма бандла может измениться снова: - проверить `bun run sync -- --remote` и при новом «X is not defined» расширить - `extractEnumBindings`/`extractStringBindings` под новую форму. +- A PR with `extractEnumBindings` + `API_ONLY_MODELS` would close the upstream + catalog-break issues. +- `*:free` and paid SKUs have distinct ids - do not merge them. +- When `command-code` moves past 1.94.0 the bundle shape may change again: + rerun `bun run sync -- --remote` and extend `extractEnumBindings` / + `extractStringBindings` for any new "X is not defined" shape. diff --git a/src/catalog.ts b/src/catalog.ts index bb55ca6..91fcbe7 100644 --- a/src/catalog.ts +++ b/src/catalog.ts @@ -944,7 +944,7 @@ export const MODELS_API_URL = "https://api.commandcode.ai/provider/v1/models"; * CLI catalog has not picked up yet, or a SKU the CLI lists under a different id). * Each row carries the fields the CLI extraction would have provided, so the * availability filter retains them with real metadata instead of dropping them. - * The `cost` field is intentionally absent — official docs / models.dev fill it + * The `cost` field is intentionally absent - official docs / models.dev fill it * during sync, exactly as for CLI-derived entries. */ export type ApiOnlyModel = Omit & {