export type AuthStrategy = 'header' | 'bearer' | 'query' | 'oauth2'; export interface ConnectorField { name: string; label: string; type: 'password' | 'text'; } export interface ConnectorOnboarding { url: string; steps: string[]; } export interface ConnectorDefinition { id: string; name: string; category: string; description: string; baseUrl: string; authStrategy: AuthStrategy; authKey: string; fields: ConnectorField[]; /** Usage hints shown to the LLM — recommended endpoints, default settings, gotchas. */ hints?: string; /** Onboarding instructions — signup URL and steps to get an API key. */ onboarding?: ConnectorOnboarding; /** OAuth2: Authorization endpoint URL. */ authorizationUrl?: string; /** OAuth2: Token exchange endpoint URL. */ tokenUrl?: string; /** OAuth2: Requested scopes. */ scopes?: string[]; /** OAuth2: Use PKCE (RFC 7636) on the authorization-code flow. Required by Buffer, Canva, etc. */ usePkce?: boolean; /** OAuth2: Separator used to join scopes in the authorize request. Defaults to comma; RFC 6749 mandates space. */ scopeSeparator?: ' ' | ','; } export interface ConnectorJson { id: string; name: string; category: string; description: string; baseUrl: string; authStrategy: AuthStrategy; authKey: string; fields: ConnectorField[]; hints?: string[]; onboarding?: ConnectorOnboarding; authorizationUrl?: string; tokenUrl?: string; scopes?: string[]; usePkce?: boolean; scopeSeparator?: ' ' | ','; } export interface ConnectorConfig { apiKey: string; enabled: boolean; } export interface ConnectorOAuthConfig extends ConnectorConfig { accessToken?: string; refreshToken?: string; expiresAt?: number; userId?: string; accountName?: string; clientId?: string; clientSecret?: string; /** Stored between /authorize and /callback for PKCE-enabled connectors. Cleared after callback. */ codeVerifier?: string; } export type ConnectorsConfig = Record; export interface ConnectorSummary { id: string; name: string; category: string; description: string; configured: boolean; enabled: boolean; } export interface ConnectorDetail extends ConnectorDefinition { configured: boolean; enabled: boolean; hasKey: boolean; connected?: boolean; accountName?: string; userId?: string; } export interface ConnectorCallRequest { connector: string; method: string; path: string; headers?: Record; body?: unknown; query?: Record; }