import { type Route, type WireResponse } from './gateway-wire.js'; export declare const GATEWAY_DIR = "crystal-gateway"; export declare const DEFAULT_RELAY_URL = "https://vaultmemoryai.com/relay"; /** Default allowlist: the same read-only surface as the Vault Desktop pair channel. */ export declare const READ_ONLY_TOOLS: ReadonlySet; export type GatewayConfig = { /** Direct gateway origin, or undefined when reached through the relay. */ url: string | undefined; relay: { url: string; hostId: string; } | undefined; certFile: string; keyFile: string; caFile: string; allowWrites: boolean; }; type Environment = Record; /** Returns null when no gateway is configured (local Crystal mode). */ export declare function loadGatewayConfig(home: string, environment?: Environment): GatewayConfig | null; type TlsMaterial = { cert?: string; key?: string; ca?: string; rejectUnauthorized: boolean; }; export type GatewayResponse = WireResponse | { status: number; headers: Record; body: unknown; }; export type GatewayTransport = (input: { path: string; method: 'GET' | 'POST'; body?: string; headers?: Record; tls: TlsMaterial; }) => Promise; /** Provides a fresh Vault access token (relay authentication). */ export type BearerSource = () => Promise; export declare function routeFor(config: Pick, bearer?: BearerSource): Route; /** One TLS session per request, over the configured route. */ export declare function wireTransport(route: Route): GatewayTransport; export type GatewayCallOptions = { transport?: GatewayTransport; bearer?: BearerSource; sleep?: (ms: number) => Promise; approvalTimeoutMs?: number; pollIntervalMs?: number; }; /** Sends one Crystal MCP tools/call through the gateway and returns the JSON-RPC payload. */ export declare function callCrystalThroughGateway(config: GatewayConfig, body: string, toolName: string, options?: GatewayCallOptions): Promise; export type PairSession = { request: (method: 'GET' | 'POST', path: string, body?: string) => Promise; /** DER of the leaf certificate presented in THIS session. */ leaf: Buffer | undefined; servername: string; close: () => void; }; export type PairSessionOpener = (route: Route, tls: TlsMaterial) => Promise; export declare const openPairSession: PairSessionOpener; export type PairOptions = { /** Direct gateway origin. Omit to pair through the relay with `relayHostId`. */ url?: string; relayHostId?: string; relayUrl?: string; bearer?: BearerSource; code: string; caFile?: string; caFingerprint?: string; name?: string; allowWrites?: boolean; openSession?: PairSessionOpener; opensslPath?: string; }; /** Generates the device key and CSR locally, redeems a pairing code and stores the client identity. */ export declare function pairCrystalGateway(home: string, options: PairOptions): Promise<{ url: string | undefined; relay: { url: string; hostId: string; } | undefined; deviceId: string | undefined; roles: unknown; dir: string; }>; export declare function unpairCrystalGateway(home: string): boolean; export declare function gatewayStatus(home: string, environment?: Environment): Record; export {};