export type TaskType = 'image' | 'video' | 'video-motion-control' | 'video-translate' | 'tts' | 'asr' | 'tryon' | 'voice-clone' | 'avatar-train' | 'doctor-video' | 'voice-preview';
export type TaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled' | 'expired';
export type TaskErrorCode = 'UPSTREAM_MAINTENANCE' | 'CONTENT_POLICY_VIOLATION' | 'INVALID_INPUT' | 'UPSTREAM_TIMEOUT' | 'UPSTREAM_RATE_LIMITED' | 'UPSTREAM_NETWORK' | 'PROVIDER_INSUFFICIENT_CREDITS' | 'PROVIDER_AUTH_FAILED' | 'UPSTREAM_UNKNOWN';
/**
 * High-level error grouping for agent decision-making. Branch on this rather than
 * the granular error_code so adding new codes does not break callers.
 *   retry_safe       — transient provider issue, safe to retry as-is after delay
 *   prompt_problem   — user input rejected; rewrite prompt or replace input before retry
 *   provider_problem — provider-side issue (e.g. account exhausted); do not retry, escalate
 *   unknown          — unrecognized failure; surface to user, do not auto-retry
 */
export type TaskErrorClass = 'retry_safe' | 'prompt_problem' | 'provider_problem' | 'unknown';
export interface TaskResponse {
    task_id: string;
    status: TaskStatus;
    type?: TaskType;
    result_url?: string;
    result_meta?: Record<string, any>;
    error_message?: string;
    error_code?: TaskErrorCode | null;
    error_class?: TaskErrorClass | null;
    retryable?: boolean;
    created_at?: string;
    started_at?: string;
    completed_at?: string;
}
export interface TaskListResponse {
    tasks: TaskResponse[];
    total: number;
}
export interface ApiErrorResponse {
    error: {
        code: string;
        message: string;
        retry_after?: number;
        details?: Record<string, any>;
    };
}
export interface GenImageParams {
    prompt: string;
    input_images?: string[];
    width?: number;
    height?: number;
    seed?: number;
    output_format?: 'jpeg' | 'png';
    safety_tolerance?: number;
    provider?: string;
    model?: string;
    aspectRatio?: string;
    imageSize?: string;
}
export interface GenVideoParams {
    image?: string;
    prompt?: string;
    negative_prompt?: string;
    resolution?: '720P' | '1080P';
    duration?: number;
    prompt_extend?: boolean;
    audio?: boolean;
    audio_url?: string;
    shot_type?: 'single' | 'multi';
    watermark?: boolean;
    seed?: number;
    provider?: string;
    aspectRatio?: string;
    avatar_id?: string;
    voice_id?: string;
    text?: string;
    avatar_style?: string;
    speed?: number;
    emotion?: string;
    bg_color?: string;
    bg_image?: string;
    caption?: boolean;
    title?: string;
}
export interface GenVideoMotionControlParams {
    image: string;
    reference_video: string;
    duration: number;
    character_orientation?: 'image' | 'video';
    prompt?: string;
}
export interface GenVideoTranslateParams {
    video_url: string;
    output_language: string;
    title?: string;
    translate_audio_only?: boolean;
    speaker_num?: number;
    mode?: 'fast' | 'quality';
    callback_id?: string;
    callback_url?: string;
    enable_dynamic_duration?: boolean;
    keep_the_same_format?: boolean;
    brand_voice_id?: string;
    voice_id?: string;
}
export interface GenTTSParams {
    text: string;
    voice?: string;
    /** 'dashscope'(默认,qwen3) | 'minimax'(情感 TTS, speech-02-turbo) */
    provider?: string;
    /** 仅 provider=minimax：happy/sad/angry/fearful/disgusted/surprised/calm/fluent/whisper */
    emotion?: string;
    /** 语速 0.5-2.0（minimax） */
    speed?: number;
    /** minimax language_boost，默认 auto */
    languageBoost?: string;
}
export interface GenASRParams {
    file: string;
    filename: string;
    language?: string;
    model?: string;
}
export interface GenVoiceCloneParams {
    audio_asset_id: string;
    external_id: string;
    voice_name?: string;
}
export interface GenAvatarTrainParams {
    video_asset_id: string;
    external_id: string;
    name?: string;
    training_video_clean_bg?: boolean;
}
export interface GenDoctorVideoParams {
    avatar_id: string;
    voice_id: string;
    text: string;
    title?: string;
}
export interface GenVoicePreviewParams {
    voice_id: string;
    text: string;
    text_type?: 'text' | 'ssml';
}
export interface GenDoctorOnboardParams {
    audio_asset_id: string;
    video_asset_id: string;
    external_id: string;
    training_video_clean_bg?: boolean;
}
export interface DoctorAvatarOnboardResponse {
    external_id: string;
    voice_task_id: string;
    avatar_task_id: string;
    status: 'pending';
}
export interface DoctorAvatarProfile {
    external_id: string;
    heygen_voice_id: string | null;
    voice_status: 'pending' | 'training' | 'complete' | 'failed';
    voice_error: string | null;
    heygen_avatar_group_id: string | null;
    heygen_avatar_look_ids: string[];
    avatar_status: 'pending' | 'training' | 'completed' | 'failed';
    avatar_error: string | null;
    preview_image_url: string | null;
    training_video_clean_bg: boolean;
    consent_status: string | null;
    created_at: string;
    updated_at: string;
}
export interface AssetUploadResponse {
    asset_id: string;
    url: string;
    mime_type: string;
    size_bytes: number;
}
export interface GenTryonParams {
    model_image: string;
    garment_image: string;
    category?: 'auto' | 'tops' | 'bottoms' | 'one-pieces';
    mode?: 'performance' | 'balanced' | 'quality';
    garment_photo_type?: 'auto' | 'flat-lay' | 'model';
    num_samples?: number;
    output_format?: 'png' | 'jpeg';
    seed?: number;
}
export declare class GenerationApiError extends Error {
    code: string;
    retryAfter?: number;
    httpStatus?: number;
    constructor(code: string, message: string, httpStatus?: number, retryAfter?: number);
}
export declare class GenerationApiClient {
    private client;
    constructor();
    submitImage(params: GenImageParams): Promise<TaskResponse>;
    submitVideo(params: GenVideoParams): Promise<TaskResponse>;
    submitVideoMotionControl(params: GenVideoMotionControlParams): Promise<TaskResponse>;
    submitVideoTranslate(params: GenVideoTranslateParams): Promise<TaskResponse>;
    submitTTS(params: GenTTSParams): Promise<TaskResponse>;
    submitASR(params: GenASRParams): Promise<TaskResponse>;
    submitTryon(params: GenTryonParams): Promise<TaskResponse>;
    submitVoiceClone(params: GenVoiceCloneParams): Promise<TaskResponse>;
    submitAvatarTrain(params: GenAvatarTrainParams): Promise<TaskResponse>;
    submitDoctorVideo(params: GenDoctorVideoParams): Promise<TaskResponse>;
    submitVoicePreview(params: GenVoicePreviewParams): Promise<TaskResponse>;
    submitDoctorOnboard(params: GenDoctorOnboardParams): Promise<DoctorAvatarOnboardResponse>;
    getDoctorAvatarProfile(externalId: string): Promise<DoctorAvatarProfile | null>;
    uploadHeyGenAsset(filePath: string, mimeType?: string): Promise<AssetUploadResponse>;
    getTask(taskId: string): Promise<TaskResponse>;
    listTasks(options?: {
        status?: TaskStatus;
        type?: TaskType;
        limit?: number;
    }): Promise<TaskListResponse>;
    cancelTask(taskId: string): Promise<TaskResponse>;
    retryTask(taskId: string): Promise<TaskResponse>;
    /**
     * 轮询任务直到完成或超时
     * 超时不视为失败，返回当前状态让调用方决定
     */
    pollTask(taskId: string, options?: {
        timeout?: number;
        interval?: number;
        onProgress?: (status: TaskStatus) => void;
    }): Promise<TaskResponse>;
    /**
     * 提交任务并轮询等待结果，一站式调用
     */
    submitAndPoll(type: TaskType, params: GenImageParams | GenVideoParams | GenVideoMotionControlParams | GenVideoTranslateParams | GenTTSParams | GenASRParams | GenTryonParams | GenVoiceCloneParams | GenAvatarTrainParams | GenDoctorVideoParams | GenVoicePreviewParams, pollOptions?: {
        timeout?: number;
        interval?: number;
        onProgress?: (status: TaskStatus) => void;
    }): Promise<TaskResponse>;
    private submit;
}
/**
 * 将本地文件读取为 base64 字符串
 */
export declare function fileToBase64(filePath: string): Promise<string>;
/**
 * 将本地图像读取为 base64 data URL
 */
export declare function imageToBase64DataUrl(filePath: string): Promise<string>;
/**
 * 解析输出路径：如果用户传的是文件路径（有扩展名），直接用；否则当目录，拼上默认文件名。
 */
export declare function resolveOutputPath(userOutput: string | undefined, defaultDir: string, defaultFilename: string): {
    dir: string;
    filename: string;
};
/**
 * 下载结果文件到本地
 */
export declare function downloadResult(url: string, outputDir: string, filename: string): Promise<string>;
/**
 * CLI 层参数校验 - 快速失败
 */
export declare function validateImageParams(params: {
    width?: number;
    height?: number;
    prompt: string;
}): void;
export declare function validateVideoParams(params: {
    duration?: number;
    resolution?: string;
    provider?: string;
    image?: string;
}): void;
export declare function validateTTSParams(params: {
    text: string;
}): void;
export declare function validateASRParams(params: {
    fileSize: number;
}): void;
//# sourceMappingURL=generation-api.d.ts.map