export interface HttpClientLike { get( url: string, opts?: { headers?: Record; params?: Record; }, ): Promise; } export interface ToolTierInfo { tier: number; deferRecommended: boolean; category: string; } export interface ProviderMetadata { name: string; description: string; exposeAsTool: boolean; toolNames: string[]; supportsLibrarySearch: boolean; requiredEnvVars: string[]; optionalEnvVars: string[]; toolTiers: Record; } export interface ProviderResult { success: boolean; data?: any; error?: string | null; providerName: string; } export interface ToolDefinition { name: string; label: string; description: string; promptSnippet: string; promptGuidelines?: string[]; parameters: unknown; execute: (...args: any[]) => Promise | any; } export type HttpClientFactory = () => Promise; export interface Provider { getMetadata(): ProviderMetadata; searchLibrary(library: string, limit?: number): Promise; getTools(): Record; } export abstract class BaseProvider implements Provider { protected readonly _httpClientFactory: HttpClientFactory; constructor(httpClientFactory: HttpClientFactory) { this._httpClientFactory = httpClientFactory; } abstract getMetadata(): ProviderMetadata; abstract searchLibrary(library: string, limit?: number): Promise; getTools(): Record { return {}; } protected async httpClient(): Promise { return await this._httpClientFactory(); } }