/**
 * @module connect
 * High-level connect() API for zero-config XBind connections.
 *
 * Enables: `const service = await connect('payments-service')`
 *
 * Combines:
 * - Service discovery
 * - Trust verification
 * - Agent creation
 * - Connection establishment
 *
 * @example
 * ```ts
 * import { connect } from '@private.me/xbind';
 *
 * // Connect by name (uses registry):
 * const payments = await connect('payments-service');
 *
 * // Connect by domain (uses .well-known):
 * const payments = await connect('payments.example.com');
 *
 * // Connect by URL (direct):
 * const payments = await connect('https://api.payments.com/xbind');
 *
 * // Use the connection:
 * await payments.send({
 *   to: payments.did,
 *   payload: { action: 'createCharge', amount: 100 },
 *   scope: 'payments',
 * });
 * ```
 */
import { Result } from '@private.me/shared';
import { Agent } from './agent.js';
import { ServiceDiscovery } from './discovery.js';
import type { ServiceInfo } from './discovery.js';
import type { XailTransportAdapter } from './transport.js';
/**
 * Connect error codes.
 */
export declare enum ConnectErrorCode {
    DISCOVERY_FAILED = "CONNECT_DISCOVERY_FAILED",
    AGENT_CREATION_FAILED = "CONNECT_AGENT_CREATION_FAILED",
    TRUST_VERIFICATION_FAILED = "CONNECT_TRUST_VERIFICATION_FAILED",
    INVALID_SERVICE_INFO = "CONNECT_INVALID_SERVICE_INFO"
}
/**
 * Connect error.
 */
export interface ConnectError {
    code: ConnectErrorCode;
    message: string;
    hint?: string;
    cause?: unknown;
}
/**
 * Connect options.
 */
export interface ConnectOptions {
    /** Custom discovery service (optional) */
    discovery?: ServiceDiscovery;
    /**
     * Custom trust registry (optional).
     *
     * SAFETY: Uses `any` to support extended registry implementations with add() method.
     * The base TrustRegistry interface uses register(), but some implementations
     * may provide an add() convenience method.
     */
    registry?: any;
    /** Custom transport adapter (optional) */
    transport?: XailTransportAdapter;
    /** Agent name (default: auto-generated) */
    name?: string;
    /** Enable split-channel by default (default: false) */
    splitChannel?: boolean;
    /** Enable Xchange mode (default: false) */
    xchange?: boolean;
    /** Enable post-quantum signatures (default: false) */
    postQuantumSig?: boolean;
    /** Agent endpoint URL where it can be reached (optional, for server agents) */
    endpoint?: string;
}
/**
 * Connection result.
 */
export interface Connection {
    /** Agent instance */
    agent: Agent;
    /** Service info */
    service: ServiceInfo;
    /** DID of the service */
    did: string;
    /** Endpoint URL */
    endpoint: string;
}
/**
 * Connect to a service with zero configuration.
 *
 * @param nameOrUrl - Service name, domain, or URL
 * @param options - Connection options
 * @returns Connection or error
 *
 * @example
 * ```ts
 * // Minimal:
 * const connection = await connect('payments-service');
 * if (connection.ok) {
 *   await connection.value.agent.send({
 *     to: connection.value.did,
 *     payload: { action: 'test' },
 *     scope: 'test',
 *   });
 * }
 *
 * // With options:
 * const connection = await connect('payments-service', {
 *   name: 'billing-service',
 *   xchange: true, // Use faster Xchange mode
 *   splitChannel: true, // Use split-channel by default
 * });
 * ```
 */
export declare function connect(nameOrUrl: string, options?: ConnectOptions): Promise<Result<Connection, ConnectError>>;
/**
 * Accept an invite and establish connection.
 *
 * @param inviteUrl - Invite URL
 * @param options - Connection options
 * @returns Connection or error
 *
 * @example
 * ```ts
 * const connection = await acceptInvite('https://xbind.to/invite/abc123', {
 *   name: 'my-service',
 * });
 *
 * if (connection.ok) {
 *   console.log('Connected to:', connection.value.service.name);
 * }
 * ```
 */
export declare function acceptInvite(inviteUrl: string, options?: ConnectOptions): Promise<Result<Connection, ConnectError>>;
