import type { FetchHistoryOptions, FetchHistoryResult, LLMProvider, McpScope, McpTransport, NormalizedMessage, ProviderAuthStatus, ProviderMcpServer, UpsertProviderMcpServerInput, } from '@/shared/types.js'; /** * Main provider contract for CLI and SDK integrations. * * 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: IProviderMcp; readonly auth: IProviderAuth; normalizeMessage(raw: unknown, sessionId: string | null): NormalizedMessage[]; fetchHistory(sessionId: string, options?: FetchHistoryOptions): Promise; } /** * Auth contract for one provider. */ export interface IProviderAuth { /** * Checks whether the provider is installed and has usable credentials. */ getStatus(): Promise; } /** * MCP contract for one provider. */ export interface IProviderMcp { listServers(options?: { workspacePath?: string }): Promise>; listServersForScope(scope: McpScope, options?: { workspacePath?: string }): Promise; upsertServer(input: UpsertProviderMcpServerInput): Promise; removeServer( input: { name: string; scope?: McpScope; workspacePath?: string }, ): Promise<{ removed: boolean; provider: LLMProvider; name: string; scope: McpScope }>; runServer( input: { name: string; scope?: McpScope; workspacePath?: string }, ): Promise<{ provider: LLMProvider; name: string; scope: McpScope; transport: McpTransport; reachable: boolean; statusCode?: number; error?: string; }>; }