@telsoncc/opencode-commandcode 1.2.25 → 1.2.27
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 +4 -0
- package/_version.txt +1 -1
- package/manifest.json +10 -9
- package/models.json +51 -0
- package/package.json +1 -1
- package/src/catalog.ts +85 -5
- package/src/opencode2.ts +24 -0
package/CHANGELOG.md
CHANGED
package/_version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.86.3
|
package/manifest.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-10-
|
|
4
|
-
"pluginVersion": "1.2.
|
|
5
|
-
"commandCodeVersion": "1.
|
|
6
|
-
"commandCodeTarball": "https://registry.npmjs.org/command-code/-/command-code-1.
|
|
7
|
-
"modelCount":
|
|
8
|
-
"reasoningModelCount":
|
|
3
|
+
"generatedAt": "2026-10-21T03:25:57.316Z",
|
|
4
|
+
"pluginVersion": "1.2.27",
|
|
5
|
+
"commandCodeVersion": "1.86.3",
|
|
6
|
+
"commandCodeTarball": "https://registry.npmjs.org/command-code/-/command-code-1.86.3.tgz",
|
|
7
|
+
"modelCount": 96,
|
|
8
|
+
"reasoningModelCount": 83,
|
|
9
9
|
"extraction": {
|
|
10
10
|
"modelCatalog": "ok",
|
|
11
11
|
"costCatalog": "docs",
|
|
@@ -13,16 +13,17 @@
|
|
|
13
13
|
},
|
|
14
14
|
"costSources": {
|
|
15
15
|
"cli": 0,
|
|
16
|
-
"officialDocs":
|
|
16
|
+
"officialDocs": 94,
|
|
17
17
|
"thirdParty": 0,
|
|
18
|
-
"free":
|
|
18
|
+
"free": 2,
|
|
19
19
|
"fallback": 0,
|
|
20
20
|
"unmatched": 0
|
|
21
21
|
},
|
|
22
22
|
"review": {
|
|
23
23
|
"thirdParty": [],
|
|
24
24
|
"free": [
|
|
25
|
-
"minimax/minimax-m3.1-flash:free"
|
|
25
|
+
"minimax/minimax-m3.1-flash:free",
|
|
26
|
+
"ornith/ornith-1.5-122b:free"
|
|
26
27
|
],
|
|
27
28
|
"unmatched": []
|
|
28
29
|
},
|
package/models.json
CHANGED
|
@@ -2454,6 +2454,57 @@
|
|
|
2454
2454
|
]
|
|
2455
2455
|
}
|
|
2456
2456
|
},
|
|
2457
|
+
{
|
|
2458
|
+
"id": "ornith/ornith-1.5-122b",
|
|
2459
|
+
"name": "Ornith 1.5 122B",
|
|
2460
|
+
"tier": "open-source",
|
|
2461
|
+
"reasoning": true,
|
|
2462
|
+
"tool_call": true,
|
|
2463
|
+
"cost": {
|
|
2464
|
+
"input": 0.16,
|
|
2465
|
+
"output": 0.64,
|
|
2466
|
+
"cache_read": 0.02
|
|
2467
|
+
},
|
|
2468
|
+
"limit": {
|
|
2469
|
+
"context": 262144,
|
|
2470
|
+
"output": 65536
|
|
2471
|
+
},
|
|
2472
|
+
"attachment": true,
|
|
2473
|
+
"modalities": {
|
|
2474
|
+
"input": [
|
|
2475
|
+
"text",
|
|
2476
|
+
"image"
|
|
2477
|
+
],
|
|
2478
|
+
"output": [
|
|
2479
|
+
"text"
|
|
2480
|
+
]
|
|
2481
|
+
}
|
|
2482
|
+
},
|
|
2483
|
+
{
|
|
2484
|
+
"id": "ornith/ornith-1.5-122b:free",
|
|
2485
|
+
"name": "Ornith 1.5 122B Free",
|
|
2486
|
+
"tier": "open-source",
|
|
2487
|
+
"reasoning": true,
|
|
2488
|
+
"tool_call": true,
|
|
2489
|
+
"cost": {
|
|
2490
|
+
"input": 0,
|
|
2491
|
+
"output": 0
|
|
2492
|
+
},
|
|
2493
|
+
"limit": {
|
|
2494
|
+
"context": 262144,
|
|
2495
|
+
"output": 65536
|
|
2496
|
+
},
|
|
2497
|
+
"attachment": true,
|
|
2498
|
+
"modalities": {
|
|
2499
|
+
"input": [
|
|
2500
|
+
"text",
|
|
2501
|
+
"image"
|
|
2502
|
+
],
|
|
2503
|
+
"output": [
|
|
2504
|
+
"text"
|
|
2505
|
+
]
|
|
2506
|
+
}
|
|
2507
|
+
},
|
|
2457
2508
|
{
|
|
2458
2509
|
"id": "Qwen/Qwen3.6-Max-Preview",
|
|
2459
2510
|
"name": "Qwen 3.6 Max Preview",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telsoncc/opencode-commandcode",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.27",
|
|
4
4
|
"description": "Command Code API provider for opencode — use Claude, GPT, Gemini, DeepSeek, Qwen, Kimi, GLM, MiniMax, and Step models via Command Code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
package/src/catalog.ts
CHANGED
|
@@ -19,6 +19,40 @@ export interface ModelEntry {
|
|
|
19
19
|
modalities?: { input: string[]; output: string[] };
|
|
20
20
|
/** Runtime estimate from models.dev — replaced on the next catalog sync. */
|
|
21
21
|
estimated?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Wire endpoints the gateway serves this model on, as advertised by the
|
|
24
|
+
* vendor `/models` payload (`supported_endpoints`). Absent on catalogs
|
|
25
|
+
* extracted before the field existed; `modelTransport` falls back to the
|
|
26
|
+
* model family in that case.
|
|
27
|
+
*/
|
|
28
|
+
supportedEndpoints?: string[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** OpenAI-shaped wire (`/chat/completions`) vs Anthropic Messages (`/messages`). */
|
|
32
|
+
export type ModelTransport = "chat" | "messages";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Which wire shape a model is served on. A model that is Messages-only cannot
|
|
36
|
+
* be called through `/chat/completions` — the gateway rejects it with
|
|
37
|
+
* `must be called via /provider/v1/messages` — so the transport has to be
|
|
38
|
+
* resolved per model, not per provider.
|
|
39
|
+
*
|
|
40
|
+
* Falls back to the model family when the catalog carries no
|
|
41
|
+
* `supported_endpoints`: the `claude-*` family is the only Messages-only group
|
|
42
|
+
* the gateway serves, so the heuristic is exact for catalogs that predate the
|
|
43
|
+
* field. Family matching runs on the config key, so a vendor-prefixed id like
|
|
44
|
+
* `anthropic/claude-sonnet-5` resolves the same as a bare one.
|
|
45
|
+
*/
|
|
46
|
+
export function modelTransport(
|
|
47
|
+
entry: Pick<ModelEntry, "id" | "supportedEndpoints">,
|
|
48
|
+
): ModelTransport {
|
|
49
|
+
const endpoints = entry.supportedEndpoints;
|
|
50
|
+
if (endpoints && endpoints.length > 0) {
|
|
51
|
+
return endpoints.includes("/messages") && !endpoints.includes("/chat/completions")
|
|
52
|
+
? "messages"
|
|
53
|
+
: "chat";
|
|
54
|
+
}
|
|
55
|
+
return toConfigKey(entry.id).startsWith("claude-") ? "messages" : "chat";
|
|
22
56
|
}
|
|
23
57
|
|
|
24
58
|
export interface CostEntry {
|
|
@@ -794,8 +828,26 @@ function isNonEmptyString(value: unknown): value is string {
|
|
|
794
828
|
return typeof value === "string" && value.length > 0;
|
|
795
829
|
}
|
|
796
830
|
|
|
831
|
+
/**
|
|
832
|
+
* One row of the vendor availability payload. `supported_endpoints` is
|
|
833
|
+
* optional upstream data: it is kept only when it is an array of non-empty
|
|
834
|
+
* strings, so a schema nudge there can never fail a whole catalog sync.
|
|
835
|
+
*/
|
|
836
|
+
export interface AvailabilityModel {
|
|
837
|
+
id: string;
|
|
838
|
+
supportedEndpoints?: string[];
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
function parseSupportedEndpoints(value: unknown): string[] | undefined {
|
|
842
|
+
if (!Array.isArray(value)) return undefined;
|
|
843
|
+
const endpoints = value.filter(
|
|
844
|
+
(item): item is string => typeof item === "string" && item.length > 0,
|
|
845
|
+
);
|
|
846
|
+
return endpoints.length > 0 ? endpoints : undefined;
|
|
847
|
+
}
|
|
848
|
+
|
|
797
849
|
/** Validate the OpenAI-style `{ object: "list", data: [{ id }] }` availability payload. */
|
|
798
|
-
export function
|
|
850
|
+
export function parseAvailability(payload: unknown): AvailabilityModel[] {
|
|
799
851
|
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
800
852
|
throw new Error("availability response must be an object");
|
|
801
853
|
}
|
|
@@ -805,21 +857,49 @@ export function parseAvailabilityIds(payload: unknown): string[] {
|
|
|
805
857
|
if (!Array.isArray(data) || data.length === 0) {
|
|
806
858
|
throw new Error("availability response data must be a non-empty array");
|
|
807
859
|
}
|
|
808
|
-
const
|
|
860
|
+
const models: AvailabilityModel[] = [];
|
|
809
861
|
const seen = new Set<string>();
|
|
810
862
|
for (const item of data) {
|
|
811
863
|
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
812
864
|
throw new Error("availability response items must be objects with a non-empty string id");
|
|
813
865
|
}
|
|
814
|
-
const
|
|
866
|
+
const row = item as Record<string, unknown>;
|
|
867
|
+
const id = row["id"];
|
|
815
868
|
if (!isNonEmptyString(id)) {
|
|
816
869
|
throw new Error("availability response items must be objects with a non-empty string id");
|
|
817
870
|
}
|
|
818
871
|
if (seen.has(id)) throw new Error(`duplicate availability id: ${id}`);
|
|
819
872
|
seen.add(id);
|
|
820
|
-
|
|
873
|
+
const supportedEndpoints = parseSupportedEndpoints(row["supported_endpoints"]);
|
|
874
|
+
models.push(supportedEndpoints ? { id, supportedEndpoints } : { id });
|
|
875
|
+
}
|
|
876
|
+
return models;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/** Validate the OpenAI-style `{ object: "list", data: [{ id }] }` availability payload. */
|
|
880
|
+
export function parseAvailabilityIds(payload: unknown): string[] {
|
|
881
|
+
return parseAvailability(payload).map((model) => model.id);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Copy `supported_endpoints` from the availability payload onto matching
|
|
886
|
+
* entries. Entries the payload omits, or lists without usable endpoints, are
|
|
887
|
+
* left untouched — a partial payload never strips transport data already on
|
|
888
|
+
* the catalog. Returns how many entries were updated.
|
|
889
|
+
*/
|
|
890
|
+
export function applyAvailabilityEndpoints<T extends { id: string; supportedEndpoints?: string[] }>(
|
|
891
|
+
entries: T[],
|
|
892
|
+
availability: readonly AvailabilityModel[],
|
|
893
|
+
): number {
|
|
894
|
+
const byId = new Map(availability.map((model) => [model.id, model.supportedEndpoints]));
|
|
895
|
+
let updated = 0;
|
|
896
|
+
for (const entry of entries) {
|
|
897
|
+
const endpoints = byId.get(entry.id);
|
|
898
|
+
if (!endpoints) continue;
|
|
899
|
+
entry.supportedEndpoints = endpoints;
|
|
900
|
+
updated++;
|
|
821
901
|
}
|
|
822
|
-
return
|
|
902
|
+
return updated;
|
|
823
903
|
}
|
|
824
904
|
|
|
825
905
|
/** Retain only candidates whose exact ID is callable; collect sorted excluded IDs. */
|
package/src/opencode2.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { fileURLToPath } from "url";
|
|
|
5
5
|
import {
|
|
6
6
|
MODELS_API_URL,
|
|
7
7
|
filterCatalogByAvailability,
|
|
8
|
+
modelTransport,
|
|
8
9
|
parseAvailabilityIds,
|
|
9
10
|
toConfigKey,
|
|
10
11
|
loadCatalogFromLocalCommandCode,
|
|
@@ -33,6 +34,12 @@ export const COMMANDCODE_INTEGRATION_ID = "commandcode";
|
|
|
33
34
|
export const COMMANDCODE_PROVIDER_NAME = "Command Code";
|
|
34
35
|
export const COMMANDCODE_BASE_URL = "https://api.commandcode.ai/provider/v1";
|
|
35
36
|
export const COMMANDCODE_PACKAGE = "@opencode/ai/providers/openai-compatible";
|
|
37
|
+
/**
|
|
38
|
+
* Anthropic Messages runtime. Models the gateway serves only on `/messages`
|
|
39
|
+
* cannot go through the OpenAI-compatible runtime, so they carry this package
|
|
40
|
+
* on the model entry and it overrides the provider-wide default.
|
|
41
|
+
*/
|
|
42
|
+
export const COMMANDCODE_ANTHROPIC_PACKAGE = "@opencode/ai/providers/anthropic-compatible";
|
|
36
43
|
export const COMMANDCODE_ENV_NAMES = ["COMMANDCODE_API_KEY"];
|
|
37
44
|
|
|
38
45
|
const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
@@ -57,6 +64,12 @@ export type V2ModelInfo = {
|
|
|
57
64
|
/** Wire id sent to the provider. Lets one upstream model back one entry. */
|
|
58
65
|
modelID: string;
|
|
59
66
|
providerID: string;
|
|
67
|
+
/**
|
|
68
|
+
* Provider runtime for this model. Overrides the provider-wide `package`
|
|
69
|
+
* — Anthropic Messages models are rejected by the OpenAI-compatible
|
|
70
|
+
* runtime, so they carry `@opencode/ai/providers/anthropic-compatible`.
|
|
71
|
+
*/
|
|
72
|
+
package?: string;
|
|
60
73
|
name: string;
|
|
61
74
|
capabilities: { tools: boolean; input: string[]; output: string[] };
|
|
62
75
|
limit: { context: number; output: number };
|
|
@@ -136,6 +149,16 @@ function loadPluginFileConfig(): PluginFileConfig {
|
|
|
136
149
|
}
|
|
137
150
|
}
|
|
138
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Provider runtime for one model: Anthropic Messages models need the
|
|
154
|
+
* anthropic-compatible runtime, everything else the OpenAI-compatible one.
|
|
155
|
+
* The provider-wide `package` stays the OpenAI default and is only a fallback
|
|
156
|
+
* for entries that carry no `package` of their own.
|
|
157
|
+
*/
|
|
158
|
+
export function modelPackage(entry: ModelEntry): string {
|
|
159
|
+
return modelTransport(entry) === "messages" ? COMMANDCODE_ANTHROPIC_PACKAGE : COMMANDCODE_PACKAGE;
|
|
160
|
+
}
|
|
161
|
+
|
|
139
162
|
export function modelEntryToV2(entry: ModelEntry): V2ModelInfo {
|
|
140
163
|
const rawInput = entry.modalities?.input?.filter(
|
|
141
164
|
(m): m is string => typeof m === "string" && m.length > 0,
|
|
@@ -149,6 +172,7 @@ export function modelEntryToV2(entry: ModelEntry): V2ModelInfo {
|
|
|
149
172
|
id: toConfigKey(entry.id),
|
|
150
173
|
modelID: entry.id,
|
|
151
174
|
providerID: COMMANDCODE_PROVIDER_ID,
|
|
175
|
+
package: modelPackage(entry),
|
|
152
176
|
name: entry.name,
|
|
153
177
|
capabilities: { tools: entry.tool_call, input, output: ["text"] },
|
|
154
178
|
limit: { context: entry.limit.context, output: entry.limit.output },
|