import type { Config } from '../../config/schema.js'; import { type McpConnectionErrorCode } from './connection-errors.js'; import { type McpSessionOptions } from './tool-catalog.js'; import type { McpObservation } from './transport.js'; export type McpMetadataState = 'valid' | 'absent' | 'unreachable' | 'invalid' | 'not_checked'; export type McpRecovery = { kind: 'choose_auth' | 'enter_secret' | 'authorize' | 'verify_documented_endpoint' | 'report_blocker' | 'wait'; retryAt?: number; reason?: string; }; export type McpConnectionProbe = { state: 'connected' | 'oauth_required' | 'token_required' | 'auth_unknown' | 'error'; toolCount?: number; error?: string; errorCode?: McpConnectionErrorCode; auth?: { method: 'oauth' | 'unknown' | 'credential'; metadata: McpMetadataState; credential: 'missing' | 'present' | 'rejected' | 'unknown'; }; observation?: Omit; recovery?: McpRecovery; }; export declare function probeMcpConnection(config: Config, workspace: string, serverId: string, options?: McpSessionOptions): Promise; export type McpAuthorization = { id: string; serverId: string; state: 'starting' | 'authorizing' | 'connected' | 'error' | 'cancelled'; authorizationUrl?: string; acceptsRedirect?: boolean; toolCount?: number; error?: string; errorCode?: 'client_registration_failed'; }; /** A UI bridge to native pi's login command; no host-owned OAuth client or token store. */ export declare function startMcpAuthorization(config: Config, workspace: string, serverId: string, owner: string, options?: McpSessionOptions & { authorizationScope?: string; }): McpAuthorization; export declare function getMcpAuthorization(id: string, owner: string, config: Config): McpAuthorization | undefined; export declare function cancelMcpAuthorization(id: string, owner: string): boolean; export declare function submitMcpRedirect(id: string, owner: string, redirectUrl: string, config: Config): boolean;