Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 区分辅助模型执行 Agent
DavidShenf6ba10acb48a
diff --git a/apps/desktop/src/main/maker-ipc/auxiliary-model-settings.ts b/apps/desktop/src/main/maker-ipc/auxiliary-model-settings.tsindex 46769b5f6a..dc24720fcc 100644--- a/apps/desktop/src/main/maker-ipc/auxiliary-model-settings.ts+++ b/apps/desktop/src/main/maker-ipc/auxiliary-model-settings.ts@@ -81,7 +81,7 @@ export function buildAuxiliaryModelOptions(args: {if (!decoded) continue;result.push({id: pin,- label: `${decoded.model} · ${decoded.providerId}`,+ label: `${decoded.model} · ${decoded.providerId} · ${decoded.agentKind === 'codex' ? 'Codex' : 'Claude Code'}`,group: decoded.providerId,providerId: decoded.providerId,agentKind: decoded.agentKind,diff --git a/apps/desktop/src/main/utility-model/__tests__/textOneshotPinOptions.test.ts b/apps/desktop/src/main/utility-model/__tests__/textOneshotPinOptions.test.tsindex 6759794f87..d9e23f8501 100644--- a/apps/desktop/src/main/utility-model/__tests__/textOneshotPinOptions.test.ts+++ b/apps/desktop/src/main/utility-model/__tests__/textOneshotPinOptions.test.ts@@ -89,12 +89,13 @@ describe('buildTextOneshotPinOptions', () => {expect(options).toEqual([{id: 'cat:xd:codex:codex/gpt-5.5',- label: 'GPT 5.5 折扣 · Cindy Gateway',+ label: 'GPT 5.5 折扣 · Cindy Gateway · Codex',group: 'Cindy Gateway',providerId: 'xd',agentKind: 'codex',modelId: 'codex/gpt-5.5',modelName: 'GPT 5.5 折扣',+ agentSuffix: 'Codex',budget: true,subscription: false,routing: {@@ -104,12 +105,13 @@ describe('buildTextOneshotPinOptions', () => {},{id: 'cat:openai:codex:gpt-5.5',- label: 'GPT 5.5 · OpenAI',+ label: 'GPT 5.5 · OpenAI · Codex',group: 'OpenAI',providerId: 'openai',agentKind: 'codex',modelId: 'gpt-5.5',modelName: 'GPT 5.5',+ agentSuffix: 'Codex',budget: false,subscription: true,routing: { codex: { upstream: 'https://api.example.com', authStrategy: 'oauth-token' } },@@ -270,7 +272,7 @@ describe('buildTextOneshotPinOptions', () => {]);});- it('内置供应商同一模型跨 agent 折叠成一行(agent 不影响出线);自定义保留两行补后缀', () => {+ it('每个 Agent + Model 路由独立成行并始终标注 Agent', () => {const options = buildTextOneshotPinOptions(catalogOf(provider({@@ -296,12 +298,38 @@ describe('buildTextOneshotPinOptions', () => {undefined,);expect(options.map((o) => [o.id, o.label])).toEqual([- // 内置:折叠成 codex 行,无后缀。- ['cat:xd:codex:gpt-5.5', 'GPT 5.5 · GW'],- // 自定义:两条真路由,都补 agent 后缀。+ ['cat:xd:codex:gpt-5.5', 'GPT 5.5 · GW · Codex'],+ ['cat:xd:claude-code:gpt-5.5', 'GPT 5.5 · GW · Claude Code'],['cat:dual:codex:gpt-5.5', 'GPT 5.5 · Dual · Codex'],['cat:dual:claude-code:gpt-5.5', 'GPT 5.5 · Dual · Claude Code'],]);+ expect(options.map((o) => o.agentSuffix)).toEqual([+ 'Codex',+ 'Claude Code',+ 'Codex',+ 'Claude Code',+ ]);+ });++ it('同一供应商下完全相同的 Agent + Model 路由只显示一次', () => {+ const options = buildTextOneshotPinOptions(+ catalogOf(+ provider({+ id: 'xd',+ models: {+ codex: [+ chat('gpt-5.5', { name: 'GPT 5.5' }),+ chat('gpt-5.5', { name: 'GPT 5.5 duplicate' }),+ ],+ },+ }),+ ),+ undefined,+ );++ expect(options.map((o) => [o.id, o.label])).toEqual([+ ['cat:xd:codex:gpt-5.5', 'GPT 5.5 · xd · Codex'],+ ]);});it('供应商序:缺省 xd 在首(系统默认链的家);用户显式排序优先', () => {diff --git a/apps/desktop/src/main/utility-model/textOneshotPinOptions.ts b/apps/desktop/src/main/utility-model/textOneshotPinOptions.tsindex f236490a9c..2b3112b042 100644--- a/apps/desktop/src/main/utility-model/textOneshotPinOptions.ts+++ b/apps/desktop/src/main/utility-model/textOneshotPinOptions.ts@@ -125,7 +125,7 @@ function routingForRenderer(routing: Provider['routing']): Provider['routing'] {export interface TextOneshotPinOption {/** 钉值(cat: 编码)。 */id: string;- /** 兜底行文案:`<模型名> · <供应商名>`(跨 agent 重复补 agent 后缀)。 */+ /** 兜底行文案:`<模型名> · <供应商名> · <Agent>`。 */label: string;/** 分组(供应商显示名)。 */group: string;@@ -144,8 +144,8 @@ export interface TextOneshotPinOption {subscription: boolean;/** 供应商路由描述(渲染层厂牌图标判定用,ProviderLogoMark)。 */routing?: Provider['routing'];- /** 同供应商同模型跨 agent 重复时的后缀('Codex' / 'Claude Code');不重复缺省。 */- agentSuffix?: string;+ /** 该精确路由使用的 Agent('Codex' / 'Claude Code')。 */+ agentSuffix: string;}/**@@ -187,51 +187,29 @@ export function buildTextOneshotPinOptions(hasCredential?: OneshotCredentialProbe,): TextOneshotPinOption[] {const entries: { provider: Provider; agentKind: (typeof ONESHOT_ROUTE_AGENTS)[number]; model: CatalogModel }[] = [];+ const seenRoutes = new Set<string>();for (const provider of orderedProviders(catalog, providerOrder)) {if (isProviderDisabled(overrides, provider.id)) continue;- if (provider.source === 'builtin') {- // 内置四家的执行与凭证都与 agent 无关(xd 网关的请求连 agent 都不看;- // 订阅登录态是账号级)——同一模型只出一行,agent 取首个可路由且有凭证- // 的(codex 优先,与 resolveOneshotCatalogModel 同偏好)。- const seen = new Set<string>();- for (const agentKind of ONESHOT_ROUTE_AGENTS) {- if (!isRoutableForOneshot(provider, agentKind)) continue;- if (hasCredential && !hasCredential(provider, agentKind)) continue;- for (const model of displayOrderedModels(provider.models[agentKind] ?? [])) {- if (seen.has(model.id)) continue;- if (!isChatModel(model, provider)) continue;- if (isModelDisabled(overrides, provider.id, model.id)) continue;- seen.add(model.id);- entries.push({ provider, agentKind, model });- }- }- continue;- }- // 自定义供应商:agent 决定 wire / 凭证 / 上游,(供应商×模型) 跨 agent 是- // 两条真路由,各自成行(渲染层补 agent 后缀区分)。+ // Agent 决定模型可见性和实际 wire。即使内置供应商的两条路由最终共享+ // 凭证或上游,也分别展示并保存,让用户选择一组确定的 Agent + Model。for (const agentKind of ONESHOT_ROUTE_AGENTS) {if (!isRoutableForOneshot(provider, agentKind)) continue;if (hasCredential && !hasCredential(provider, agentKind)) continue;for (const model of displayOrderedModels(provider.models[agentKind] ?? [])) {if (!isChatModel(model, provider)) continue;if (isModelDisabled(overrides, provider.id, model.id)) continue;+ const routeKey = `${provider.id}\n${agentKind}\n${model.id}`;+ if (seenRoutes.has(routeKey)) continue;+ seenRoutes.add(routeKey);entries.push({ provider, agentKind, model });}}}- // 同供应商同模型 id 跨 agent 重复时,两边都补 agent 后缀(否则两行同名选不中)。- // 键带分隔符:裸拼接 ('ab','cd') 与 ('a','bcd') 会撞键误判重复。- const counts = new Map<string, number>();- for (const e of entries) {- const key = `${e.provider.id}\n${e.model.id}`;- counts.set(key, (counts.get(key) ?? 0) + 1);- }return entries.map((e) => {const base = `${e.model.name} · ${e.provider.name}`;- const dup = (counts.get(`${e.provider.id}\n${e.model.id}`) ?? 0) > 1;return {id: encodeCatalogPin(e.provider.id, e.agentKind, e.model.id),- label: dup ? `${base} · ${AGENT_LABEL[e.agentKind]}` : base,+ label: `${base} · ${AGENT_LABEL[e.agentKind]}`,group: e.provider.name,providerId: e.provider.id,agentKind: e.agentKind,@@ -242,7 +220,7 @@ export function buildTextOneshotPinOptions(budget: classifyModel(e.model) === 'gpt-budget',subscription: e.provider.access?.kind === 'subscription',...(e.provider.routing !== undefined ? { routing: routingForRenderer(e.provider.routing) } : {}),- ...(dup ? { agentSuffix: AGENT_LABEL[e.agentKind] } : {}),+ agentSuffix: AGENT_LABEL[e.agentKind],};});}diff --git a/apps/desktop/src/renderer/cindy-brain/OneshotModelPinPicker.tsx b/apps/desktop/src/renderer/cindy-brain/OneshotModelPinPicker.tsxindex 387e940b4b..2922c6140d 100644--- a/apps/desktop/src/renderer/cindy-brain/OneshotModelPinPicker.tsx+++ b/apps/desktop/src/renderer/cindy-brain/OneshotModelPinPicker.tsx@@ -30,11 +30,21 @@ export interface OneshotPinOption {subscription: boolean;/** Provider['routing'](IPC 载荷;ProviderLogoMark 的厂牌图标判定用)。 */routing?: import('@cindy/model-providers').Provider['routing'];+ /** Agent used by this exact route. Older snapshots may omit it. */agentSuffix?: string;/** False for a persisted route that is no longer offered or currently usable. */available?: boolean;}+function optionAgentLabel(option: OneshotPinOption): string {+ return option.agentSuffix+ ?? (option.agentKind === 'claude-code'+ ? 'Claude Code'+ : option.agentKind === 'codex'+ ? 'Codex'+ : option.agentKind);+}+export function OneshotModelPinPicker({value,defaultLabel,@@ -95,12 +105,28 @@ export function OneshotModelPinPicker({const filtered = useMemo(() => {const q = query.trim().toLowerCase();- const visible = options.filter((option) => option.available !== false || option.id === value);+ const visible: OneshotPinOption[] = [];+ const indexByRouteName = new Map<string, number>();+ for (const option of options) {+ if (option.available === false && option.id !== value) continue;+ const routeName = `${option.providerId}\n${option.agentKind}\n${option.modelName.trim().toLowerCase()}`;+ const existingIndex = indexByRouteName.get(routeName);+ if (existingIndex === undefined) {+ indexByRouteName.set(routeName, visible.length);+ visible.push(option);+ continue;+ }+ const existing = visible[existingIndex]!;+ if (existing.id !== value && (option.id === value || existing.available === false)) {+ visible[existingIndex] = option;+ }+ }if (!q) return visible;return visible.filter((o) =>o.modelName.toLowerCase().includes(q)|| o.modelId.toLowerCase().includes(q)+ || optionAgentLabel(o).toLowerCase().includes(q)|| o.group.toLowerCase().includes(q),);}, [options, query, value]);@@ -249,11 +275,9 @@ export function OneshotModelPinPicker({<span className="truncate text-14 font-medium leading-5 text-[var(--model-item-text)]">{o.modelName}</span>- {o.agentSuffix && (- <span className="shrink-0 text-13 font-normal text-[var(--text-tertiary)]">- {o.agentSuffix}- </span>- )}+ <span className="shrink-0 text-13 font-normal text-[var(--text-tertiary)]">+ · {optionAgentLabel(o)}+ </span>{unavailable && (<span className="shrink-0 text-11 font-normal text-[var(--text-tertiary)]">{unavailableLabel ?? t('settings.auxiliaryModels.unavailable')}diff --git a/apps/desktop/src/renderer/components/settings/__tests__/AuxiliaryModelSection.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/AuxiliaryModelSection.test.tsxindex 22901b16e4..68f1c6272b 100644--- a/apps/desktop/src/renderer/components/settings/__tests__/AuxiliaryModelSection.test.tsx+++ b/apps/desktop/src/renderer/components/settings/__tests__/AuxiliaryModelSection.test.tsx@@ -180,6 +180,7 @@ describe('AuxiliaryModelSection', () => {agentKind: 'codex',modelId: 'claude-opus-5',modelName: 'Claude Opus 5',+ agentSuffix: 'Codex',budget: false,subscription: false,available: true,@@ -192,6 +193,7 @@ describe('AuxiliaryModelSection', () => {agentKind: 'codex',modelId: 'deepseek/deepseek-v4-flash',modelName: 'DeepSeek V4 Flash',+ agentSuffix: 'Codex',budget: false,subscription: false,available: true,@@ -227,6 +229,7 @@ describe('AuxiliaryModelSection', () => {agentKind: 'codex',modelId: 'claude-opus-5',modelName: 'Claude Opus 5',+ agentSuffix: 'Codex',defaultEnabled: false,budget: false,subscription: false,diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsx b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsxindex 3df4df5e92..82b384e8cc 100644--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsx+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsx@@ -700,17 +700,43 @@ describe('Ghost plugin detail sections', () => {agentKind: 'codex',modelId: 'codex/gpt-5.5',modelName: 'GPT 5.5 折扣',+ agentSuffix: 'Codex',budget: true,subscription: false,},{id: 'cat:openai:codex:gpt-5.5',- label: 'GPT 5.5 · OpenAI',+ label: 'GPT 5.5 · OpenAI · Codex',group: 'OpenAI',providerId: 'openai',agentKind: 'codex',modelId: 'gpt-5.5',modelName: 'GPT 5.5',+ agentSuffix: 'Codex',+ budget: false,+ subscription: true,+ },+ {+ id: 'cat:openai:codex:chatgpt/gpt-5.5',+ label: 'GPT 5.5 · OpenAI · Codex',+ group: 'OpenAI',+ providerId: 'openai',+ agentKind: 'codex',+ modelId: 'chatgpt/gpt-5.5',+ modelName: 'GPT 5.5',+ agentSuffix: 'Codex',+ budget: false,+ subscription: true,+ },+ {+ id: 'cat:openai:claude-code:chatgpt/gpt-5.5',+ label: 'GPT 5.5 · OpenAI · Claude Code',+ group: 'OpenAI',+ providerId: 'openai',+ agentKind: 'claude-code',+ modelId: 'chatgpt/gpt-5.5',+ modelName: 'GPT 5.5',+ agentSuffix: 'Claude Code',budget: false,subscription: true,},@@ -741,8 +767,14 @@ describe('Ghost plugin detail sections', () => {);// 折扣徽标只出现在预算行;订阅徽标只出现在订阅行。const budgetRow = within(listbox).getByText('GPT 5.5 折扣').closest('button')!;+ expect(within(budgetRow).getByText(/Codex/)).toBeTruthy();expect(within(budgetRow).getByText('settings.ghosts.detail.cindyPrefs.budgetBadge')).toBeTruthy();- const plainRow = within(listbox).getByText('GPT 5.5', { exact: true }).closest('button')!;+ const plainRows = within(listbox)+ .getAllByText('GPT 5.5', { exact: true })+ .map((modelName) => modelName.closest('button')!);+ expect(plainRows).toHaveLength(2);+ const plainRow = plainRows.find((row) => row.textContent?.includes('Codex'))!;+ expect(plainRows.some((row) => row.textContent?.includes('Claude Code'))).toBe(true);expect(within(plainRow).queryByText('settings.ghosts.detail.cindyPrefs.budgetBadge'),).toBeNull();diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 26b228e27a..85ffb6d0ff 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -2531,7 +2531,7 @@},"auxiliaryModels": {"title": "Auxiliary models",- "description": "Choose separate models for automatic task naming and composer prompt suggestions.",+ "description": "Choose one Agent and model pair for automatic task naming and another for composer prompt suggestions.","sessionTitle": {"label": "Automatic task naming","description": "Applies to Claude Code, Codex, and Pi tasks, plus manual AI renaming.",@@ -2544,8 +2544,8 @@"ariaLabel": "Choose the composer prompt suggestion model","automatic": "Automatic (keep current routing)"},- "explicitRouteHint": "An explicit selection uses only that model. If it is unavailable, Cindy will not switch providers.",- "searchPlaceholder": "Search models or providers",+ "explicitRouteHint": "An explicit selection uses only that Agent and model. If unavailable, Cindy will not switch automatically.",+ "searchPlaceholder": "Search Agents, models, or providers","noResults": "No available models","unavailable": "Currently unavailable","budget": "Discount",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 9a1c75f60f..32dd5d604b 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -2530,7 +2530,7 @@},"auxiliaryModels": {"title": "補助モデル",- "description": "タスクの自動命名と入力欄のおすすめプロンプトに、それぞれ別のモデルを指定します。",+ "description": "タスクの自動命名と入力欄のおすすめプロンプトに、それぞれ Agent とモデルの組み合わせを指定します。","sessionTitle": {"label": "タスクの自動命名","description": "Claude Code、Codex、Pi のタスクと、AI による手動の名前変更に適用されます。",@@ -2543,8 +2543,8 @@"ariaLabel": "入力欄のおすすめプロンプト用モデルを選択","automatic": "自動選択(現在のルーティングを維持)"},- "explicitRouteHint": "明示的に指定した場合は、そのモデルだけを使用します。利用できなくても、別のプロバイダーには切り替えません。",- "searchPlaceholder": "モデルまたはプロバイダーを検索",+ "explicitRouteHint": "明示的に指定した場合は、その Agent とモデルだけを使用します。利用できなくても自動では切り替えません。",+ "searchPlaceholder": "Agent、モデル、プロバイダーを検索","noResults": "利用可能なモデルがありません","unavailable": "現在利用不可","budget": "割引",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex 56fe10d613..bc8e3cd89e 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -2530,7 +2530,7 @@},"auxiliaryModels": {"title": "보조 모델",- "description": "작업 자동 이름 지정과 입력창 추천 프롬프트에 각각 다른 모델을 지정합니다.",+ "description": "작업 자동 이름 지정과 입력창 추천 프롬프트에 각각 Agent와 모델 조합을 지정합니다.","sessionTitle": {"label": "작업 자동 이름 지정","description": "Claude Code, Codex, Pi 작업과 AI 수동 이름 바꾸기에 적용됩니다.",@@ -2543,8 +2543,8 @@"ariaLabel": "입력창 추천 프롬프트 모델 선택","automatic": "자동 선택(현재 라우팅 유지)"},- "explicitRouteHint": "명시적으로 지정하면 해당 모델만 사용합니다. 사용할 수 없어도 다른 제공자로 전환하지 않습니다.",- "searchPlaceholder": "모델 또는 제공자 검색",+ "explicitRouteHint": "명시적으로 지정하면 해당 Agent와 모델만 사용합니다. 사용할 수 없어도 자동으로 전환하지 않습니다.",+ "searchPlaceholder": "Agent, 모델 또는 제공자 검색","noResults": "사용 가능한 모델이 없습니다","unavailable": "현재 사용할 수 없음","budget": "할인",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex c43ea42fac..8ea0407310 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -2530,7 +2530,7 @@},"auxiliaryModels": {"title": "辅助模型",- "description": "为任务自动命名和输入框推荐指令分别指定模型。",+ "description": "为任务自动命名和输入框推荐指令分别指定一组 Agent 和模型。","sessionTitle": {"label": "任务自动命名","description": "适用于 Claude Code、Codex、Pi 任务,以及手动 AI 重命名。",@@ -2543,8 +2543,8 @@"ariaLabel": "选择输入框推荐指令模型","automatic": "自动选择(保持当前规则)"},- "explicitRouteHint": "显式指定后只使用该模型;模型不可用时不会改用其他供应商。",- "searchPlaceholder": "搜索模型或供应商",+ "explicitRouteHint": "显式指定后只使用该 Agent 和模型;不可用时不会自动切换。",+ "searchPlaceholder": "搜索 Agent、模型或供应商","noResults": "没有可用模型","unavailable": "当前不可用","budget": "折扣",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex 7d2949b6c1..3243a5ff4e 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -2530,7 +2530,7 @@},"auxiliaryModels": {"title": "輔助模型",- "description": "為任務自動命名與輸入框推薦指令分別指定模型。",+ "description": "為任務自動命名與輸入框推薦指令分別指定一組 Agent 和模型。","sessionTitle": {"label": "任務自動命名","description": "適用於 Claude Code、Codex、Pi 任務,以及手動 AI 重新命名。",@@ -2543,8 +2543,8 @@"ariaLabel": "選擇輸入框推薦指令模型","automatic": "自動選擇(維持目前規則)"},- "explicitRouteHint": "明確指定後只使用該模型;模型無法使用時不會改用其他供應商。",- "searchPlaceholder": "搜尋模型或供應商",+ "explicitRouteHint": "明確指定後只使用該 Agent 和模型;無法使用時不會自動切換。",+ "searchPlaceholder": "搜尋 Agent、模型或供應商","noResults": "沒有可用模型","unavailable": "目前無法使用","budget": "折扣",diff --git a/apps/desktop/src/shared/auxiliaryModelSettings.ts b/apps/desktop/src/shared/auxiliaryModelSettings.tsindex 3f1ef73ffe..4532eebd68 100644--- a/apps/desktop/src/shared/auxiliaryModelSettings.ts+++ b/apps/desktop/src/shared/auxiliaryModelSettings.ts@@ -35,7 +35,8 @@ export interface AuxiliaryModelOption {budget: boolean;subscription: boolean;routing?: Provider['routing'];- agentSuffix?: string;+ /** Agent used by this exact auxiliary route. */+ agentSuffix: string;/** False only for a persisted selection that is no longer currently usable. */available: boolean;}