mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-04-17 19:11:33 +00:00
# Conflicts: # server/claude-sdk.js # server/cursor-cli.js # server/gemini-cli.js # server/openai-codex.js # server/providers/cursor/adapter.js # server/providers/registry.js # server/providers/types.js # server/routes/cli-auth.js # server/routes/cursor.js
27 lines
936 B
TypeScript
27 lines
936 B
TypeScript
import { providerRegistry } from '@/modules/providers/provider.registry.js';
|
|
import type { LLMProvider, ProviderAuthStatus } from '@/shared/types.js';
|
|
|
|
export const providerAuthService = {
|
|
/**
|
|
* Resolves a provider and returns its installation/authentication status.
|
|
*/
|
|
async getProviderAuthStatus(providerName: string): Promise<ProviderAuthStatus> {
|
|
const provider = providerRegistry.resolveProvider(providerName);
|
|
return provider.auth.getStatus();
|
|
},
|
|
|
|
/**
|
|
* Returns whether a provider runtime appears installed.
|
|
* Falls back to true if status lookup itself fails so callers preserve the
|
|
* original runtime error instead of replacing it with a status-check failure.
|
|
*/
|
|
async isProviderInstalled(providerName: LLMProvider): Promise<boolean> {
|
|
try {
|
|
const status = await this.getProviderAuthStatus(providerName);
|
|
return status.installed;
|
|
} catch {
|
|
return true;
|
|
}
|
|
},
|
|
};
|