@darthph0enix/commandcode-go-opencode-provider 0.5.0 → 0.5.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/package.json +1 -1
- package/src/model-sync.ts +29 -12
package/package.json
CHANGED
package/src/model-sync.ts
CHANGED
|
@@ -266,7 +266,7 @@ async function fetchApiModels(): Promise<ApiModel[] | null> {
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
function mergeApiModels(entries: ModelEntry[], api: ApiModel[]): ModelEntry[] {
|
|
269
|
+
function mergeApiModels(entries: ModelEntry[], api: ApiModel[], hints?: Map<string, ModelEntry>): ModelEntry[] {
|
|
270
270
|
const seen = new Map(entries.map((entry) => [entry.id.toLowerCase(), entry]))
|
|
271
271
|
for (const model of api) {
|
|
272
272
|
if (!model?.id) continue
|
|
@@ -278,15 +278,32 @@ function mergeApiModels(entries: ModelEntry[], api: ApiModel[]): ModelEntry[] {
|
|
|
278
278
|
}
|
|
279
279
|
continue
|
|
280
280
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
281
|
+
// Prefer the bundled snapshot's metadata (plan badge, variants, vision) so
|
|
282
|
+
// machines without the CLI catalog still get full capabilities.
|
|
283
|
+
const hint = hints?.get(key)
|
|
284
|
+
const entry: ModelEntry = hint
|
|
285
|
+
? {
|
|
286
|
+
...hint,
|
|
287
|
+
modalities: hint.modalities ? { input: [...hint.modalities.input], output: [...hint.modalities.output] } : undefined,
|
|
288
|
+
variants: hint.variants ? { ...hint.variants } : undefined,
|
|
289
|
+
reasoningEfforts: hint.reasoningEfforts ? [...hint.reasoningEfforts] : undefined,
|
|
290
|
+
limit: {
|
|
291
|
+
context:
|
|
292
|
+
model.context_length && model.context_length > 0
|
|
293
|
+
? model.context_length
|
|
294
|
+
: hint.limit.context,
|
|
295
|
+
output: hint.limit.output,
|
|
296
|
+
},
|
|
297
|
+
}
|
|
298
|
+
: {
|
|
299
|
+
id: model.id,
|
|
300
|
+
name: model.name?.trim() || model.id.split("/").pop() || model.id,
|
|
301
|
+
tier: "open-source",
|
|
302
|
+
reasoning: true,
|
|
303
|
+
tool_call: true,
|
|
304
|
+
cost: { input: 0, output: 0 },
|
|
305
|
+
limit: { context: model.context_length && model.context_length > 0 ? model.context_length : 200000, output: 65536 },
|
|
306
|
+
}
|
|
290
307
|
entries.push(entry)
|
|
291
308
|
seen.set(key, entry)
|
|
292
309
|
}
|
|
@@ -319,10 +336,10 @@ export async function loadSyncedModels(): Promise<SyncResult> {
|
|
|
319
336
|
let models: ModelEntry[] | null = null
|
|
320
337
|
let source = ""
|
|
321
338
|
if (docModels?.length) {
|
|
322
|
-
models = mergeApiModels(docModels, apiModels ?? [])
|
|
339
|
+
models = mergeApiModels(docModels, apiModels ?? [], hints)
|
|
323
340
|
source = apiModels?.length ? "cli-catalog+api" : "cli-catalog"
|
|
324
341
|
} else if (apiModels?.length) {
|
|
325
|
-
models = mergeApiModels([], apiModels)
|
|
342
|
+
models = mergeApiModels([], apiModels, hints)
|
|
326
343
|
source = "api"
|
|
327
344
|
}
|
|
328
345
|
|