opencode-cmd-provider 1.1.0 → 1.1.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.1 - 2026-08-20
4
+
5
+ Fix: generate image-input modalities from the Command Code CLI catalog.
6
+
7
+ - `MODEL_INPUT_MODALITIES` now comes from `inputModalities` fields in the
8
+ parsed `command-code` CLI bundle instead of a hand-maintained table.
9
+ - The release refresh validates that every API snapshot model is represented
10
+ in the CLI bundle and fails loudly on unsupported or conflicting modality
11
+ data.
12
+ - Added AST parser and offline coverage for reordered fields, duplicate model
13
+ entries, malformed bundles, and text-only fallback behavior.
14
+ - Docs: the release skill and facts-sync spec now describe the modality
15
+ refresh and the new release-gate failure mode.
16
+ - Thanks to @ericpastorm for #31, which auto-syncs the input-modality table
17
+ from the CLI catalog.
18
+
3
19
  ## 1.1.0 - 2026-08-20
4
20
 
5
21
  Feature: complete capability metadata for every catalog model, with automatic sync of reasoning and pricing facts at release time.
package/README.md CHANGED
@@ -113,12 +113,14 @@ bundled, and the plugin never contacts the Command Code API to list models. The
113
113
  plugin works fully offline; model availability never depends on the catalog
114
114
  endpoint being reachable.
115
115
 
116
- The following environment variable is intended for tests, local mocks, and
116
+ The following environment variables are intended for tests, local mocks, and
117
117
  compatible API endpoints:
118
118
 
119
- | Variable | Purpose |
120
- | ---------------------- | -------------------------------------- |
121
- | `COMMANDCODE_API_BASE` | Override the Command Code API base URL |
119
+ | Variable | Purpose |
120
+ | ---------------------------- | -------------------------------------- |
121
+ | `COMMANDCODE_API_BASE` | Override the Command Code API base URL |
122
+ | `COMMANDCODE_FACTS_URL` | Override the bundled `models.md` URL |
123
+ | `COMMANDCODE_MODALITIES_URL` | Override the CLI bundle URL |
122
124
 
123
125
  ### Reasoning support
124
126
 
@@ -128,13 +130,13 @@ Reasoning blocks from completed assistant turns are not replayed to Command Code
128
130
 
129
131
  ## Image input
130
132
 
131
- Image input is advertised only for models marked with the `image` input modality in the Command Code model catalog. The capability snapshot follows the current official CLI catalog; unknown models default to text-only until their upstream metadata is reviewed.
133
+ Image input is advertised only for models marked with the `image` input modality in the Command Code CLI bundle. The release-time refresh generates this map into `src/catalog/facts.ts`; unknown models default to text-only until their upstream metadata is reviewed.
132
134
 
133
135
  For vision-capable models, image blocks from user messages and tool results are forwarded in Command Code's data-URL wire format. Text-only models reject image content before making a network request instead of silently dropping it.
134
136
 
135
137
  ## Pricing display
136
138
 
137
- The Command Code Provider API does not currently include prices in its model catalog. This provider keeps a static table for models with known prices so OpenCode can display estimated request costs.
139
+ The Command Code Provider API does not currently include prices in its model catalog. This provider generates a table from the bundled `models.md` catalog so OpenCode can display estimated request costs.
138
140
 
