import { type ConnectPolicy, type ConnectStore, type ConnectSubject, type ConnectionAudience, type ConnectionBindingAttributes, type ConnectionLinkStore, type ConnectionLink, type ConnectionLinkListFilter, type ConnectionOwner, type ConnectionRecord, type ConnectionSetupSession, type ConnectionSetupSessionStore, type ConnectorProviderDefinition, type McpConnectionAuth, type McpConnectionTransport, type McpOAuthClientInformation, type McpOAuthClientMode, type McpOAuthInspection, type OAuthClientResolver, type ResolvedConnectionCredential, type RuntimeToken } from "@polpo-ai/connect"; import { type ConnectionRequest, type ConnectionResponse } from "@polpo-ai/core"; import { type ConnectionSecretStore, type TokenRefreshCoordinator } from "./secrets.js"; import { type McpOAuthClientRegistrationStore } from "./mcp-oauth.js"; export interface CreateConnectServiceOptions { providers: readonly ConnectorProviderDefinition[]; store: ConnectStore; secrets: ConnectionSecretStore; policy?: ConnectPolicy; fetch?: typeof fetch; now?: () => Date; tokenRefreshSkewMs?: number; oauthStateTtlMs?: number; allowInsecureLocalMcpUrls?: boolean; refreshCoordinator?: TokenRefreshCoordinator; resolveHostname?: (hostname: string) => Promise; oauthClients?: OAuthClientResolver; setupSessions?: ConnectionSetupSessionStore; links?: ConnectionLinkStore; setupSessionTtlMs?: number; allowedReturnUrlOrigins?: readonly string[]; mcpOAuthRegistrations?: McpOAuthClientRegistrationStore; mcpOAuthCallbackClaimTtlMs?: number; } export interface CreateApiKeyConnectionInput { providerId: string; apiKey: string; scopes?: string[]; subject?: ConnectSubject; name?: string; projectId?: string; orgId?: string; metadata?: Record; secretMetadata?: Record; } export interface CreateMcpConnectionInput { providerId?: string; name?: string; url: string; transport?: McpConnectionTransport; auth?: McpConnectionAuth; apiKey?: string; bearerToken?: string; scopes?: string[]; subject?: ConnectSubject; projectId?: string; orgId?: string; metadata?: Record; } export interface StartOAuthInput { providerId: string; scopes?: string[]; subject?: ConnectionOwner; redirectUri: string; projectId?: string; orgId?: string; connectionName?: string; metadata?: Record; oauthClientMode?: "managed" | "customer" | "instance"; } export interface StartOAuthResult { authorizationUrl: string; state: string; expiresAt: string; } export interface InspectMcpOAuthConnectionInput { url: string; transport?: McpConnectionTransport; } export interface StartMcpOAuthInput { providerId?: string; name?: string; url: string; transport?: McpConnectionTransport; scopes?: string[]; subject?: ConnectionOwner; projectId?: string; orgId?: string; redirectUri: string; mode: McpOAuthClientMode; clientName?: string; clientUri?: string; clientMetadataUrl?: string; preRegisteredClient?: McpOAuthClientInformation; metadata?: Record; } export interface CompleteOAuthInput { state: string; code?: string; error?: string; errorDescription?: string; } export interface GetTokenInput { connectionId: string; scopes?: string[]; subject?: ConnectSubject; actionId?: string; forceRefresh?: boolean; } export type ResolveConnectionCredentialInput = GetTokenInput; export interface RevokeConnectionInput { connectionId: string; } export interface ConnectionGatewayRequestInput extends GetTokenInput { request: ConnectionRequest; signal?: AbortSignal; } export interface CreateConnectionSetupSessionInput { providerId: string; projectId: string; orgId?: string; audience: ConnectionAudience; subject: ConnectionOwner; binding?: ConnectionBindingAttributes; scopes?: string[]; returnUrl: string; oauthClientMode: "managed" | "customer" | "instance"; metadata?: Record; } export interface StartOAuthSetupInput { setupSessionId: string; } export interface LinkConnectionInput { connectionId: string; projectId: string; } export interface UnlinkConnectionInput { linkId: string; } export interface ConnectService { listProviders(): ConnectorProviderDefinition[]; listConnections(filter?: Parameters[0]): Promise; listConnectionLinks(filter?: ConnectionLinkListFilter): Promise; linkConnection(input: LinkConnectionInput): Promise; unlinkConnection(input: UnlinkConnectionInput): Promise; createApiKeyConnection(input: CreateApiKeyConnectionInput): Promise; createMcpConnection(input: CreateMcpConnectionInput): Promise; inspectMcpOAuth(input: InspectMcpOAuthConnectionInput): Promise; startMcpOAuth(input: StartMcpOAuthInput): Promise; completeMcpOAuth(input: CompleteOAuthInput): Promise; createSetupSession(input: CreateConnectionSetupSessionInput): Promise; startOAuthSetup(input: StartOAuthSetupInput): Promise; startOAuth(input: StartOAuthInput): Promise; completeOAuth(input: CompleteOAuthInput): Promise; resolveCredential(input: ResolveConnectionCredentialInput): Promise; getToken(input: GetTokenInput): Promise; request(input: ConnectionGatewayRequestInput): Promise>; revokeConnection(input: RevokeConnectionInput): Promise; } export declare function createConnectService(options: CreateConnectServiceOptions): ConnectService; //# sourceMappingURL=service.d.ts.map