Files
oh-my-opencode/src/plugin-handlers/config-handler.test.ts
T
YeonGyu-Kim 8af6774ae8 fix(models): update model names to match OpenCode Zen catalog (#1048)
* fix(models): update model names to match OpenCode Zen catalog

OpenCode Zen recently updated their official model catalog, deprecating
several preview and free model variants:

DEPRECATED → NEW (Official Zen Names):
- gemini-3-pro-preview → gemini-3-pro
- gemini-3-flash-preview → gemini-3-flash
- grok-code → gpt-5-nano (FREE tier maintained)
- glm-4.7-free → big-pickle (FREE tier maintained)
- glm-4.6v → glm-4.6

Changes:
- Updated 6 source files (model-requirements, delegate-task, think-mode, etc.)
- Updated 9 documentation files (installation, configurations, features, etc.)
- Updated 14 test files with new model references
- Regenerated snapshots to reflect catalog changes
- Removed duplicate think-mode entries for preview variants

Impact:
- FREE tier access preserved via gpt-5-nano and big-pickle
- All 55 model-related tests passing
- Zero breaking changes - pure string replacement
- Aligns codebase with official OpenCode Zen model catalog

Verified:
- Zero deprecated model names in codebase
- All model-related tests pass (55/55)
- Snapshots regenerated and validated

Affects: 30 files (6 source, 9 docs, 14 tests, 1 snapshot)

* fix(multimodal-looker): update fallback chain with glm-4.6v and gpt-5-nano

- Change glm-4.6 to glm-4.6v for zai-coding-plan provider
- Add opencode/gpt-5-nano as 4th fallback (FREE tier)
- Push gpt-5.2 to 5th position

Fallback chain now:
1. gemini-3-flash (google, github-copilot, opencode)
2. claude-haiku-4-5 (anthropic, github-copilot, opencode)
3. glm-4.6v (zai-coding-plan)
4. gpt-5-nano (opencode) - FREE
5. gpt-5.2 (openai, github-copilot, opencode)

* chore: update bun.lock

---------

Co-authored-by: justsisyphus <justsisyphus@users.noreply.github.com>
2026-01-24 15:30:35 +09:00

104 lines
2.9 KiB
TypeScript

import { describe, test, expect } from "bun:test"
import { resolveCategoryConfig } from "./config-handler"
import type { CategoryConfig } from "../config/schema"
describe("Prometheus category config resolution", () => {
test("resolves ultrabrain category config", () => {
// #given
const categoryName = "ultrabrain"
// #when
const config = resolveCategoryConfig(categoryName)
// #then
expect(config).toBeDefined()
expect(config?.model).toBe("openai/gpt-5.2-codex")
expect(config?.variant).toBe("xhigh")
})
test("resolves visual-engineering category config", () => {
// #given
const categoryName = "visual-engineering"
// #when
const config = resolveCategoryConfig(categoryName)
// #then
expect(config).toBeDefined()
expect(config?.model).toBe("google/gemini-3-pro")
})
test("user categories override default categories", () => {
// #given
const categoryName = "ultrabrain"
const userCategories: Record<string, CategoryConfig> = {
ultrabrain: {
model: "google/antigravity-claude-opus-4-5-thinking",
temperature: 0.1,
},
}
// #when
const config = resolveCategoryConfig(categoryName, userCategories)
// #then
expect(config).toBeDefined()
expect(config?.model).toBe("google/antigravity-claude-opus-4-5-thinking")
expect(config?.temperature).toBe(0.1)
})
test("returns undefined for unknown category", () => {
// #given
const categoryName = "nonexistent-category"
// #when
const config = resolveCategoryConfig(categoryName)
// #then
expect(config).toBeUndefined()
})
test("falls back to default when user category has no entry", () => {
// #given
const categoryName = "ultrabrain"
const userCategories: Record<string, CategoryConfig> = {
"visual-engineering": {
model: "custom/visual-model",
},
}
// #when
const config = resolveCategoryConfig(categoryName, userCategories)
// #then - falls back to DEFAULT_CATEGORIES
expect(config).toBeDefined()
expect(config?.model).toBe("openai/gpt-5.2-codex")
expect(config?.variant).toBe("xhigh")
})
test("preserves all category properties (temperature, top_p, tools, etc.)", () => {
// #given
const categoryName = "custom-category"
const userCategories: Record<string, CategoryConfig> = {
"custom-category": {
model: "test/model",
temperature: 0.5,
top_p: 0.9,
maxTokens: 32000,
tools: { tool1: true, tool2: false },
},
}
// #when
const config = resolveCategoryConfig(categoryName, userCategories)
// #then
expect(config).toBeDefined()
expect(config?.model).toBe("test/model")
expect(config?.temperature).toBe(0.5)
expect(config?.top_p).toBe(0.9)
expect(config?.maxTokens).toBe(32000)
expect(config?.tools).toEqual({ tool1: true, tool2: false })
})
})