From b74b5fb967b4c532cf1ba28c01c3078302e8cf50 Mon Sep 17 00:00:00 2001 From: Haileyesus Date: Fri, 17 Apr 2026 15:23:12 +0300 Subject: [PATCH] refactor(providers): clarify provider auth and MCP naming Rename provider auth/MCP contracts to remove the overloaded Runtime suffix so the shared interfaces read as stable provider capabilities instead of execution implementation details. Add a consistent provider-first auth class naming convention by renaming ClaudeAuthProvider, CodexAuthProvider, CursorAuthProvider, and GeminiAuthProvider to ClaudeProviderAuth, CodexProviderAuth, CursorProviderAuth, and GeminiProviderAuth. This keeps the provider module API easier to scan and aligns auth naming with the main provider ownership model. --- .../list/claude/claude-auth.provider.ts | 4 ++-- .../providers/list/claude/claude.provider.ts | 6 +++--- .../providers/list/codex/codex-auth.provider.ts | 4 ++-- .../providers/list/codex/codex.provider.ts | 6 +++--- .../list/cursor/cursor-auth.provider.ts | 4 ++-- .../providers/list/cursor/cursor.provider.ts | 6 +++--- .../list/gemini/gemini-auth.provider.ts | 4 ++-- .../providers/list/gemini/gemini.provider.ts | 6 +++--- .../providers/shared/base/abstract.provider.ts | 8 ++++---- .../modules/providers/shared/mcp/mcp.provider.ts | 4 ++-- server/shared/interfaces.ts | 16 ++++++++-------- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/server/modules/providers/list/claude/claude-auth.provider.ts b/server/modules/providers/list/claude/claude-auth.provider.ts index 88e9bbc6..75012b84 100644 --- a/server/modules/providers/list/claude/claude-auth.provider.ts +++ b/server/modules/providers/list/claude/claude-auth.provider.ts @@ -4,7 +4,7 @@ import path from 'node:path'; import spawn from 'cross-spawn'; -import type { IProviderAuthRuntime } from '@/shared/interfaces.js'; +import type { IProviderAuth } from '@/shared/interfaces.js'; import type { ProviderAuthStatus } from '@/shared/types.js'; import { readObjectRecord, readOptionalString } from '@/shared/utils.js'; @@ -15,7 +15,7 @@ type ClaudeCredentialsStatus = { error?: string; }; -export class ClaudeAuthProvider implements IProviderAuthRuntime { +export class ClaudeProviderAuth implements IProviderAuth { /** * Checks whether the Claude Code CLI is available on this host. */ diff --git a/server/modules/providers/list/claude/claude.provider.ts b/server/modules/providers/list/claude/claude.provider.ts index 0cdfaf82..9ca9b443 100644 --- a/server/modules/providers/list/claude/claude.provider.ts +++ b/server/modules/providers/list/claude/claude.provider.ts @@ -1,8 +1,8 @@ import { getSessionMessages } from '@/projects.js'; import { AbstractProvider } from '@/modules/providers/shared/base/abstract.provider.js'; -import { ClaudeAuthProvider } from '@/modules/providers/list/claude/claude-auth.provider.js'; +import { ClaudeProviderAuth } from '@/modules/providers/list/claude/claude-auth.provider.js'; import { ClaudeMcpProvider } from '@/modules/providers/list/claude/claude-mcp.provider.js'; -import type { IProviderAuthRuntime } from '@/shared/interfaces.js'; +import type { IProviderAuth } from '@/shared/interfaces.js'; import type { FetchHistoryOptions, FetchHistoryResult, NormalizedMessage } from '@/shared/types.js'; import { createNormalizedMessage, generateMessageId, readObjectRecord } from '@/shared/utils.js'; @@ -57,7 +57,7 @@ function readRawProviderMessage(raw: unknown): RawProviderMessage | null { export class ClaudeProvider extends AbstractProvider { readonly mcp = new ClaudeMcpProvider(); - readonly auth: IProviderAuthRuntime = new ClaudeAuthProvider(); + readonly auth: IProviderAuth = new ClaudeProviderAuth(); constructor() { super('claude'); diff --git a/server/modules/providers/list/codex/codex-auth.provider.ts b/server/modules/providers/list/codex/codex-auth.provider.ts index 1e7790c8..e938e70d 100644 --- a/server/modules/providers/list/codex/codex-auth.provider.ts +++ b/server/modules/providers/list/codex/codex-auth.provider.ts @@ -4,7 +4,7 @@ import path from 'node:path'; import spawn from 'cross-spawn'; -import type { IProviderAuthRuntime } from '@/shared/interfaces.js'; +import type { IProviderAuth } from '@/shared/interfaces.js'; import type { ProviderAuthStatus } from '@/shared/types.js'; import { readObjectRecord, readOptionalString } from '@/shared/utils.js'; @@ -15,7 +15,7 @@ type CodexCredentialsStatus = { error?: string; }; -export class CodexAuthProvider implements IProviderAuthRuntime { +export class CodexProviderAuth implements IProviderAuth { /** * Checks whether Codex is available to the server runtime. */ diff --git a/server/modules/providers/list/codex/codex.provider.ts b/server/modules/providers/list/codex/codex.provider.ts index a9a0a4b4..cbd4fb4f 100644 --- a/server/modules/providers/list/codex/codex.provider.ts +++ b/server/modules/providers/list/codex/codex.provider.ts @@ -1,8 +1,8 @@ import { getCodexSessionMessages } from '@/projects.js'; import { AbstractProvider } from '@/modules/providers/shared/base/abstract.provider.js'; -import { CodexAuthProvider } from '@/modules/providers/list/codex/codex-auth.provider.js'; +import { CodexProviderAuth } from '@/modules/providers/list/codex/codex-auth.provider.js'; import { CodexMcpProvider } from '@/modules/providers/list/codex/codex-mcp.provider.js'; -import type { IProviderAuthRuntime } from '@/shared/interfaces.js'; +import type { IProviderAuth } from '@/shared/interfaces.js'; import type { FetchHistoryOptions, FetchHistoryResult, NormalizedMessage } from '@/shared/types.js'; import { createNormalizedMessage, generateMessageId, readObjectRecord } from '@/shared/utils.js'; @@ -31,7 +31,7 @@ function readRawProviderMessage(raw: unknown): RawProviderMessage | null { export class CodexProvider extends AbstractProvider { readonly mcp = new CodexMcpProvider(); - readonly auth: IProviderAuthRuntime = new CodexAuthProvider(); + readonly auth: IProviderAuth = new CodexProviderAuth(); constructor() { super('codex'); diff --git a/server/modules/providers/list/cursor/cursor-auth.provider.ts b/server/modules/providers/list/cursor/cursor-auth.provider.ts index 764bff5e..7cc035a9 100644 --- a/server/modules/providers/list/cursor/cursor-auth.provider.ts +++ b/server/modules/providers/list/cursor/cursor-auth.provider.ts @@ -1,6 +1,6 @@ import spawn from 'cross-spawn'; -import type { IProviderAuthRuntime } from '@/shared/interfaces.js'; +import type { IProviderAuth } from '@/shared/interfaces.js'; import type { ProviderAuthStatus } from '@/shared/types.js'; type CursorLoginStatus = { @@ -10,7 +10,7 @@ type CursorLoginStatus = { error?: string; }; -export class CursorAuthProvider implements IProviderAuthRuntime { +export class CursorProviderAuth implements IProviderAuth { /** * Checks whether the cursor-agent CLI is available on this host. */ diff --git a/server/modules/providers/list/cursor/cursor.provider.ts b/server/modules/providers/list/cursor/cursor.provider.ts index 2c727574..6257d145 100644 --- a/server/modules/providers/list/cursor/cursor.provider.ts +++ b/server/modules/providers/list/cursor/cursor.provider.ts @@ -3,9 +3,9 @@ import os from 'node:os'; import path from 'node:path'; import { AbstractProvider } from '@/modules/providers/shared/base/abstract.provider.js'; -import { CursorAuthProvider } from '@/modules/providers/list/cursor/cursor-auth.provider.js'; +import { CursorProviderAuth } from '@/modules/providers/list/cursor/cursor-auth.provider.js'; import { CursorMcpProvider } from '@/modules/providers/list/cursor/cursor-mcp.provider.js'; -import type { IProviderAuthRuntime } from '@/shared/interfaces.js'; +import type { IProviderAuth } from '@/shared/interfaces.js'; import type { FetchHistoryOptions, FetchHistoryResult, NormalizedMessage } from '@/shared/types.js'; import { createNormalizedMessage, generateMessageId, readObjectRecord } from '@/shared/utils.js'; @@ -36,7 +36,7 @@ function readRawProviderMessage(raw: unknown): RawProviderMessage | null { export class CursorProvider extends AbstractProvider { readonly mcp = new CursorMcpProvider(); - readonly auth: IProviderAuthRuntime = new CursorAuthProvider(); + readonly auth: IProviderAuth = new CursorProviderAuth(); constructor() { super('cursor'); diff --git a/server/modules/providers/list/gemini/gemini-auth.provider.ts b/server/modules/providers/list/gemini/gemini-auth.provider.ts index 637f3bdc..60b0749e 100644 --- a/server/modules/providers/list/gemini/gemini-auth.provider.ts +++ b/server/modules/providers/list/gemini/gemini-auth.provider.ts @@ -4,7 +4,7 @@ import path from 'node:path'; import spawn from 'cross-spawn'; -import type { IProviderAuthRuntime } from '@/shared/interfaces.js'; +import type { IProviderAuth } from '@/shared/interfaces.js'; import type { ProviderAuthStatus } from '@/shared/types.js'; import { readObjectRecord, readOptionalString } from '@/shared/utils.js'; @@ -15,7 +15,7 @@ type GeminiCredentialsStatus = { error?: string; }; -export class GeminiAuthProvider implements IProviderAuthRuntime { +export class GeminiProviderAuth implements IProviderAuth { /** * Checks whether the Gemini CLI is available on this host. */ diff --git a/server/modules/providers/list/gemini/gemini.provider.ts b/server/modules/providers/list/gemini/gemini.provider.ts index 78e3f931..b5ca3ccf 100644 --- a/server/modules/providers/list/gemini/gemini.provider.ts +++ b/server/modules/providers/list/gemini/gemini.provider.ts @@ -1,9 +1,9 @@ import sessionManager from '@/sessionManager.js'; import { getGeminiCliSessionMessages } from '@/projects.js'; import { AbstractProvider } from '@/modules/providers/shared/base/abstract.provider.js'; -import { GeminiAuthProvider } from '@/modules/providers/list/gemini/gemini-auth.provider.js'; +import { GeminiProviderAuth } from '@/modules/providers/list/gemini/gemini-auth.provider.js'; import { GeminiMcpProvider } from '@/modules/providers/list/gemini/gemini-mcp.provider.js'; -import type { IProviderAuthRuntime } from '@/shared/interfaces.js'; +import type { IProviderAuth } from '@/shared/interfaces.js'; import type { FetchHistoryOptions, FetchHistoryResult, NormalizedMessage } from '@/shared/types.js'; import { createNormalizedMessage, generateMessageId, readObjectRecord } from '@/shared/utils.js'; @@ -17,7 +17,7 @@ function readRawProviderMessage(raw: unknown): RawProviderMessage | null { export class GeminiProvider extends AbstractProvider { readonly mcp = new GeminiMcpProvider(); - readonly auth: IProviderAuthRuntime = new GeminiAuthProvider(); + readonly auth: IProviderAuth = new GeminiProviderAuth(); constructor() { super('gemini'); diff --git a/server/modules/providers/shared/base/abstract.provider.ts b/server/modules/providers/shared/base/abstract.provider.ts index 6f76af8c..db5ff1f9 100644 --- a/server/modules/providers/shared/base/abstract.provider.ts +++ b/server/modules/providers/shared/base/abstract.provider.ts @@ -1,4 +1,4 @@ -import type { IProvider, IProviderAuthRuntime, IProviderMcpRuntime } from '@/shared/interfaces.js'; +import type { IProvider, IProviderAuth, IProviderMcp } from '@/shared/interfaces.js'; import type { FetchHistoryOptions, FetchHistoryResult, @@ -9,14 +9,14 @@ import type { /** * Shared provider base. * - * Concrete providers must expose auth/MCP runtimes and implement message + * Concrete providers must expose auth/MCP handlers and implement message * normalization/history loading because those behaviors depend on native * SDK/CLI formats. */ export abstract class AbstractProvider implements IProvider { readonly id: LLMProvider; - abstract readonly mcp: IProviderMcpRuntime; - abstract readonly auth: IProviderAuthRuntime; + abstract readonly mcp: IProviderMcp; + abstract readonly auth: IProviderAuth; protected constructor(id: LLMProvider) { this.id = id; diff --git a/server/modules/providers/shared/mcp/mcp.provider.ts b/server/modules/providers/shared/mcp/mcp.provider.ts index dc2808d9..46c00a56 100644 --- a/server/modules/providers/shared/mcp/mcp.provider.ts +++ b/server/modules/providers/shared/mcp/mcp.provider.ts @@ -3,7 +3,7 @@ import path from 'node:path'; import spawn from 'cross-spawn'; -import type { IProviderMcpRuntime } from '@/shared/interfaces.js'; +import type { IProviderMcp } from '@/shared/interfaces.js'; import type { LLMProvider, McpScope, McpTransport, ProviderMcpServer, UpsertProviderMcpServerInput } from '@/shared/types.js'; import { AppError } from '@/shared/utils.js'; @@ -93,7 +93,7 @@ const runHttpServerProbe = async ( /** * Shared MCP provider for provider-specific config readers/writers. */ -export abstract class McpProvider implements IProviderMcpRuntime { +export abstract class McpProvider implements IProviderMcp { protected readonly provider: LLMProvider; protected readonly supportedScopes: McpScope[]; protected readonly supportedTransports: McpTransport[]; diff --git a/server/shared/interfaces.ts b/server/shared/interfaces.ts index 9f3cf80d..e095b0a8 100644 --- a/server/shared/interfaces.ts +++ b/server/shared/interfaces.ts @@ -13,13 +13,13 @@ import type { /** * Main provider contract for CLI and SDK integrations. * - * Each concrete provider owns its MCP/auth runtimes plus the provider-specific + * Each concrete provider owns its MCP/auth handlers plus the provider-specific * logic for converting native events/history into the app's normalized shape. */ export interface IProvider { readonly id: LLMProvider; - readonly mcp: IProviderMcpRuntime; - readonly auth: IProviderAuthRuntime; + readonly mcp: IProviderMcp; + readonly auth: IProviderAuth; normalizeMessage(raw: unknown, sessionId: string | null): NormalizedMessage[]; fetchHistory(sessionId: string, options?: FetchHistoryOptions): Promise; @@ -27,19 +27,19 @@ export interface IProvider { /** - * Auth runtime contract for one provider. + * Auth contract for one provider. */ -export interface IProviderAuthRuntime { +export interface IProviderAuth { /** - * Checks whether the provider runtime is installed and has usable credentials. + * Checks whether the provider is installed and has usable credentials. */ getStatus(): Promise; } /** - * MCP runtime contract for one provider. + * MCP contract for one provider. */ -export interface IProviderMcpRuntime { +export interface IProviderMcp { listServers(options?: { workspacePath?: string }): Promise>; listServersForScope(scope: McpScope, options?: { workspacePath?: string }): Promise; upsertServer(input: UpsertProviderMcpServerInput): Promise;