* 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>
120 lines
3.6 KiB
TypeScript
120 lines
3.6 KiB
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import { mergeConfigs } from "./plugin-config";
|
|
import type { OhMyOpenCodeConfig } from "./config";
|
|
|
|
describe("mergeConfigs", () => {
|
|
describe("categories merging", () => {
|
|
// #given base config has categories, override has different categories
|
|
// #when merging configs
|
|
// #then should deep merge categories, not override completely
|
|
|
|
it("should deep merge categories from base and override", () => {
|
|
const base = {
|
|
categories: {
|
|
general: {
|
|
model: "openai/gpt-5.2",
|
|
temperature: 0.5,
|
|
},
|
|
quick: {
|
|
model: "anthropic/claude-haiku-4-5",
|
|
},
|
|
},
|
|
} as OhMyOpenCodeConfig;
|
|
|
|
const override = {
|
|
categories: {
|
|
general: {
|
|
temperature: 0.3,
|
|
},
|
|
visual: {
|
|
model: "google/gemini-3-pro",
|
|
},
|
|
},
|
|
} as unknown as OhMyOpenCodeConfig;
|
|
|
|
const result = mergeConfigs(base, override);
|
|
|
|
// #then general.model should be preserved from base
|
|
expect(result.categories?.general?.model).toBe("openai/gpt-5.2");
|
|
// #then general.temperature should be overridden
|
|
expect(result.categories?.general?.temperature).toBe(0.3);
|
|
// #then quick should be preserved from base
|
|
expect(result.categories?.quick?.model).toBe("anthropic/claude-haiku-4-5");
|
|
// #then visual should be added from override
|
|
expect(result.categories?.visual?.model).toBe("google/gemini-3-pro");
|
|
});
|
|
|
|
it("should preserve base categories when override has no categories", () => {
|
|
const base: OhMyOpenCodeConfig = {
|
|
categories: {
|
|
general: {
|
|
model: "openai/gpt-5.2",
|
|
},
|
|
},
|
|
};
|
|
|
|
const override: OhMyOpenCodeConfig = {};
|
|
|
|
const result = mergeConfigs(base, override);
|
|
|
|
expect(result.categories?.general?.model).toBe("openai/gpt-5.2");
|
|
});
|
|
|
|
it("should use override categories when base has no categories", () => {
|
|
const base: OhMyOpenCodeConfig = {};
|
|
|
|
const override: OhMyOpenCodeConfig = {
|
|
categories: {
|
|
general: {
|
|
model: "openai/gpt-5.2",
|
|
},
|
|
},
|
|
};
|
|
|
|
const result = mergeConfigs(base, override);
|
|
|
|
expect(result.categories?.general?.model).toBe("openai/gpt-5.2");
|
|
});
|
|
});
|
|
|
|
describe("existing behavior preservation", () => {
|
|
it("should deep merge agents", () => {
|
|
const base: OhMyOpenCodeConfig = {
|
|
agents: {
|
|
oracle: { model: "openai/gpt-5.2" },
|
|
},
|
|
};
|
|
|
|
const override: OhMyOpenCodeConfig = {
|
|
agents: {
|
|
oracle: { temperature: 0.5 },
|
|
explore: { model: "anthropic/claude-haiku-4-5" },
|
|
},
|
|
};
|
|
|
|
const result = mergeConfigs(base, override);
|
|
|
|
expect(result.agents?.oracle?.model).toBe("openai/gpt-5.2");
|
|
expect(result.agents?.oracle?.temperature).toBe(0.5);
|
|
expect(result.agents?.explore?.model).toBe("anthropic/claude-haiku-4-5");
|
|
});
|
|
|
|
it("should merge disabled arrays without duplicates", () => {
|
|
const base: OhMyOpenCodeConfig = {
|
|
disabled_hooks: ["comment-checker", "think-mode"],
|
|
};
|
|
|
|
const override: OhMyOpenCodeConfig = {
|
|
disabled_hooks: ["think-mode", "session-recovery"],
|
|
};
|
|
|
|
const result = mergeConfigs(base, override);
|
|
|
|
expect(result.disabled_hooks).toContain("comment-checker");
|
|
expect(result.disabled_hooks).toContain("think-mode");
|
|
expect(result.disabled_hooks).toContain("session-recovery");
|
|
expect(result.disabled_hooks?.length).toBe(3);
|
|
});
|
|
});
|
|
});
|