feat(codex): support native Responses direct-connect with generated model catalog

Codex providers can now run in two modes per provider:

- Proxy-Chat (route takeover): apiFormat=openai_chat, existing Responses<->Chat conversion. Unchanged.

- Native-Responses (direct): apiFormat=openai_responses, no proxy. cc-switch generates ~/.codex/cc-switch-model-catalog.json so Codex shows the custom models and tools work without the freeform apply_patch (type=custom) tool that native gateways like MiMo reject; editing falls back to shell_command.

Catalog generation is keyed on apiFormat (CodexCatalogToolProfile), decoupled from the takeover toggle, so native providers persist a catalog without enabling local route mapping.

Codex's catalog parser requires base_instructions on every entry; the native template carries a neutral default and per-vendor official text overrides it (MiMo, MiniMax). Synthesized catalogs for Qwen/Doubao/LongCat use the neutral default.

Existing native providers must be re-saved once to regenerate a valid catalog (no DB migration).
This commit is contained in:
Jason
2026-06-27 23:12:30 +08:00
parent 61d7ac01fb
commit 15e712e779
11 changed files with 692 additions and 154 deletions
+9
View File
@@ -258,6 +258,15 @@ export interface CodexCatalogModel {
model: string;
displayName?: string;
contextWindow?: string | number;
// Native Responses (direct) profile overrides for the generated
// model-catalogs.json. Ignored by the chat/proxy profile.
// e.g. MiniMax: supportsParallelToolCalls=true, inputModalities=["text","image"].
supportsParallelToolCalls?: boolean;
inputModalities?: string[];
// Vendor's OFFICIAL base_instructions (model identity / system preamble).
// Codex requires this field in every catalog entry; when omitted the backend
// falls back to a neutral default. e.g. MiMo "developed by Xiaomi".
baseInstructions?: string;
}
// Claude 认证字段类型