Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(providers): 统一 SSH 订阅账号与 Harness 兼容筛选
Dashca27563be719
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/orcaProviderRoutingSnapshotWiring.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/orcaProviderRoutingSnapshotWiring.test.tsindex dcc3d93869..7dd92cc211 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/orcaProviderRoutingSnapshotWiring.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/orcaProviderRoutingSnapshotWiring.test.ts@@ -60,25 +60,26 @@ describe('Orca provider routing snapshot wiring', () => {expect(worktreeAllocation).toBeGreaterThan(validation);});- it('marks independent OpenAI accounts local-only before SSH worker creation', async () => {- const builtin = BUNDLED_CATALOG.providers.find((provider) => provider.id === 'openai')!;- const account = { ...builtin, id: 'user-openai-account', auth: { method: 'oauth' as const, native: 'codex' as const } };+ it.each([['openai', 'codex'], ['anthropic', 'claude']] as const)('marks %s accounts local-only for Pi before SSH worker creation', async (brand, native) => {+ const builtin = BUNDLED_CATALOG.providers.find((provider) => provider.id === brand)!;+ const account = { ...builtin, id: 'user-account', auth: { method: 'oauth' as const, native } };const catalog = { ...BUNDLED_CATALOG, providers: [account, builtin] };const routing = await readOrcaWorkerProviderRoutingContext({providerService: {- listProviders: vi.fn(async () => buildRegistry(catalog, { [account.id]: true, openai: true })),+ listProviders: vi.fn(async () => buildRegistry(catalog, { [account.id]: true, [brand]: true })),},getCatalog: () => catalog,});- expect(routing.availability.codex.find((provider) => provider.id === account.id)?.chatBridgedCodex).toBe(true);- expect(routing.availability.codex.find((provider) => provider.id === 'openai')?.chatBridgedCodex).toBe(false);+ expect(routing.availability.pi.find((provider) => provider.id === account.id)?.localOnlyForSsh).toBe(true);+ const nativeAgent = brand === 'openai' ? 'codex' : 'claude-code';+ expect(routing.availability[nativeAgent].find((provider) => provider.id === brand)?.localOnlyForSsh).toBe(false);});it('rejects SSH account switching before deferring or replacing the running route', () => {- const guard = registerSource.indexOf("throwIpcError('INVALID_PARAMS', 'This Codex account belongs to the local device')");+ const guard = registerSource.indexOf("throwIpcError('INVALID_PARAMS', 'This provider requires local execution')");expect(guard).toBeGreaterThan(-1);- expect(registerSource.slice(guard - 300, guard)).toContain('runtimeStatus.remoteHostId');- expect(registerSource.slice(guard - 300, guard)).toContain('isCodexAccountProvider');+ expect(registerSource.slice(guard - 450, guard)).toContain('runtimeStatus.remoteHostId');+ expect(registerSource.slice(guard - 300, guard)).toContain('isLocalOnlyProviderForAgent');expect(registerSource.indexOf('const deferLockedSelection =', guard)).toBeGreaterThan(guard);expect(registerSource.indexOf('const previousRuntime =', guard)).toBeGreaterThan(guard);});diff --git a/apps/desktop/src/main/maker-ipc/__tests__/orcaWorkerCreationService.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/orcaWorkerCreationService.test.tsindex a8e3ac85c8..0f11ea03a2 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/orcaWorkerCreationService.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/orcaWorkerCreationService.test.ts@@ -2464,7 +2464,7 @@ describe('SSH remote worker model/provider compatibility gate (R23 P2)', () => {});});- it.each(['deepseek', 'user-openai-account'])('rejects local-only Codex source %s before allocating a remote worker', async (providerId) => {+ it.each([['deepseek', 'codex'], ['user-openai-account', 'codex'], ['user-claude-account', 'pi']] as const)('rejects local-only source %s/%s before allocating a remote worker', async (providerId, agent) => {const { service, deps } = createDeps({getLeadSessionRow: vi.fn(async () => remoteLeadRow),getAvailableModels: vi.fn(() => [@@ -2472,7 +2472,7 @@ describe('SSH remote worker model/provider compatibility gate (R23 P2)', () => {]),getProviderRoutingContext: vi.fn(async () => providerRoutingContext({'claude-code': [],- codex: [{ id: providerId, name: providerId, models: ['deepseek-v4'], chatBridgedCodex: true }],+ [agent]: [{ id: providerId, name: providerId, models: ['deepseek-v4'], localOnlyForSsh: true }],})),});@@ -2480,7 +2480,7 @@ describe('SSH remote worker model/provider compatibility gate (R23 P2)', () => {service.createWorker({leadSessionId: 'lead-1',role: 'reviewer',- agent: 'codex',+ agent,label: 'reviewer',model: 'deepseek-v4',providerId,@@ -2559,7 +2559,7 @@ describe('SSH remote worker model/provider compatibility gate (R23 P2)', () => {]),getProviderRoutingContext: vi.fn(async () => providerRoutingContext({'claude-code': [],- codex: [{ id: 'deepseek', name: 'DeepSeek', models: ['deepseek-v4'], chatBridgedCodex: true }],+ codex: [{ id: 'deepseek', name: 'DeepSeek', models: ['deepseek-v4'], localOnlyForSsh: true }],})),});@@ -2601,7 +2601,7 @@ describe('SSH remote worker model/provider compatibility gate (R23 P2)', () => {]),getProviderRoutingContext: vi.fn(async () => providerRoutingContext({'claude-code': [],- codex: [{ id: 'deepseek', name: 'DeepSeek', models: ['deepseek-v4'], chatBridgedCodex: true }],+ codex: [{ id: 'deepseek', name: 'DeepSeek', models: ['deepseek-v4'], localOnlyForSsh: true }],})),});diff --git a/apps/desktop/src/main/maker-ipc/orcaProviderRoutingContext.ts b/apps/desktop/src/main/maker-ipc/orcaProviderRoutingContext.tsindex b1ad68020f..052e23f60d 100644--- a/apps/desktop/src/main/maker-ipc/orcaProviderRoutingContext.ts+++ b/apps/desktop/src/main/maker-ipc/orcaProviderRoutingContext.ts@@ -4,7 +4,7 @@ import {effectiveSourceIdForModel,findModelRegistryRoute,isModelSelectableForNewRoute,- isLocalOnlyCodexProvider,+ isLocalOnlyProviderForAgent,type Catalog,type ProviderView,} from '@cindy/model-providers';@@ -73,8 +73,8 @@ export async function readOrcaWorkerProviderRoutingContext(deps: {requiresExplicitRoute: providerRouteRequiresExplicitSelection(provider.routing[agent]?.authStrategy,),- chatBridgedCodex:- agent === 'codex' && isLocalOnlyCodexProvider(provider),+ localOnlyForSsh:+ isLocalOnlyProviderForAgent(provider, agent),};});diff --git a/apps/desktop/src/main/maker-ipc/orcaWorkerCreationService.ts b/apps/desktop/src/main/maker-ipc/orcaWorkerCreationService.tsindex 42005ebc6b..64a94a5d72 100644--- a/apps/desktop/src/main/maker-ipc/orcaWorkerCreationService.ts+++ b/apps/desktop/src/main/maker-ipc/orcaWorkerCreationService.ts@@ -81,10 +81,10 @@ export interface OrcaWorkerProviderSnapshot {/** true 表示该来源必须写入 session provider store 才能注入自己的 API key/OAuth token。 */requiresExplicitRoute?: boolean;/**- * Legacy field: true for local-only Codex routes, including Chat bridges and- * independent OAuth accounts. Shares isLocalOnlyCodexProvider with the picker.+ * Local execution required for this provider/agent pair. Shares+ * isLocalOnlyProviderForAgent with the picker.*/- chatBridgedCodex?: boolean;+ localOnlyForSsh?: boolean;}/** 自带凭证或明确无鉴权的第三方路由都不能回落到 worker/lead 的默认上游。 */@@ -886,13 +886,13 @@ export function createOrcaWorkerCreationService(deps: OrcaWorkerCreationDeps): O}// 未显式来源的 Worker 也必须按最终持久化的实际 routeProvider 判定;否则// 默认来源上的 chat-bridged provider 会漏过远端兼容闸。- if (routeProvider?.chatBridgedCodex === true) {+ if (routeProvider?.localOnlyForSsh === true) {return {ok: false,errorCode: 'INVALID_PARAMS',message:`provider "${routeProvider.id}" is not available for SSH remote workers: ` +- 'this Codex provider requires local execution — pick an SSH-compatible provider',+ 'this provider requires local execution — pick an SSH-compatible provider',};}}diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.tsindex 222d6cac5a..3cdb5ced35 100644--- a/apps/desktop/src/main/maker-ipc/register.ts+++ b/apps/desktop/src/main/maker-ipc/register.ts@@ -59,6 +59,7 @@ import {effectiveSourceIdForModel,findCatalogModel,storedCustomProviderId,+ isLocalOnlyProviderForAgent,} from '@cindy/model-providers';import { createId } from '@paralleldrive/cuid2';import {@@ -15353,9 +15354,12 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions));}}- if (runtimeStatus.remoteHostId && dbToMakerAgentKind(runtimeStatus.agentKind) === 'codex' &&- isCodexAccountProvider(effectiveProviderId === undefined ? currentProviderId : effectiveProviderId)) {- throwIpcError('INVALID_PARAMS', 'This Codex account belongs to the local device');+ if (runtimeStatus.remoteHostId) {+ const targetId = effectiveProviderId === undefined ? currentProviderId : effectiveProviderId;+ const target = getActiveCatalog().providers.find((provider) => provider.id === targetId);+ if (target && isLocalOnlyProviderForAgent(target, dbToMakerAgentKind(runtimeStatus.agentKind))) {+ throwIpcError('INVALID_PARAMS', 'This provider requires local execution');+ }}if (atomicSelection) {const meta = await maker.getSessionMeta(sessionId);diff --git a/apps/desktop/src/renderer/__tests__/modelSelectorCustomProviderCodexGate.test.tsx b/apps/desktop/src/renderer/__tests__/modelSelectorCustomProviderCodexGate.test.tsxindex 205beaffca..ade471014a 100644--- a/apps/desktop/src/renderer/__tests__/modelSelectorCustomProviderCodexGate.test.tsx+++ b/apps/desktop/src/renderer/__tests__/modelSelectorCustomProviderCodexGate.test.tsx@@ -142,7 +142,7 @@ vi.mock('@/hooks/useDeviceProviders', () => ({vi.mock('@/lib/providerModels', () => ({providerMonogram: (name: string) => name.slice(0, 1).toUpperCase(),- isLocalOnlyCodexProvider: () => false,+ isLocalOnlyProviderForAgent: () => false,filterChatBridgedCodexProviders: (providers: unknown[]) => providers,resolveVisibleModelAgentKind: ({ agentKind }: { agentKind: string | null }) =>agentKind ?? 'codex',diff --git a/apps/desktop/src/renderer/__tests__/modelSelectorProviderGroups.test.tsx b/apps/desktop/src/renderer/__tests__/modelSelectorProviderGroups.test.tsxindex 419440a40a..dc0d8d318d 100644--- a/apps/desktop/src/renderer/__tests__/modelSelectorProviderGroups.test.tsx+++ b/apps/desktop/src/renderer/__tests__/modelSelectorProviderGroups.test.tsx@@ -243,7 +243,7 @@ vi.mock('@/hooks/useDeviceProviders', () => ({const visibleModelsRef = vi.hoisted(() => ({ models: [] as unknown[] }));vi.mock('@/lib/providerModels', () => ({providerMonogram: (name: string) => name.slice(0, 1).toUpperCase(),- isLocalOnlyCodexProvider: () => false,+ isLocalOnlyProviderForAgent: () => false,filterChatBridgedCodexProviders: (providers: unknown[]) => providers,resolveVisibleModelAgentKind: ({ agentKind }: { agentKind: string | null }) =>agentKind ?? 'claude-code',diff --git a/apps/desktop/src/renderer/__tests__/modelSelectorTriggerVariant.test.ts b/apps/desktop/src/renderer/__tests__/modelSelectorTriggerVariant.test.tsindex 93d0dc5d84..7351e5a2f8 100644--- a/apps/desktop/src/renderer/__tests__/modelSelectorTriggerVariant.test.ts+++ b/apps/desktop/src/renderer/__tests__/modelSelectorTriggerVariant.test.ts@@ -354,7 +354,7 @@ const visibleModelsRef = vi.hoisted(() => ({vi.mock('@/lib/providerModels', () => ({providerMonogram: (name: string) => name.slice(0, 1).toUpperCase(),// #245 新增:ModelSelector 渲染路径直接调用;fixture providers 无 routing,按不过滤透传。- isLocalOnlyCodexProvider: () => false,+ isLocalOnlyProviderForAgent: () => false,filterChatBridgedCodexProviders: (providers: unknown[]) => providers,isDeviceModelVisible: (overrides: Record<string, boolean> | undefined,diff --git a/apps/desktop/src/renderer/__tests__/selectVisibleModels.test.ts b/apps/desktop/src/renderer/__tests__/selectVisibleModels.test.tsindex 44ee6a34f0..de05562482 100644--- a/apps/desktop/src/renderer/__tests__/selectVisibleModels.test.ts+++ b/apps/desktop/src/renderer/__tests__/selectVisibleModels.test.ts@@ -15,7 +15,7 @@ import { describe, expect, it } from 'vitest';import type { ModelDescriptor } from '@/hooks/useAgentCapabilities';import {filterChatBridgedCodexProviders,- isLocalOnlyCodexProvider,+ isLocalOnlyProviderForAgent,isDeviceModelVisible,selectVisibleModels,} from '@/lib/providerModels';@@ -305,6 +305,18 @@ describe('selectVisibleModels — excludeChatBridgedCodex(SSH 远程隐藏 Chat});describe('filterChatBridgedCodexProviders — provider source sections', () => {+ it('filters Pi Claude accounts before deduplication, retaining Grok and API sources', () => {+ const claude = { ...provider('claude-account', 'pi', ['claude-only', 'shared']), auth: { method: 'oauth', native: 'claude' } } as ProviderView;+ const grok = { ...provider('grok-account', 'pi', ['grok-model']), auth: { method: 'oauth', native: 'xai' } } as ProviderView;+ const api = { ...provider('api', 'pi', ['shared']), auth: { method: 'apiKey' } } as ProviderView;+ const providers = [claude, grok, api];+ expect(filterChatBridgedCodexProviders(providers, 'pi', true)).toEqual([grok, api]);+ expect(filterChatBridgedCodexProviders(providers, 'pi', false)).toEqual(providers);+ expect(filterChatBridgedCodexProviders([claude], 'claude-code', true)).toEqual([claude]);+ const input = { agentKind: 'pi' as const, deviceId: undefined, providers, deviceCcModels: [], deviceCodexModels: [], excludeChatBridgedCodex: true };+ expect(ids(selectVisibleModels(input))).toEqual(['grok-model', 'shared']);+ expect(ids(selectVisibleModels({ ...input, deviceId: 'host', devicePiModels: [devModel('claude-only')] }))).toEqual(['claude-only']);+ });const bridged = { ...codexProvider('bridged', ['deepseek-chat'], 'openai-chat'), connected: true };const native = { ...codexProvider('native', ['gpt-5.5'], 'openai-responses'), connected: true };@@ -317,13 +329,13 @@ describe('filterChatBridgedCodexProviders — provider source sections', () => {const builtin = { ...account, id: 'openai', models: native.models };const api = { ...native, auth: { method: 'apiKey' } } as ProviderView;const providers = [account, builtin, api];- expect(isLocalOnlyCodexProvider(account)).toBe(true);- expect(isLocalOnlyCodexProvider(builtin)).toBe(false);- expect(isLocalOnlyCodexProvider(api)).toBe(false);+ expect(isLocalOnlyProviderForAgent(account, 'codex')).toBe(true);+ expect(isLocalOnlyProviderForAgent(builtin, 'codex')).toBe(false);+ expect(isLocalOnlyProviderForAgent(api, 'codex')).toBe(false);expect(filterChatBridgedCodexProviders(providers, 'codex', true)).toEqual([builtin, api]);expect(filterChatBridgedCodexProviders(providers, 'codex', false)).toEqual(providers);- expect(filterChatBridgedCodexProviders(providers, 'claude-code', true)).toEqual(providers);- expect(filterChatBridgedCodexProviders(providers, 'pi', true)).toEqual(providers);+ expect(filterChatBridgedCodexProviders(providers, 'claude-code', true)).toEqual([api]);+ expect(filterChatBridgedCodexProviders(providers, 'pi', true)).toEqual([api]);const input = {agentKind: 'codex' as const, deviceId: undefined, providers,deviceCcModels: [], deviceCodexModels: [], excludeChatBridgedCodex: true,diff --git a/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx b/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsxindex d25693d4f8..574defa4fc 100644--- a/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx+++ b/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx@@ -82,7 +82,7 @@ import { modelPriceDiscountLabelValues, modelPriceDetailRows } from '@/lib/modelimport { resolveModelPricePresentation } from '@/lib/modelPricePresentation';import {filterChatBridgedCodexProviders,- isLocalOnlyCodexProvider,+ isLocalOnlyProviderForAgent,isDeviceModelVisible,providerMonogram,resolveVisibleModelAgentKind,@@ -1297,7 +1297,7 @@ function ModelSelectorContentView({() =>excludeChatBridgedCodex? (provider: ProviderView, agent: AgentKind): boolean =>- agent === 'codex' && isLocalOnlyCodexProvider(provider)+ isLocalOnlyProviderForAgent(provider, agent): undefined,[excludeChatBridgedCodex],);diff --git a/apps/desktop/src/renderer/lib/providerModels.ts b/apps/desktop/src/renderer/lib/providerModels.tsindex 8dce09c1d8..ccb23176ad 100644--- a/apps/desktop/src/renderer/lib/providerModels.ts+++ b/apps/desktop/src/renderer/lib/providerModels.ts@@ -15,7 +15,7 @@ import {findCatalogModel,isModelSelectableForNewRoute,isModelVisible,- isLocalOnlyCodexProvider,+ isLocalOnlyProviderForAgent,providerOffersModel,providersForAgent,sessionModelSupportsFastMode,@@ -150,7 +150,7 @@ export function isDeviceModelVisible();}-export { isLocalOnlyCodexProvider } from '@cindy/model-providers';+export { isLocalOnlyProviderForAgent } from '@cindy/model-providers';/** Legacy name: the SSH filter covers both local bridges and independent accounts. */export function filterChatBridgedCodexProviders(@@ -158,8 +158,8 @@ export function filterChatBridgedCodexProviders(agent: AgentKind,exclude: boolean,): ProviderView[] {- return exclude && agent === 'codex'- ? providers.filter((provider) => !isLocalOnlyCodexProvider(provider))+ return exclude+ ? providers.filter((provider) => !isLocalOnlyProviderForAgent(provider, agent)): providers;}@@ -259,12 +259,12 @@ export function selectVisibleModels(params: {// 普通 subscription-direct 行继续保留,准入由调用方按 isSubscriptionDirectModel// 打 disabled。Pi 的 `[1m]` profile 是仅本地可改写的 catalog identity,SSH 侧必须隐藏。const pass = (list: ModelDescriptor[]): ModelDescriptor[] => list;- const codexDeriveOpts = excludeChatBridgedCodex- ? { excludeProvider: isLocalOnlyCodexProvider }+ const deriveOpts = (agent: AgentKind) => excludeChatBridgedCodex+ ? { excludeProvider: (provider: ProviderView) => isLocalOnlyProviderForAgent(provider, agent) }: undefined;- const cc = pass(deviceId ? deviceCcModels : deriveModelsFromProviders(providers, 'claude-code'));- const codex = pass(deviceId ? deviceCodexModels : deriveModelsFromProviders(providers, 'codex', codexDeriveOpts));- const pi = pass(deviceId ? devicePiModels : deriveModelsFromProviders(providers, 'pi'))+ const cc = pass(deviceId ? deviceCcModels : deriveModelsFromProviders(providers, 'claude-code', deriveOpts('claude-code')));+ const codex = pass(deviceId ? deviceCodexModels : deriveModelsFromProviders(providers, 'codex', deriveOpts('codex')));+ const pi = pass(deviceId ? devicePiModels : deriveModelsFromProviders(providers, 'pi', deriveOpts('pi'))).filter((model) => !(excludeSubscriptionDirect === true &&agentKind === 'pi' &&diff --git a/packages/model-providers/src/__tests__/provider-identity.test.ts b/packages/model-providers/src/__tests__/provider-identity.test.tsindex 79789c19fb..80627b3c23 100644--- a/packages/model-providers/src/__tests__/provider-identity.test.ts+++ b/packages/model-providers/src/__tests__/provider-identity.test.ts@@ -1,7 +1,23 @@import { describe, expect, it } from 'vitest';-import { isOpenAiSubscriptionProvider, providerCatalogId } from '../provider-identity.js';+import { isLocalOnlyProviderForAgent, isOpenAiSubscriptionProvider, providerCatalogId } from '../provider-identity.js';+import type { Provider } from '../types.js';describe('connection identity vs public catalog identity', () => {+ it.each([+ ['openai', 'codex', [false, true, true]],+ ['openai-account', 'codex', [true, true, true]],+ ['anthropic', 'claude', [true, false, true]],+ ['claude-account', 'claude', [true, false, true]],+ ['xai', 'xai', [true, true, false]],+ ['grok-account', 'xai', [true, true, false]],+ ] as const)('matches SSH adapters for %s', (id, native, expected) => {+ const provider = { id, auth: { method: 'oauth', native }, routing: {} } as Provider;+ expect(['codex', 'claude-code', 'pi'].map((agent) =>+ isLocalOnlyProviderForAgent(provider, agent as 'codex' | 'claude-code' | 'pi'),+ )).toEqual(expected);+ const api = { ...provider, auth: { method: 'apiKey' as const } };+ expect(isLocalOnlyProviderForAgent(api, 'pi')).toBe(false);+ });it('aliases only native OpenAI subscription metadata', () => {for (const provider of [{ id: 'openai', auth: { method: 'oauth' as const } },diff --git a/packages/model-providers/src/index.ts b/packages/model-providers/src/index.tsindex 3635abfed1..74e918505b 100644--- a/packages/model-providers/src/index.ts+++ b/packages/model-providers/src/index.ts@@ -38,7 +38,7 @@ export type {} from "./types.js";export { PI_MODEL_APIS, PI_REASONING_EFFORTS } from "./types.js";-export { isLocalOnlyCodexProvider, isOpenAiSubscriptionProvider, providerCatalogId } from './provider-identity.js';+export { isLocalOnlyProviderForAgent, isOpenAiSubscriptionProvider, providerCatalogId } from './provider-identity.js';export {effectivePiWireProtocol,diff --git a/packages/model-providers/src/provider-identity.ts b/packages/model-providers/src/provider-identity.tsindex 2118a5f57c..f9d1d89166 100644--- a/packages/model-providers/src/provider-identity.ts+++ b/packages/model-providers/src/provider-identity.ts@@ -1,9 +1,18 @@-import type { Provider } from './types.js';+import type { AgentKind, Provider } from './types.js';-/** SSH Codex cannot use the local Chat bridge or an independent local OAuth home. */-export function isLocalOnlyCodexProvider(provider: Pick<Provider, 'id' | 'auth' | 'routing'>): boolean {- return provider.routing?.codex?.wireProtocol === 'openai-chat'- || (provider.id !== 'openai' && isOpenAiSubscriptionProvider(provider));+/** Match the native SSH adapters; xAI forwarding and native Claude Code remain available. */+export function isLocalOnlyProviderForAgent(+ provider: Pick<Provider, 'id' | 'auth' | 'routing'>,+ agent: AgentKind,+): boolean {+ if (agent === 'codex' && provider.routing?.codex?.wireProtocol === 'openai-chat') return true;+ if (provider.auth?.method === 'oauth') {+ const brand = providerCatalogId(provider);+ if (brand === 'openai') return !(agent === 'codex' && provider.id === 'openai');+ if (brand === 'anthropic') return agent !== 'claude-code';+ if (brand === 'xai') return agent !== 'pi';+ }+ return false;}/** Provider identity is separate from the account entry's stable id. */