139
141
  Models missing from that table display zero cost in OpenCode. This does **not** mean Command Code will bill the request at zero. Check the current [Command Code pricing](https://commandcode.ai/docs/resources/pricing-limits) before relying on the displayed value.
140
142
 
@@ -1,4 +1,5 @@
1
1
  export declare const FACTS_SOURCE_URL = "https://unpkg.com/command-code@1.28.1/dist/bundled/command-code-knowledge/reference/models.md";
2
+ export declare const MODALITIES_SOURCE_URL = "https://unpkg.com/command-code@1.28.1/dist/cli.mjs";
2
3
  export declare const FACTS_PACKAGE_VERSION = "1.28.1";
3
4
  export declare const FACTS_LAST_REFRESHED = "2026-08-19";
4
5
  export declare const MODEL_EFFORTS: Readonly<Record<string, readonly string[]>>;
@@ -8,3 +9,4 @@ export declare const MODEL_COSTS: Readonly<Record<string, {
8
9
  cacheRead: number;
9
10
  cacheWrite: number;
10
11
  }>>;
12
+ export declare const MODEL_INPUT_MODALITIES: Readonly<Record<string, readonly ("text" | "image")[]>>;
@@ -1,9 +1,11 @@
1
1
  // src/catalog/facts.ts — GENERATED by scripts/refresh-snapshot.mjs. Do not edit.
2
2
  //
3
3
  // Capability facts (reasoning efforts + per-1M-token rates) parsed from the
4
- // command-code npm package's bundled model catalog (models.md). Regenerate
4
+ // command-code npm package's bundled model catalog (models.md), plus input
5
+ // modalities parsed from its CLI bundle (dist/cli.mjs). Regenerate
5
6
  // with `npm run refresh:snapshot`.
6
7
  export const FACTS_SOURCE_URL = "https://unpkg.com/command-code@1.28.1/dist/bundled/command-code-knowledge/reference/models.md";
8
+ export const MODALITIES_SOURCE_URL = "https://unpkg.com/command-code@1.28.1/dist/cli.mjs";
7
9
  export const FACTS_PACKAGE_VERSION = "1.28.1";
8
10
  export const FACTS_LAST_REFRESHED = "2026-08-19";
9
11
  export const MODEL_EFFORTS = {
@@ -93,3 +95,44 @@ export const MODEL_COSTS = {
93
95
  "xai/grok-4.5": { input: 2, output: 6, cacheRead: 0.5, cacheWrite: 0 },
94
96
  "xai/grok-4.6": { input: 2, output: 6, cacheRead: 0.5, cacheWrite: 0 },
95
97
  };
98
+ export const MODEL_INPUT_MODALITIES = {
99
+ "MiniMaxAI/MiniMax-M3": ["text", "image"],
100
+ "Qwen/Qwen3.6-Plus": ["text", "image"],
101
+ "Qwen/Qwen3.7-Flash": ["text", "image"],
102
+ "Qwen/Qwen3.7-Plus": ["text", "image"],
103
+ "Qwen/Qwen3.8-27B": ["text", "image"],
104
+ "Qwen/Qwen3.8-Max": ["text", "image"],
105
+ "claude-fable-5": ["text", "image"],
106
+ "claude-haiku-4-5-20251001": ["text", "image"],
107
+ "claude-opus-4-7": ["text", "image"],
108
+ "claude-opus-4-8": ["text", "image"],
109
+ "claude-opus-5": ["text", "image"],
110
+ "claude-sonnet-4-6": ["text", "image"],
111
+ "claude-sonnet-5": ["text", "image"],
112
+ "google/gemini-3.1-flash-lite": ["text", "image"],
113
+ "google/gemini-3.5-flash": ["text", "image"],
114
+ "google/gemini-3.5-flash-lite": ["text", "image"],
115
+ "google/gemini-3.6-flash": ["text", "image"],
116
+ "google/gemini-3.7-flash": ["text", "image"],
117
+ "gpt-5.3-codex": ["text", "image"],
118
+ "gpt-5.4": ["text", "image"],
119
+ "gpt-5.4-mini": ["text", "image"],
120
+ "gpt-5.5": ["text", "image"],
121
+ "gpt-5.6-luna": ["text", "image"],
122
+ "gpt-5.6-sol": ["text", "image"],
123
+ "gpt-5.6-terra": ["text", "image"],
124
+ "meta/muse-spark-1.1": ["text", "image"],
125
+ "meta/muse-spark-1.2": ["text", "image"],
126
+ "meta/muse-spark-1.2-contributor": ["text", "image"],
127
+ "moonshotai/Kimi-K2.5": ["text", "image"],
128
+ "moonshotai/Kimi-K2.6": ["text", "image"],
129
+ "moonshotai/Kimi-K2.7-Code": ["text", "image"],
130
+ "moonshotai/Kimi-K2.7-Code-Highspeed": ["text", "image"],
131
+ "moonshotai/Kimi-K3": ["text", "image"],
132
+ "sakana/fugu-ultra": ["text", "image"],
133
+ "stepfun/Step-3.7-Flash": ["text", "image"],
134
+ "thinkingmachines/inkling": ["text", "image"],
135
+ "thinkingmachines/inkling-small": ["text", "image"],
136
+ "xai/grok-4.5": ["text", "image"],
137
+ "xiaomi/mimo-v2.5": ["text", "image"],
138
+ };
@@ -1,9 +1,5 @@
1
+ import { MODEL_INPUT_MODALITIES } from "../catalog/facts.js";
1
2
  export type CommandCodeInputType = "text" | "image";
2
- /**
3
- * Model input modalities from the command-code@1.15.1 bundled catalog.
4
- * Models omitted here remain text-only so newly discovered IDs never claim
5
- * image support without upstream evidence.
6
- */
7
- export declare const MODEL_INPUT_MODALITIES: Readonly<Record<string, readonly CommandCodeInputType[]>>;
3
+ export { MODEL_INPUT_MODALITIES };
8
4
  export declare function inputModalitiesForModel(modelId: string): readonly CommandCodeInputType[];
9
5
  export declare function modelSupportsImageInput(modelId: string): boolean;
@@ -1,51 +1,7 @@
1
- // src/provider/modalities.ts — image input modality table (PLAN #5 Part B,
2
- // port of pi's models.ts:17-55)
3
- /**
4
- * Model input modalities from the command-code@1.15.1 bundled catalog.
5
- * Models omitted here remain text-only so newly discovered IDs never claim
6
- * image support without upstream evidence.
7
- */
8
- export const MODEL_INPUT_MODALITIES = {
9
- "MiniMaxAI/MiniMax-M3": ["text", "image"],
10
- "Qwen/Qwen3.6-Plus": ["text", "image"],
11
- "Qwen/Qwen3.7-Flash": ["text", "image"],
12
- "Qwen/Qwen3.7-Plus": ["text", "image"],
13
- "Qwen/Qwen3.8-Max": ["text", "image"],
14
- "claude-fable-5": ["text", "image"],
15
- "claude-haiku-4-5-20251001": ["text", "image"],
16
- "claude-opus-4-7": ["text", "image"],
17
- "claude-opus-4-8": ["text", "image"],
18
- "claude-opus-5": ["text", "image"],
19
- "claude-sonnet-4-6": ["text", "image"],
20
- "claude-sonnet-5": ["text", "image"],
21
- "google/gemini-3.1-flash-lite": ["text", "image"],
22
- "google/gemini-3.5-flash": ["text", "image"],
23
- "google/gemini-3.5-flash-lite": ["text", "image"],
24
- "google/gemini-3.6-flash": ["text", "image"],
25
- "google/gemini-3.7-flash": ["text", "image"],
26
- "gpt-5.3-codex": ["text", "image"],
27
- "gpt-5.4": ["text", "image"],
28
- "gpt-5.4-mini": ["text", "image"],
29
- "gpt-5.5": ["text", "image"],
30
- "gpt-5.6-luna": ["text", "image"],
31
- "gpt-5.6-sol": ["text", "image"],
32
- "gpt-5.6-terra": ["text", "image"],
33
- "meta/muse-spark-1.1": ["text", "image"],
34
- "meta/muse-spark-1.2": ["text", "image"],
35
- "meta/muse-spark-1.2-contributor": ["text", "image"],
36
- "moonshotai/Kimi-K2.5": ["text", "image"],
37
- "moonshotai/Kimi-K2.6": ["text", "image"],
38
- "moonshotai/Kimi-K2.7-Code": ["text", "image"],
39
- "moonshotai/Kimi-K2.7-Code-Highspeed": ["text", "image"],
40
- "moonshotai/Kimi-K3": ["text", "image"],
41
- "Qwen/Qwen3.8-27B": ["text", "image"],
42
- "sakana/fugu-ultra": ["text", "image"],
43
- "stepfun/Step-3.7-Flash": ["text", "image"],
44
- "thinkingmachines/inkling": ["text", "image"],
45
- "thinkingmachines/inkling-small": ["text", "image"],
46
- "xai/grok-4.5": ["text", "image"],
47
- "xiaomi/mimo-v2.5": ["text", "image"],
48
- };
1
+ // src/provider/modalities.ts — image input modalities from generated catalog
2
+ // facts. Text-only models are intentionally omitted and use the fallback below.
3
+ import { MODEL_INPUT_MODALITIES } from "../catalog/facts.js";
4
+ export { MODEL_INPUT_MODALITIES };
49
5
  const TEXT_INPUT_ONLY = ["text"];
50
6
  export function inputModalitiesForModel(modelId) {
51
7
  return MODEL_INPUT_MODALITIES[modelId] ?? TEXT_INPUT_ONLY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-cmd-provider",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Command Code provider + plugin for opencode",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "typecheck": "tsc --noEmit",
20
20
  "refresh:snapshot": "node scripts/refresh-snapshot.mjs",
21
21
  "test": "npm run typecheck && npm run test:unit && npm run test:integration && npm run test:contract && npm run format:check",
22
- "test:unit": "tsx tests/env.test.ts && tsx tests/auth-key.test.ts && tsx tests/converters.test.ts && tsx tests/stream.test.ts && tsx tests/redact.test.ts && tsx tests/cost.test.ts && tsx tests/retry.test.ts && tsx tests/reasoning.test.ts && tsx tests/modalities.test.ts && tsx tests/snapshot.test.ts && tsx tests/refresh-snapshot.test.ts && tsx tests/oauth.test.ts && tsx tests/parse-facts.test.ts && tsx tests/catalog-metadata.test.ts && tsx tests/plugin-models.test.ts",
22
+ "test:unit": "tsx tests/env.test.ts && tsx tests/auth-key.test.ts && tsx tests/converters.test.ts && tsx tests/stream.test.ts && tsx tests/redact.test.ts && tsx tests/cost.test.ts && tsx tests/retry.test.ts && tsx tests/reasoning.test.ts && tsx tests/modalities.test.ts && tsx tests/snapshot.test.ts && tsx tests/refresh-snapshot.test.ts && tsx tests/oauth.test.ts && tsx tests/parse-facts.test.ts && tsx tests/parse-modalities.test.ts && tsx tests/catalog-metadata.test.ts && tsx tests/plugin-models.test.ts",
23
23
  "test:integration": "tsx tests/integration-do-stream.test.ts && tsx tests/integration-do-generate.test.ts",
24
24
  "test:contract": "tsx tests/contract.test.ts",
25
25
  "test:e2e": "node tests/e2e-opencode.mjs",
@@ -44,6 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@opencode-ai/plugin": "*",
46
46
  "@types/node": "^26.2.0",
47
+ "acorn": "^8.18.0",
47
48
  "prettier": "^3.9.6",
48
49
  "tsx": "^4.23.12",
49
50
  "typescript": "^7.0.2"