Restore first-class OMO Slim council support (#1981) (#1982)

cc-switch could already persist arbitrary OMO Slim agent keys and top-level fields, but the built-in metadata and UI copy still reflected the pre-council agent set. This made the upstream council feature look unsupported and pushed users toward manual JSON-only setup.

Promote council to a built-in OMO Slim agent, add copy that points top-level plugin settings at Other Fields, and lock the behavior with regression tests.

Constraint: oh-my-opencode-slim exposes council through both agents.council and top-level council config
Rejected: Add a dedicated council editor UI now | too much surface area for issue #1981
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep OMO Slim built-in agent metadata aligned with upstream agent additions before shipping UI support
Tested: pnpm exec vitest run tests/utils/omoConfig.test.ts tests/components/OmoFormFields.mergeCustomModelsIntoStore.test.ts
Tested: pnpm typecheck
Not-tested: End-to-end validation against a live oh-my-opencode-slim installation
Related: farion1231/cc-switch#1981
This commit is contained in:
Dex Miller
2026-04-10 22:36:32 +08:00
committed by GitHub
parent e4b58c7206
commit 3aef5217cb
6 changed files with 78 additions and 12 deletions
+38
View File
@@ -1,6 +1,9 @@
import { describe, expect, it } from "vitest";
import {
buildOmoProfilePreview,
buildOmoSlimProfilePreview,
OMO_SLIM_BUILTIN_AGENTS,
OMO_SLIM_DISABLEABLE_AGENTS,
parseOmoOtherFieldsObject,
} from "@/types/omo";
@@ -28,3 +31,38 @@ describe("buildOmoProfilePreview", () => {
expect(fromObject).toEqual({ foo: "bar" });
});
});
describe("buildOmoSlimProfilePreview", () => {
it("保留 top-level council 配置,同时写入 council agent 模型", () => {
const preview = buildOmoSlimProfilePreview(
{
council: { model: "openai/gpt-5.4-mini" },
},
'{ "council": { "default_preset": "default" }, "fallback": { "enabled": true } }',
);
expect(preview).toEqual({
council: { default_preset: "default" },
fallback: { enabled: true },
agents: {
council: { model: "openai/gpt-5.4-mini" },
},
});
});
});
describe("OMO Slim metadata", () => {
it("将 council 视为内置且可禁用的 agent", () => {
expect(OMO_SLIM_BUILTIN_AGENTS).toContainEqual(
expect.objectContaining({
key: "council",
display: "Council",
group: "sub",
}),
);
expect(OMO_SLIM_DISABLEABLE_AGENTS).toContainEqual({
value: "council",
label: "Council",
});
});
});