fix(opencode): list current Zen models in offline discovery (#103197)

* fix(opencode): refresh Zen model catalog

* fix(opencode): expose static catalog fallback
This commit is contained in:
Peter Steinberger
2026-07-10 02:44:56 +01:00
committed by GitHub
parent 10b50843e7
commit 25e93ef9f9
5 changed files with 150 additions and 13 deletions

View File

@@ -71,12 +71,15 @@ async function fetchOpencodeZenModelIds(): Promise<string[]> {
});
expect(response.ok).toBe(true);
const json = (await response.json()) as OpencodeModelsResponse;
return (json.data ?? [])
expect(Array.isArray(json.data)).toBe(true);
const modelIds = (json.data ?? [])
.filter((model) => model.object === undefined || model.object === "model")
.map((model) => model.id)
.filter((id): id is string => typeof id === "string" && id.trim().length > 0)
.map((id) => id.trim().toLowerCase())
.toSorted();
expect(new Set(modelIds).size).toBe(modelIds.length);
return modelIds;
}
function listStaticOpencodeZenModelIds(): string[] {
@@ -89,6 +92,7 @@ describeCatalogLive("opencode Zen live catalog drift", () => {
it("keeps the provider-owned static seed aligned with the live model ids", async () => {
const liveIds = await fetchOpencodeZenModelIds();
const staticIds = listStaticOpencodeZenModelIds();
expect(new Set(staticIds).size).toBe(staticIds.length);
const staticIdSet = new Set(staticIds);
const liveIdSet = new Set(liveIds);