import type { Room } from '@livekit/rtc-node';
import { type APIConnectOptions } from '../types.js';
import type { AgentSession } from '../voice/agent_session.js';
import { AvatarSession as BaseAvatarSession } from '../voice/avatar/index.js';
export interface LemonSliceOptions {
    /** Appearance source; mutually exclusive with a model-string agent id. */
    image_url?: string;
    /** Speaking prompt, mapped to the provider's agent_prompt. */
    prompt?: string;
    /** Idle prompt, mapped to the provider's agent_idle_prompt. */
    idle_prompt?: string;
    /** Provider idle timeout in seconds; the gateway clamps it. */
    idle_timeout?: number;
    [key: string]: unknown;
}
export type AvatarModel = 'lemonslice' | `lemonslice/${string}` | (string & NonNullable<unknown>);
export interface AvatarSessionOptions {
    /** `"<provider>"` or `"<provider>/<avatar_id>"`, e.g. `"lemonslice/agent_abc"`. */
    model: AvatarModel;
    /** Room identity for the avatar worker. Defaults to `"<provider>-inference-avatar"`. */
    avatarParticipantIdentity?: string;
    /** Display name for the avatar worker. */
    avatarParticipantName?: string;
    /** Provider-specific options. For LemonSlice, use {@link LemonSliceOptions}. */
    extraKwargs?: LemonSliceOptions | Record<string, unknown>;
    /** Inference gateway base URL. Defaults to the environment's gateway. */
    baseURL?: string;
    /** Gateway API key. Falls back to LIVEKIT_INFERENCE_API_KEY then LIVEKIT_API_KEY. */
    apiKey?: string;
    /** Gateway API secret. Falls back to LIVEKIT_INFERENCE_API_SECRET then LIVEKIT_API_SECRET. */
    apiSecret?: string;
    /** Optional fetch implementation, primarily for tests. */
    fetch?: typeof fetch;
    /** Retry and whole-request timeout options for gateway calls. */
    connOptions?: APIConnectOptions;
}
export interface AvatarSessionStartOptions {
    /** LiveKit server URL. Falls back to LIVEKIT_URL. */
    livekitUrl?: string;
    /** LiveKit API key for resolving room SID when needed. Falls back to LIVEKIT_API_KEY. */
    livekitApiKey?: string;
    /** LiveKit API secret for resolving room SID when needed. Falls back to LIVEKIT_API_SECRET. */
    livekitApiSecret?: string;
}
type CreateSessionResponse = {
    session_id?: string;
    provider_session_id?: string;
    terminate_token?: string;
    /** The identity the gateway minted the worker token for; authoritative over the local value. */
    avatar_identity?: string;
    sample_rate?: number;
};
export declare function parseAvatarModel(model: string): [provider: string, avatarId: string | undefined];
/**
 * An avatar session provisioned through LiveKit Inference.
 *
 * Unlike BYOK avatar plugins, this calls the LiveKit Inference gateway with gateway
 * credentials and lets the gateway mint the avatar worker's room token. Media and RPC
 * still flow in-room over DataStream, exactly as the BYOK plugins do.
 */
export declare class AvatarSession extends BaseAvatarSession {
    private readonly logger;
    private readonly providerName;
    private readonly avatarId?;
    private readonly extraKwargs;
    private readonly connOptions;
    private readonly fetchFn;
    private readonly baseURL;
    private readonly apiKey;
    private readonly apiSecret;
    private readonly avatarParticipantIdentity;
    private readonly avatarParticipantName;
    private readonly createIdempotencyKey;
    private _started;
    private _sessionId;
    private _providerSessionId;
    private _terminateToken;
    constructor(options: AvatarSessionOptions);
    get avatarIdentity(): string;
    get provider(): string;
    /** The gateway-generated avatar session id, available after start(). */
    get sessionId(): string | null;
    /** The provider's own session id, available after start(). */
    get providerSessionId(): string | null;
    start(agentSession: AgentSession, room: Room, options?: AvatarSessionStartOptions): Promise<void>;
    aclose(): Promise<void>;
    /** @internal */
    _createSession({ roomName, roomSid, livekitUrl, agentIdentity, }: {
        roomName: string;
        roomSid: string;
        livekitUrl: string;
        agentIdentity: string;
    }): Promise<CreateSessionResponse>;
    /** @internal */
    _terminateSession(providerSessionId: string, terminateToken: string): Promise<void>;
    private authHeaders;
    /**
     * POST with the shared retry/backoff policy (up to `connOptions.maxRetry` retries).
     * Rethrows immediately on a non-retryable error, and prefers a gateway `Retry-After`
     * hint over the default backoff interval.
     */
    private postJsonRetrying;
    private postJson;
}
export {};
//# sourceMappingURL=avatar.d.ts.map