Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
同步公开模型目录与兼容配置
YToolbox473c5283e04d
diff --git a/src/main/features/client_config.ts b/src/main/features/client_config.tsindex 228ce264..963211e7 100644--- a/src/main/features/client_config.ts+++ b/src/main/features/client_config.ts@@ -13,6 +13,9 @@ import { createLogger } from '../logger';import { fetchWithRetry } from '../util/retry';import { desktopPlatform } from '../system_info';import { withCommonHeaders } from './api_common';+import { PUBLIC_PROVIDER_MODELS, type ProviderModelEntry } from '../model/public_model_catalog';++export type { ProviderModelEntry } from '../model/public_model_catalog';export type ClientConfigEffect = 'immediate' | 'restart';@@ -495,11 +498,6 @@ export function stop(): void {runtimePowerMonitor = null;}-export interface ProviderModelEntry {- id: string;- name: string;-}-export interface ImageGenCapability {model: string;api: 'openai' | 'gemini' | 'doubao';@@ -530,88 +528,7 @@ interface ModelCatalogConfig {const VALID_IMAGE_APIS = new Set(['openai', 'gemini', 'doubao']);-export const DEFAULT_PROVIDER_MODELS: Readonly<Record<string, readonly ProviderModelEntry[]>> = {- anthropic: [- { id: 'claude-opus-4-8', name: 'Claude Opus 4.8' },- { id: 'claude-opus-4-7', name: 'Claude Opus 4.7' },- ],- 'openai-codex': [- { id: 'gpt-5.5', name: 'GPT-5.5' },- { id: 'gpt-5.4', name: 'GPT-5.4' },- ],- openai: [- { id: 'gpt-5.5', name: 'GPT-5.5' },- { id: 'gpt-5.5-pro', name: 'GPT-5.5 Pro' },- { id: 'gpt-5.4', name: 'GPT-5.4' },- { id: 'gpt-5.4-pro', name: 'GPT-5.4 Pro' },- { id: 'gpt-5.4-mini', name: 'GPT-5.4 Mini' },- ],- google: [- { id: 'gemini-3.1-pro-preview', name: 'Gemini 3.1 Pro (preview)' },- { id: 'gemini-3.1-flash-lite-preview', name: 'Gemini 3.1 Flash Lite (preview)' },- { id: 'gemini-3-pro-preview', name: 'Gemini 3 Pro (preview)' },- { id: 'gemini-3-flash-preview', name: 'Gemini 3 Flash (preview)' },- ],- zai: [- { id: 'glm-5.1', name: 'GLM-5.1' },- { id: 'glm-5', name: 'GLM-5' },- { id: 'glm-5-turbo', name: 'GLM-5 Turbo' },- { id: 'glm-5v-turbo', name: 'GLM-5V Turbo' },- ],- moonshot: [- { id: 'kimi-k2.6', name: 'Kimi K2.6' },- { id: 'kimi-k2.5', name: 'Kimi K2.5' },- ],- 'kimi-coding': [- { id: 'k2p6', name: 'Kimi K2.6' },- { id: 'kimi-for-coding', name: 'Kimi For Coding' },- ],- 'minimax-cn': [- { id: 'MiniMax-M3', name: 'MiniMax 3' },- { id: 'MiniMax-M2.7', name: 'MiniMax 2.7' },- { id: 'MiniMax-M2.7-highspeed', name: 'MiniMax 2.7 Highspeed' },- ],- 'minimax-portal': [- { id: 'MiniMax-M3', name: 'MiniMax 3' },- { id: 'MiniMax-M2.7', name: 'MiniMax 2.7' },- { id: 'MiniMax-M2.7-highspeed', name: 'MiniMax 2.7 Highspeed' },- ],- 'minimax-portal-cn': [- { id: 'MiniMax-M3', name: 'MiniMax 3' },- { id: 'MiniMax-M2.7', name: 'MiniMax 2.7' },- { id: 'MiniMax-M2.7-highspeed', name: 'MiniMax 2.7 Highspeed' },- ],- deepseek: [- { id: 'deepseek-v4-pro', name: 'DeepSeek V4 Pro' },- { id: 'deepseek-v4-flash', name: 'DeepSeek V4 Flash' },- ],- doubao: [- { id: 'doubao-seed-2-0-pro-260215', name: 'Doubao Seed 2.0 Pro' },- { id: 'doubao-seed-2-0-lite-260215', name: 'Doubao Seed 2.0 Lite' },- ],- openrouter: [- { id: 'anthropic/claude-opus-4.8', name: 'Claude Opus 4.8' },- { id: 'anthropic/claude-opus-4.7', name: 'Claude Opus 4.7' },- { id: 'openai/gpt-5.5', name: 'GPT-5.5' },- { id: 'openai/gpt-5.5-pro', name: 'GPT-5.5 Pro' },- { id: 'openai/gpt-5.4', name: 'GPT-5.4' },- { id: 'openai/gpt-5.4-pro', name: 'GPT-5.4 Pro' },- { id: 'google/gemini-3.1-pro-preview', name: 'Gemini 3.1 Pro (preview)' },- { id: 'google/gemini-3-pro-preview', name: 'Gemini 3 Pro (preview)' },- { id: 'deepseek/deepseek-v4-pro', name: 'DeepSeek V4 Pro' },- { id: 'deepseek/deepseek-v4-flash', name: 'DeepSeek V4 Flash' },- { id: 'moonshotai/kimi-k2.6', name: 'Kimi K2.6' },- { id: 'moonshotai/kimi-k2.5', name: 'Kimi K2.5' },- { id: 'qwen/qwen3-max', name: 'Qwen3 Max' },- { id: 'qwen/qwen3-coder', name: 'Qwen3 Coder' },- { id: 'z-ai/glm-5.1', name: 'GLM-5.1' },- { id: 'z-ai/glm-5', name: 'GLM-5' },- { id: 'minimax/minimax-m3', name: 'MiniMax 3' },- { id: 'minimax/minimax-m2.7', name: 'MiniMax 2.7' },- { id: 'xiaomi/mimo-v2.5-pro', name: 'Xiaomi MiMo V2.5 Pro' },- { id: 'xiaomi/mimo-v2.5', name: 'Xiaomi MiMo V2.5' },- ],-};+export const DEFAULT_PROVIDER_MODELS = PUBLIC_PROVIDER_MODELS;export const DEFAULT_IMAGE_GEN_BY_PROVIDER: Readonly<Record<string, ImageGenCapability>> = {openai: { model: 'gpt-image-2', api: 'openai', supportsEdit: true },@@ -632,11 +549,26 @@ function normalizeProviderModels(value: unknown): ProviderModelEntry[] | null {const id = typeof r.id === 'string' ? r.id.trim() : '';if (!id) continue;const name = typeof r.name === 'string' && r.name.trim() ? r.name.trim() : id;- out.push({ id, name });+ const template = typeof r.template === 'string' && r.template.trim() ? r.template.trim() : undefined;+ const contextWindow = normalizePositiveInteger(r.contextWindow);+ const maxTokens = normalizePositiveInteger(r.maxTokens);+ out.push({+ id,+ name,+ ...(template ? { template } : {}),+ ...(contextWindow ? { contextWindow } : {}),+ ...(maxTokens ? { maxTokens } : {}),+ });}return out;}+function normalizePositiveInteger(value: unknown): number | undefined {+ if (typeof value !== 'number' || !Number.isFinite(value)) return undefined;+ const n = Math.floor(value);+ return n > 0 ? n : undefined;+}+function normalizeImageGenCapability(value: unknown): ImageGenCapability | null {if (!value || typeof value !== 'object') return null;const r = value as Record<string, unknown>;@@ -787,7 +719,7 @@ export function getConfiguredProviderModels(providerId: string): { models: Proviif (!id) return null;const cfg = loadModelCatalog();if (!Object.prototype.hasOwnProperty.call(cfg.providers, id)) return null;- return { models: cfg.providers[id].map((m) => ({ id: m.id, name: m.name })) };+ return { models: cfg.providers[id].map((m) => ({ ...m })) };}export function getConfiguredImageGenCapability(providerId: string): ImageGenCapabilityOverride | null {diff --git a/src/main/model/core-agent/external-providers.ts b/src/main/model/core-agent/external-providers.tsindex 8725e8a8..7e97580a 100644--- a/src/main/model/core-agent/external-providers.ts+++ b/src/main/model/core-agent/external-providers.ts@@ -50,18 +50,26 @@ function ca(): Promise<CA> {return _caPromise;}+function configuredPositiveInteger(value: number | undefined, fallback: number): number {+ return typeof value === 'number' && Number.isInteger(value) && value > 0+ ? value+ : fallback;+}+// ── Moonshot open-platform (https://api.moonshot.cn/v1) ─────────────────const MOONSHOT_BASE_URL = 'https://api.moonshot.cn/v1';/*** Context windows by Moonshot model id. Numbers come from- * platform.kimi.com/docs/models (checked 2026-04). Fallback 131072 for+ * platform.kimi.com/docs/models (checked 2026-06). Fallback 131072 for* ids we haven't catalogued — safe lower bound given every current kimi- * model is at least 128k. Catalog only ships K2.5 / K2.6; legacy K2 preview- * ids still resolve via fallback if a stale credential references them.+ * model is at least 128k. Legacy ids still resolve via fallback if a stale+ * credential references them.*/const MOONSHOT_CONTEXT_WINDOW: Record<string, number> = {+ 'kimi-k3': 1048576,+ 'kimi-k2.7-code': 262144,'kimi-k2.6': 262144,'kimi-k2.5': 262144,};@@ -76,9 +84,11 @@ function moonshotContextWindow(modelId: string): number {// value caps every model at the lowest common denominator and complex// structured replies get cut mid-stream with `stopReason: "length"` while// the renderer just shows whatever streamed before the cap. Numbers from-// platform.kimi.com/docs/models (2026-04). Unknown ids fall back to 8192+// platform.kimi.com/docs/models (2026-06). Unknown ids fall back to 8192// to stay safe against providers that 400 on over-cap requests.const MOONSHOT_MAX_OUTPUT_TOKENS: Record<string, number> = {+ 'kimi-k3': 131072,+ 'kimi-k2.7-code': 32768,'kimi-k2.6': 16384,'kimi-k2.5': 16384,};@@ -87,14 +97,39 @@ function moonshotMaxOutputTokens(modelId: string): number {return MOONSHOT_MAX_OUTPUT_TOKENS[modelId] ?? 8192;}+const MOONSHOT_K3_PROTOCOL_FALLBACK: Pick<+ Model<'openai-completions'>,+ 'reasoning' | 'thinkingLevelMap' | 'input' | 'compat'+> = {+ reasoning: true,+ thinkingLevelMap: {+ off: null,+ minimal: null,+ low: null,+ medium: null,+ high: null,+ xhigh: null,+ },+ input: ['text', 'image'],+ compat: {+ supportsStore: false,+ supportsDeveloperRole: false,+ supportsReasoningEffort: false,+ maxTokensField: 'max_tokens',+ supportsStrictMode: false,+ thinkingFormat: 'deepseek',+ requiresReasoningContentOnAssistantMessages: true,+ },+};+/*** Build a `Model<"openai-completions">` object for a Moonshot model.* Exported for tests — production code usually goes through* `createMoonshotProvider()`.*/export function buildMoonshotModel(modelId: string): Model<'openai-completions'> {- // `name` defaults to the curated label if we have one; otherwise the id.const curated = curatedModelsFor('moonshot').find((m) => m.id === modelId);+ const protocol = modelId === 'kimi-k3' ? MOONSHOT_K3_PROTOCOL_FALLBACK : null;return {id: modelId,name: curated?.name || modelId,@@ -103,15 +138,17 @@ export function buildMoonshotModel(modelId: string): Model<'openai-completions'>// so using a custom id here is supported.provider: 'moonshot' as any,baseUrl: MOONSHOT_BASE_URL,- reasoning: false,- input: ['text', 'image'],+ reasoning: protocol?.reasoning ?? false,+ ...(protocol?.thinkingLevelMap ? { thinkingLevelMap: { ...protocol.thinkingLevelMap } } : {}),+ input: protocol ? [...protocol.input] : ['text', 'image'],// The Moonshot open platform bills per token, but pi-ai's `cost`// field is only used for local cost-statistics display and does not// affect the actual request. Filling 0 means "not accounted for here";// users check the actual price on their Moonshot bill.cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },- contextWindow: moonshotContextWindow(modelId),- maxTokens: moonshotMaxOutputTokens(modelId),+ contextWindow: configuredPositiveInteger(curated?.contextWindow, moonshotContextWindow(modelId)),+ maxTokens: configuredPositiveInteger(curated?.maxTokens, moonshotMaxOutputTokens(modelId)),+ ...(protocol?.compat ? { compat: { ...protocol.compat } } : {}),};}@@ -268,6 +305,7 @@ const DOUBAO_BASE_URL = 'https://ark.cn-beijing.volces.com/api/v3';const DOUBAO_CONTEXT_WINDOW: Record<string, number> = {'doubao-seed-2-0-pro-260215': 262144,'doubao-seed-2-0-lite-260215': 262144,+ 'doubao-seed-2-0-lite-260428': 262144,};function doubaoContextWindow(modelId: string): number {@@ -280,6 +318,7 @@ function doubaoContextWindow(modelId: string): number {const DOUBAO_MAX_OUTPUT_TOKENS: Record<string, number> = {'doubao-seed-2-0-pro-260215': 16384,'doubao-seed-2-0-lite-260215': 16384,+ 'doubao-seed-2-0-lite-260428': 32768,};function doubaoMaxOutputTokens(modelId: string): number {@@ -306,8 +345,8 @@ export function buildDoubaoModel(modelId: string): Model<'openai-completions'> {compat: { supportsDeveloperRole: false },input: ['text', 'image'],cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },- contextWindow: doubaoContextWindow(modelId),- maxTokens: doubaoMaxOutputTokens(modelId),+ contextWindow: configuredPositiveInteger(curated?.contextWindow, doubaoContextWindow(modelId)),+ maxTokens: configuredPositiveInteger(curated?.maxTokens, doubaoMaxOutputTokens(modelId)),};}diff --git a/src/main/model/provider_catalog.ts b/src/main/model/provider_catalog.tsindex 755687cb..4d23238b 100644--- a/src/main/model/provider_catalog.ts+++ b/src/main/model/provider_catalog.ts@@ -35,6 +35,7 @@ import {DEFAULT_IMAGE_GEN_BY_PROVIDER,DEFAULT_PROVIDER_MODELS,type ImageGenCapability as ConfigImageGenCapability,+ type ProviderModelEntry,getConfiguredImageGenCapability,getConfiguredProviderModels,} from '../features/client_config';@@ -120,11 +121,11 @@ export const CATALOG: readonly CatalogEntry[] = [export const CURATED_MODELS = DEFAULT_PROVIDER_MODELS;-export function curatedModelsFor(providerId: string): { id: string; name: string }[] {+export function curatedModelsFor(providerId: string): ProviderModelEntry[] {const configured = getConfiguredProviderModels(providerId);if (configured) return configured.models;const list = CURATED_MODELS[providerId];- return list ? list.map((m) => ({ id: m.id, name: m.name })) : [];+ return list ? list.map((m) => ({ ...m })) : [];}/**@@ -163,8 +164,13 @@ function safeGetPiModel(}}-function cloneModelWithId(template: Model<Api>, id: string, name: string): Model<Api> {- return {+function cloneModelWithId(+ template: Model<Api>,+ id: string,+ name: string,+ overrides?: Pick<ProviderModelEntry, 'contextWindow' | 'maxTokens'>,+): Model<Api> {+ const cloned = {...template,id,name,@@ -173,6 +179,28 @@ function cloneModelWithId(template: Model<Api>, id: string, name: string): Model...(template.headers ? { headers: { ...template.headers } } : {}),...(template.thinkingLevelMap ? { thinkingLevelMap: { ...template.thinkingLevelMap } } : {}),};+ return applyConfiguredModelOverrides(cloned, overrides);+}++function hasConfiguredModelOverrides(configured: ProviderModelEntry | undefined): boolean {+ return !!configured+ && (typeof configured.contextWindow === 'number' || typeof configured.maxTokens === 'number');+}++function applyConfiguredModelOverrides(+ model: Model<Api>,+ overrides?: Pick<ProviderModelEntry, 'contextWindow' | 'maxTokens'>,+): Model<Api> {+ if (!overrides) return model;+ return {+ ...model,+ ...(typeof overrides.contextWindow === 'number' && overrides.contextWindow > 0+ ? { contextWindow: overrides.contextWindow }+ : {}),+ ...(typeof overrides.maxTokens === 'number' && overrides.maxTokens > 0+ ? { maxTokens: overrides.maxTokens }+ : {}),+ };}function modelFamilyKey(modelId: string): string {@@ -205,23 +233,38 @@ export function resolveConfiguredPiModel(if (!requestedProviderId || !requestedModelId) return null;const catalogProviderId = PI_MODEL_PROVIDER_ALIAS[requestedProviderId] || requestedProviderId;+ const configuredModels = curatedModelsFor(requestedProviderId);+ const configured = configuredModels.find((m) => m.id === requestedModelId);const exact = safeGetPiModel(catalog, catalogProviderId, requestedModelId);if (exact) {return {- model: exact,+ model: applyConfiguredModelOverrides(exact, configured),requestedProviderId,requestedModelId,catalogProviderId,templateModelId: requestedModelId,isConfiguredFallback: false,- needsCustomModel: catalogProviderId !== requestedProviderId,+ needsCustomModel: catalogProviderId !== requestedProviderId || hasConfiguredModelOverrides(configured),};}- const configuredModels = curatedModelsFor(requestedProviderId);- const configured = configuredModels.find((m) => m.id === requestedModelId);if (!configured) return null;+ if (configured.template) {+ const template = safeGetPiModel(catalog, catalogProviderId, configured.template);+ if (template) {+ return {+ model: cloneModelWithId(template, requestedModelId, configured.name || requestedModelId, configured),+ requestedProviderId,+ requestedModelId,+ catalogProviderId,+ templateModelId: configured.template,+ isConfiguredFallback: true,+ needsCustomModel: true,+ };+ }+ }+const requestedFamily = modelFamilyKey(requestedModelId);const candidates = configuredModels.filter((m) => m.id !== requestedModelId)@@ -231,7 +274,7 @@ export function resolveConfiguredPiModel(const template = safeGetPiModel(catalog, catalogProviderId, candidate.id);if (!template) continue;return {- model: cloneModelWithId(template, requestedModelId, configured.name || requestedModelId),+ model: cloneModelWithId(template, requestedModelId, configured.name || requestedModelId, configured),requestedProviderId,requestedModelId,catalogProviderId,diff --git a/src/main/model/public_model_catalog.ts b/src/main/model/public_model_catalog.tsnew file mode 100644index 00000000..71b808a9--- /dev/null+++ b/src/main/model/public_model_catalog.ts@@ -0,0 +1,94 @@+/**+ * Public, provider-neutral model catalog shared by Orkas and the open-source+ * build. Keep provider execution, authentication, routing, and managed Orkas+ * entries out of this file so it can be mirrored byte-for-byte.+ */++export interface ProviderModelEntry {+ id: string;+ name: string;+ /** Bundled model metadata to clone when this advertised id is newer than+ * the model runtime shipped by a client. The request still uses `id`. */+ template?: string;+ contextWindow?: number;+ maxTokens?: number;+}++export const PUBLIC_PROVIDER_MODELS: Readonly<Record<string, readonly ProviderModelEntry[]>> = {+ anthropic: [+ { id: 'claude-opus-4-8', name: 'Claude Opus 4.8' },+ { id: 'claude-opus-4-7', name: 'Claude Opus 4.7' },+ ],+ 'openai-codex': [+ { id: 'gpt-5.6-sol', name: 'GPT-5.6 Sol', template: 'gpt-5.5', contextWindow: 372000, maxTokens: 128000 },+ { id: 'gpt-5.6-terra', name: 'GPT-5.6 Terra', template: 'gpt-5.5', contextWindow: 372000, maxTokens: 128000 },+ { id: 'gpt-5.6-luna', name: 'GPT-5.6 Luna', template: 'gpt-5.5', contextWindow: 272000, maxTokens: 128000 },+ { id: 'gpt-5.5', name: 'GPT-5.5' },+ ],+ openai: [+ { id: 'gpt-5.6-sol', name: 'GPT-5.6 Sol', template: 'gpt-5.5', contextWindow: 272000, maxTokens: 128000 },+ { id: 'gpt-5.6-terra', name: 'GPT-5.6 Terra', template: 'gpt-5.5', contextWindow: 272000, maxTokens: 128000 },+ { id: 'gpt-5.6-luna', name: 'GPT-5.6 Luna', template: 'gpt-5.5', contextWindow: 272000, maxTokens: 128000 },+ { id: 'gpt-5.5', name: 'GPT-5.5' },+ ],+ google: [+ { id: 'gemini-3.5-flash', name: 'Gemini 3.5 Flash' },+ { id: 'gemini-3.1-pro-preview', name: 'Gemini 3.1 Pro (preview)' },+ { id: 'gemini-3.1-flash-lite', name: 'Gemini 3.1 Flash Lite' },+ ],+ zai: [+ { id: 'glm-5.2', name: 'GLM-5.2' },+ { id: 'glm-5.1', name: 'GLM-5.1' },+ ],+ moonshot: [+ { id: 'kimi-k3', name: 'Kimi K3', contextWindow: 1048576, maxTokens: 131072 },+ { id: 'kimi-k2.7-code', name: 'Kimi K2.7 Code' },+ ],+ 'kimi-coding': [+ { id: 'k3', name: 'Kimi K3', template: 'kimi-for-coding', contextWindow: 1048576, maxTokens: 131072 },+ { id: 'k2p7', name: 'Kimi K2.7 Code' },+ ],+ 'minimax-cn': [+ { id: 'MiniMax-M3', name: 'MiniMax 3' },+ { id: 'MiniMax-M2.7', name: 'MiniMax 2.7' },+ ],+ 'minimax-portal': [+ { id: 'MiniMax-M3', name: 'MiniMax 3' },+ { id: 'MiniMax-M2.7', name: 'MiniMax 2.7' },+ ],+ 'minimax-portal-cn': [+ { id: 'MiniMax-M3', name: 'MiniMax 3' },+ { id: 'MiniMax-M2.7', name: 'MiniMax 2.7' },+ ],+ deepseek: [+ { id: 'deepseek-v4-pro', name: 'DeepSeek V4 Pro' },+ { id: 'deepseek-v4-flash', name: 'DeepSeek V4 Flash' },+ ],+ doubao: [+ { id: 'doubao-seed-2-0-pro-260215', name: 'Doubao Seed 2.0 Pro' },+ { id: 'doubao-seed-2-0-lite-260428', name: 'Doubao Seed 2.0 Lite' },+ ],+ openrouter: [+ { id: 'anthropic/claude-opus-4.8', name: 'Claude Opus 4.8' },+ { id: 'anthropic/claude-opus-4.7', name: 'Claude Opus 4.7' },+ { id: 'openai/gpt-5.6-sol', name: 'GPT-5.6 Sol', template: 'openai/gpt-5.5' },+ { id: 'openai/gpt-5.6-terra', name: 'GPT-5.6 Terra', template: 'openai/gpt-5.5' },+ { id: 'openai/gpt-5.6-luna', name: 'GPT-5.6 Luna', template: 'openai/gpt-5.5' },+ { id: 'openai/gpt-5.5', name: 'GPT-5.5' },+ { id: 'google/gemini-3.5-flash', name: 'Gemini 3.5 Flash' },+ { id: 'google/gemini-3.1-pro-preview', name: 'Gemini 3.1 Pro (preview)' },+ { id: 'google/gemini-3.1-flash-lite', name: 'Gemini 3.1 Flash Lite' },+ { id: 'deepseek/deepseek-v4-pro', name: 'DeepSeek V4 Pro' },+ { id: 'deepseek/deepseek-v4-flash', name: 'DeepSeek V4 Flash' },+ { id: 'moonshotai/kimi-k2.7-code', name: 'Kimi K2.7 Code' },+ { id: 'moonshotai/kimi-k2.6', name: 'Kimi K2.6' },+ { id: 'qwen/qwen3.7-max', name: 'Qwen3.7 Max' },+ { id: 'qwen/qwen3-coder-next', name: 'Qwen3 Coder Next' },+ { id: 'z-ai/glm-5.2', name: 'GLM-5.2' },+ { id: 'z-ai/glm-5.1', name: 'GLM-5.1' },+ { id: 'minimax/minimax-m3', name: 'MiniMax 3' },+ { id: 'minimax/minimax-m2.7', name: 'MiniMax 2.7' },+ { id: 'xiaomi/mimo-v2.5-pro', name: 'Xiaomi MiMo V2.5 Pro' },+ { id: 'xiaomi/mimo-v2.5', name: 'Xiaomi MiMo V2.5' },+ ],+};diff --git a/test/main/features/auth.test.ts b/test/main/features/auth.test.tsindex b148d190..be8e524c 100644--- a/test/main/features/auth.test.ts+++ b/test/main/features/auth.test.ts@@ -601,6 +601,16 @@ describe('auth › listModels', () => {const { models } = await a.listModels('no-such-provider');expect(models).toEqual([]);});++ it('returns the synchronized GPT-5.6 catalog for OpenAI Codex', async () => {+ const a = await import('../../../src/main/features/auth');+ expect((await a.listModels('openai-codex')).models.map((model) => model.id)).toEqual([+ 'gpt-5.6-sol',+ 'gpt-5.6-terra',+ 'gpt-5.6-luna',+ 'gpt-5.5',+ ]);+ });});describe('auth › DeepSeek policy gate', () => {diff --git a/test/main/features/client_config.test.ts b/test/main/features/client_config.test.tsindex 3a3befbc..fec6ed80 100644--- a/test/main/features/client_config.test.ts+++ b/test/main/features/client_config.test.ts@@ -22,6 +22,7 @@ vi.mock('electron', () => ({import {ClientConfigManager,+ DEFAULT_PROVIDER_MODELS,clientConfigPlatform,refresh,start,@@ -70,6 +71,15 @@ describe('client_config', () => {expect(manager.get('feature.local-default')).toBe(true);});+ it('ships the synchronized public model catalog with compatibility metadata', () => {+ expect(DEFAULT_PROVIDER_MODELS['openai-codex']).toEqual([+ { id: 'gpt-5.6-sol', name: 'GPT-5.6 Sol', template: 'gpt-5.5', contextWindow: 372000, maxTokens: 128000 },+ { id: 'gpt-5.6-terra', name: 'GPT-5.6 Terra', template: 'gpt-5.5', contextWindow: 372000, maxTokens: 128000 },+ { id: 'gpt-5.6-luna', name: 'GPT-5.6 Luna', template: 'gpt-5.5', contextWindow: 272000, maxTokens: 128000 },+ { id: 'gpt-5.5', name: 'GPT-5.5' },+ ]);+ });+it('maps desktop OS names to client config platform buckets', () => {expect(clientConfigPlatform('darwin')).toBe('mac');expect(clientConfigPlatform('win32')).toBe('windows');diff --git a/test/main/model/core-agent/external-providers.test.ts b/test/main/model/core-agent/external-providers.test.tsindex 44b4c45e..5dd4d044 100644--- a/test/main/model/core-agent/external-providers.test.ts+++ b/test/main/model/core-agent/external-providers.test.ts@@ -1,5 +1,6 @@import { describe, it, expect } from 'vitest';import {+ buildDoubaoModel,buildMoonshotModel,createMoonshotProvider,} from '../../../../src/main/model/core-agent/external-providers';@@ -15,6 +16,9 @@ describe('external-providers › buildMoonshotModel', () => {});it('uses known context windows and falls back to 131072 for unknown ids', () => {+ expect(buildMoonshotModel('kimi-k3').contextWindow).toBe(1048576);+ expect(buildMoonshotModel('kimi-k3').maxTokens).toBe(131072);+ expect(buildMoonshotModel('kimi-k2.7-code').contextWindow).toBe(262144);expect(buildMoonshotModel('kimi-k2.6').contextWindow).toBe(262144);expect(buildMoonshotModel('kimi-k2.5').contextWindow).toBe(262144);// Future Moonshot models fall back to the conservative 128k lower bound.@@ -24,11 +28,30 @@ describe('external-providers › buildMoonshotModel', () => {});it('prefers curated labels and falls back to the id', () => {- expect(buildMoonshotModel('kimi-k2.6').name).toBe('Kimi K2.6');- expect(buildMoonshotModel('kimi-k2.5').name).toBe('Kimi K2.5');+ expect(buildMoonshotModel('kimi-k3').name).toBe('Kimi K3');+ expect(buildMoonshotModel('kimi-k2.7-code').name).toBe('Kimi K2.7 Code');// Uncurated ids fall back directly without throwing.expect(buildMoonshotModel('random-id').name).toBe('random-id');});++ it('uses K3 reasoning compatibility when the bundled runtime lacks native metadata', () => {+ const model = buildMoonshotModel('kimi-k3');+ expect(model.reasoning).toBe(true);+ expect(model.compat).toMatchObject({+ supportsDeveloperRole: false,+ thinkingFormat: 'deepseek',+ requiresReasoningContentOnAssistantMessages: true,+ });+ });+});++describe('external-providers › buildDoubaoModel', () => {+ it('uses the current Seed 2.0 Lite limits', () => {+ expect(buildDoubaoModel('doubao-seed-2-0-lite-260428')).toMatchObject({+ contextWindow: 262144,+ maxTokens: 32768,+ });+ });});describe('external-providers › createMoonshotProvider', () => {diff --git a/test/main/model/provider_catalog.test.ts b/test/main/model/provider_catalog.test.tsindex 9582d696..eaee7019 100644--- a/test/main/model/provider_catalog.test.ts+++ b/test/main/model/provider_catalog.test.ts@@ -1,6 +1,7 @@import * as fs from 'node:fs';import * as path from 'node:path';import { describe, it, expect } from 'vitest';+import { getModel } from '@earendil-works/pi-ai';import {CATALOG,CURATED_MODELS,@@ -101,10 +102,13 @@ describe('provider_catalog › CURATED_MODELS', () => {expect(CURATED_MODELS['moonshot']?.length).toBeGreaterThan(0);});- it('moonshot catalog 只列当代主力 K2.6 / K2.5(legacy preview 已下架)', () => {+ it('moonshot catalog exposes only K3 and K2.7', () => {const ids = (CURATED_MODELS['moonshot'] || []).map((m) => m.id);- // 顺序锁:UI 下拉默认选首项,必须是当前推荐的 K2.6- expect(ids).toEqual(['kimi-k2.6', 'kimi-k2.5']);+ expect(ids).toEqual(['kimi-k3', 'kimi-k2.7-code']);+ });++ it('kimi-coding catalog exposes only K3 and K2.7', () => {+ expect((CURATED_MODELS['kimi-coding'] || []).map((m) => m.id)).toEqual(['k3', 'k2p7']);});it('minimax catalog exposes M3 before the M2.7 generation', () => {@@ -112,7 +116,6 @@ describe('provider_catalog › CURATED_MODELS', () => {expect(directIds).toEqual(['MiniMax-M3','MiniMax-M2.7',- 'MiniMax-M2.7-highspeed',]);const globalPortalIds = (CURATED_MODELS['minimax-portal'] || []).map((m) => m.id);@@ -122,6 +125,37 @@ describe('provider_catalog › CURATED_MODELS', () => {expect(portalIds).toEqual(directIds);});+ it('exposes the current GPT-5.6 family for OpenAI and OpenAI Codex', () => {+ const expected = ['gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna', 'gpt-5.5'];+ expect((CURATED_MODELS.openai || []).map((m) => m.id)).toEqual(expected);+ expect((CURATED_MODELS['openai-codex'] || []).map((m) => m.id)).toEqual(expected);+ });++ it('resolves GPT-5.6 entries through declared compatibility templates', async () => {+ const users = await import('../../../src/main/features/users');+ const paths = await import('../../../src/main/paths');+ const uid = 'modelcfggpt56';+ users.activateUser(uid);+ const file = paths.userRemoteConfigFile(uid);+ const catalog = { getPiModel: (provider: string, modelId: string) => getModel(provider, modelId) };+ try {+ for (const provider of ['openai', 'openai-codex'] as const) {+ for (const modelId of ['gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna']) {+ const resolved = resolveConfiguredPiModel(catalog, provider, modelId);+ expect(resolved).toMatchObject({+ requestedModelId: modelId,+ templateModelId: 'gpt-5.5',+ isConfiguredFallback: true,+ needsCustomModel: true,+ model: { id: modelId, maxTokens: 128000 },+ });+ }+ }+ } finally {+ fs.rmSync(path.dirname(file), { recursive: true, force: true });+ }+ });+it('openrouter catalog includes DeepSeek / Qwen / GLM / Kimi / MiniMax', () => {const ids = (CURATED_MODELS.openrouter || []).map((m) => m.id);expect(ids.some((id) => id.startsWith('deepseek/'))).toBe(true);@@ -143,6 +177,18 @@ describe('provider_catalog › CURATED_MODELS', () => {]);});+ it('openrouter GPT catalog keeps GPT-5.6 tiers and GPT-5.5 only', () => {+ const ids = (CURATED_MODELS.openrouter || [])+ .map((m) => m.id)+ .filter((id) => id.startsWith('openai/gpt-'));+ expect(ids).toEqual([+ 'openai/gpt-5.6-sol',+ 'openai/gpt-5.6-terra',+ 'openai/gpt-5.6-luna',+ 'openai/gpt-5.5',+ ]);+ });+it('curatedModelsFor returns a shallow copy safe to mutate', () => {const a = curatedModelsFor('anthropic');const b = curatedModelsFor('anthropic');diff --git a/test/main/model/public_model_catalog.test.ts b/test/main/model/public_model_catalog.test.tsnew file mode 100644index 00000000..de7c5bf5--- /dev/null+++ b/test/main/model/public_model_catalog.test.ts@@ -0,0 +1,49 @@+import { describe, expect, it } from 'vitest';+import { PUBLIC_PROVIDER_MODELS } from '../../../src/main/model/public_model_catalog';++describe('public model catalog', () => {+ it('contains only public providers with unique model ids', () => {+ expect(Object.keys(PUBLIC_PROVIDER_MODELS).sort()).toEqual([+ 'anthropic',+ 'deepseek',+ 'doubao',+ 'google',+ 'kimi-coding',+ 'minimax-cn',+ 'minimax-portal',+ 'minimax-portal-cn',+ 'moonshot',+ 'openai',+ 'openai-codex',+ 'openrouter',+ 'zai',+ ]);+ for (const models of Object.values(PUBLIC_PROVIDER_MODELS)) {+ const ids = models.map((model) => model.id);+ expect(new Set(ids).size).toBe(ids.length);+ expect(ids.every(Boolean)).toBe(true);+ }+ });++ it('keeps OpenAI and OpenAI Codex on the same GPT-5.6 generation', () => {+ const expected = ['gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna', 'gpt-5.5'];+ expect(PUBLIC_PROVIDER_MODELS.openai?.map((model) => model.id)).toEqual(expected);+ expect(PUBLIC_PROVIDER_MODELS['openai-codex']?.map((model) => model.id)).toEqual(expected);+ });++ it('declares compatibility metadata for models newer than older runtimes', () => {+ for (const provider of ['openai', 'openai-codex'] as const) {+ for (const model of PUBLIC_PROVIDER_MODELS[provider]?.slice(0, 3) || []) {+ expect(model.template).toBe('gpt-5.5');+ expect(model.contextWindow).toBeGreaterThan(0);+ expect(model.maxTokens).toBe(128000);+ }+ }+ expect(PUBLIC_PROVIDER_MODELS['kimi-coding']?.[0]).toMatchObject({+ id: 'k3',+ template: 'kimi-for-coding',+ contextWindow: 1048576,+ maxTokens: 131072,+ });+ });+});