/**
 * @module lazy-init
 * Lazy agent initialization for zero-click onboarding.
 *
 * Defers invite acceptance and identity generation until first
 * send/receive call. Enables: `Agent.lazy({ name: 'my-service' })`
 * with no async/await at construction time.
 *
 * @example
 * ```ts
 * // Environment: XBIND_INVITE_CODE=XBD-abc123
 *
 * // Old way (explicit):
 * const agent = await Agent.create({ name: 'my-service', registry, transport });
 *
 * // New way (lazy):
 * const agent = Agent.lazy({ name: 'my-service' });
 * // No await, no async — agent is constructed synchronously.
 * // Invite auto-accepts on first send/receive:
 * await agent.send({ to: partnerDid, payload: data, scope: 'test' });
 * ```
 */
import { Result } from '@private.me/shared';
import { Agent } from './agent.js';
import type { AgentError, AgentSendOptions, AgentMessage, AgentReceiveOptions } from './agent.js';
import type { AnyTransportEnvelope } from './envelope.js';
import type { AutoAcceptConfig } from './auto-accept.js';
import type { TrustRegistry } from './trust-registry.js';
import type { XailTransportAdapter } from './transport.js';
/**
 * Lazy agent configuration options.
 */
export interface LazyAgentConfig {
    /** Service name (required). */
    name: string;
    /** Invite code or URL. If omitted, reads from XBIND_INVITE_CODE. */
    inviteCode?: string;
    /** Auto-accept config (optional). */
    autoAccept?: AutoAcceptConfig;
    /** Custom trust registry (optional, auto-configured from invite if omitted). */
    registry?: TrustRegistry;
    /** Custom transport adapter (optional, auto-configured from invite if omitted). */
    transport?: XailTransportAdapter | XailTransportAdapter[];
    /** Enable post-quantum signatures (default: false). */
    postQuantumSig?: boolean;
    /** Enable Xchange mode support (default: false). */
    xchange?: boolean;
    /** Service endpoint URL (required for invite acceptance). */
    endpoint?: string;
}
/**
 * Lazy agent error codes.
 */
export declare enum LazyAgentErrorCode {
    INIT_FAILED = "LAZY_AGENT_INIT_FAILED",
    AUTO_ACCEPT_FAILED = "LAZY_AGENT_AUTO_ACCEPT_FAILED",
    AGENT_CREATION_FAILED = "LAZY_AGENT_AGENT_CREATION_FAILED"
}
/**
 * Lazy agent error.
 */
export interface LazyAgentError {
    code: LazyAgentErrorCode;
    message: string;
    hint?: string;
    cause?: unknown;
}
/**
 * Lazy agent wrapper.
 *
 * Proxies all Agent methods and initializes on first call.
 * Caches the initialized agent for subsequent calls.
 */
export declare class LazyAgent {
    private config;
    private agent;
    private initPromise;
    private lastError;
    private _did;
    private _identity;
    constructor(config: LazyAgentConfig, identity: import('./identity.js').AgentIdentity);
    /**
     * Get the agent's DID.
     *
     * Returns the pre-generated DID immediately (no initialization required).
     * This allows accessing `agent.did` right after `Agent.lazy()` returns.
     */
    get did(): string;
    /**
     * Check if agent is ready (initialized).
     */
    isReady(): boolean;
    /**
     * Get last initialization error (if any).
     */
    getLastError(): LazyAgentError | null;
    /**
     * Ensure agent is initialized.
     *
     * Can be called explicitly to trigger init before first send/receive.
     * Safe to call multiple times — subsequent calls return cached agent.
     *
     * @returns Agent instance or error
     */
    ensureInitialized(): Promise<Result<Agent, AgentError>>;
    /**
     * Internal initialization logic.
     *
     * 1. Auto-accept invite (if XBIND_INVITE_CODE set)
     * 2. Create agent identity
     * 3. Configure registry and transport
     * 4. Return initialized agent
     */
    private initialize;
    /**
     * Send a message (proxied to underlying agent).
     *
     * Automatically initializes agent on first call.
     */
    send(opts: AgentSendOptions): Promise<Result<void, AgentError>>;
    /**
     * Receive a message (proxied to underlying agent).
     *
     * Automatically initializes agent on first call.
     */
    receive(envelope: AnyTransportEnvelope, opts?: AgentReceiveOptions): Promise<Result<AgentMessage, AgentError>>;
    /**
     * Receive a split-channel share (proxied to underlying agent).
     *
     * Automatically initializes agent on first call.
     */
    receiveSplitShare(envelope: AnyTransportEnvelope): Promise<Result<AgentMessage | null, AgentError>>;
    /**
     * Get environment variable value.
     *
     * @param key - Environment variable name
     * @returns Environment variable value or empty string
     */
    private getEnv;
    /**
     * Export the underlying agent (for advanced use cases).
     *
     * Throws if agent is not initialized.
     */
    getAgent(): Agent;
}
/**
 * Create a lazy agent that initializes on first use.
 *
 * Extension method for Agent class. Adds `Agent.lazy()` factory.
 *
 * @param config - Lazy agent configuration
 * @returns Lazy agent wrapper
 *
 * @example
 * ```ts
 * // Environment: XBIND_INVITE_CODE=XBD-abc123
 *
 * const agent = await Agent.lazy({ name: 'my-service' });
 *
 * // DID is available immediately:
 * console.log(agent.did); // did:key:z6Mk...
 *
 * // Full initialization happens on first send:
 * await agent.send({
 *   to: 'did:key:z6Mk...',
 *   payload: { action: 'test' },
 *   scope: 'test',
 * });
 * ```
 */
export declare function createLazyAgent(config: LazyAgentConfig): Promise<LazyAgent>;
