/**
 * @module auto-accept
 * Auto-accept invite on first SDK call for zero-click onboarding.
 *
 * Enables services to accept invites automatically without explicit
 * accept commands. Invite code comes from environment variable.
 *
 * @example
 * ```ts
 * // Environment: XBIND_INVITE_CODE=XBD-abc123, XBIND_AUTO_ACCEPT=true
 *
 * // Auto-accept happens on first Agent method call:
 * const agent = Agent.lazy({ name: 'my-service' });
 * await agent.send({ to: partnerDid, payload: data, scope: 'test' });
 * // ↑ Invite auto-accepted before send()
 * ```
 */
import { Result } from '@private.me/shared';
import type { Invite } from './invite.js';
import type { ServiceInfo } from './discovery.js';
import type { TrustRegistry } from './trust-registry.js';
/**
 * Auto-accept configuration options.
 */
export interface AutoAcceptConfig {
    /** Invite code (e.g., 'XBD-abc123') or URL. If omitted, reads from XBIND_INVITE_CODE env var. */
    inviteCode?: string;
    /** Whether to enable auto-accept. Default: true if XBIND_INVITE_CODE is set. */
    enabled?: boolean;
    /** Custom invite API URL (default: https://xbind.to). */
    inviteApiUrl?: string;
    /** Custom trust registry (default: auto-detect from invite or use memory registry). */
    registry?: TrustRegistry;
}
/**
 * Auto-accept error codes.
 */
export declare enum AutoAcceptErrorCode {
    NO_INVITE_CODE = "AUTO_ACCEPT_NO_INVITE_CODE",
    DISABLED = "AUTO_ACCEPT_DISABLED",
    INVITE_FAILED = "AUTO_ACCEPT_INVITE_FAILED",
    REGISTRY_SETUP_FAILED = "AUTO_ACCEPT_REGISTRY_SETUP_FAILED"
}
/**
 * Auto-accept error.
 */
export interface AutoAcceptError {
    code: AutoAcceptErrorCode;
    message: string;
    hint?: string;
    cause?: unknown;
}
/**
 * Result of auto-accept operation.
 */
export interface AcceptDetails {
    /** The invite that was accepted. */
    invite: Invite;
    /** Service info of the inviter. */
    from: ServiceInfo;
    /** Trust registry URL (if provided in invite). */
    registryUrl?: string;
    /** Whether registry was auto-configured. */
    registryAutoconfigured: boolean;
}
/**
 * Auto-accept an invite on first SDK call.
 *
 * Reads invite code from config or environment variable `XBIND_INVITE_CODE`.
 * If `XBIND_AUTO_ACCEPT` is false, returns error with code DISABLED.
 *
 * When successful:
 * 1. Fetches invite details from invite server
 * 2. Adds inviter to trust registry
 * 3. Auto-detects registry endpoint from invite metadata (if present)
 * 4. Marks invite as accepted
 *
 * This is called internally by `Agent.lazy()` before the first send/receive.
 *
 * @param config - Auto-accept configuration
 * @param acceptorInfo - Acceptor service info (DID, endpoint, publicKey)
 * @returns Accept details or error
 *
 * @example
 * ```ts
 * // Manual usage (typically called internally by Agent.lazy):
 * const result = await autoAcceptInvite(
 *   { inviteCode: 'XBD-abc123' },
 *   {
 *     name: 'my-service',
 *     did: 'did:key:z6Mk...',
 *     endpoint: 'https://my-service.com',
 *     publicKey: '...',
 *   }
 * );
 *
 * if (result.ok) {
 *   console.log('Auto-accepted invite from:', result.value.from.name);
 * }
 * ```
 */
export declare function autoAcceptInvite(config: AutoAcceptConfig, acceptorInfo: ServiceInfo): Promise<Result<AcceptDetails, AutoAcceptError>>;
