/** * Extension registration types. * * Provider, flag, and shortcut registration contracts. */ export interface ProviderConfig { name: string; baseUrl?: string; apiKey?: string; api: ProviderApiType; models?: ModelConfig[]; oauth?: OAuthConfig; } export type ProviderApiType = 'openai-completions' | 'anthropic-messages' | 'google-generative' | 'ollama' | 'vllm' | 'custom'; export interface ModelConfig { id: string; name: string; contextWindow: number; maxTokens?: number; cost?: { input: number; output: number; }; } export interface OAuthConfig { name: string; login: (callbacks: OAuthCallbacks) => Promise; refreshToken: (credentials: OAuthCredentials) => Promise; getApiKey: (credentials: OAuthCredentials) => Promise; } export interface OAuthCallbacks { onSuccess: (credentials: OAuthCredentials) => void; onError: (error: Error) => void; } export interface OAuthCredentials { access: string; refresh?: string; expiresAt?: number; } export interface FlagConfig { type: 'boolean' | 'string'; default?: FlagValue; description: string; aliases?: string[]; } export type FlagValue = boolean | string | undefined; export interface ShortcutConfig { description: string; handler: ShortcutHandler; } export type ShortcutHandler = (context: unknown) => void | Promise;