mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-04-19 03:51:31 +00:00
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.
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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[];
|
||||
|
||||
Reference in New Issue
Block a user