import { type H3Mode } from "./h3-prompt.ts"; import { type ProfileDirectoryConfig } from "./profile-directory.ts"; /** Package resource directory shared by source development and installed JavaScript. */ export declare const pluginRoot: string; export type CredentialResolver = (name: string) => Promise; export declare function resolveCredential(ctx: { credentials: { resolve: (name: string) => Promise<{ value: string; source?: string; } | undefined>; }; }, name: string): Promise; export declare function mimeFromPath(filePath: string): string; export declare function readImageDataUrl(filePath: string): Promise; export type GpuProgress = { stage: "submitted" | "queued" | "running" | "completed"; jobId: string; progress?: number; label: string; }; type GpuJobError = string | { code?: unknown; message?: unknown; } | null; export type GpuJob = { job_id: string; model_id: string; status: string; terminal?: boolean; stage?: string | null; progress?: number | null; error?: GpuJobError; parameters?: Record; can_continue_refine?: boolean; }; /** Read the authenticated current catalogue; never switch model or account on failure. */ export declare function checkGpuModel(baseUrl: string, token: string, modelId: string, operation: string, signal?: AbortSignal): Promise; /** A rejected HTTP request, distinct from an unknown network submission outcome. */ export declare class GpuRequestError extends Error { readonly status: number; readonly code: string; constructor(message: string, status: number, code: string); } export declare function uploadGpuAsset(baseUrl: string, token: string, kind: "images" | "audio", filePath: string, signal?: AbortSignal): Promise; export declare function submitGpuJob(baseUrl: string, token: string, input: { modelId: string; operation: string; contractVersion?: string; parameters: Record; inputs?: Array<{ role: string; asset_id: string; }>; clientJobId?: string; signal?: AbortSignal; }): Promise; export declare function waitGpuJob(baseUrl: string, token: string, job: GpuJob, onProgress?: (p: GpuProgress) => void | Promise, signal?: AbortSignal): Promise; /** Project one unified GPU job into user-facing progress without changing its lifecycle. */ export declare function gpuProgressForJob(job: Pick): GpuProgress; export interface ResolvedH3VideoOptions { mode: H3Mode; addGuideSourceJobId?: string; includeGuideAudio: boolean; refine: boolean; refineExecution: "auto" | "manual"; } /** Validate H3 reference generation, AddGuide, and refine options before paid work starts. */ export declare function resolveH3VideoOptions(input: { mode?: unknown; quality: string; imageCount: number; audioCount: number; addGuideSourceJobId?: unknown; includeGuideAudio?: unknown; refine?: unknown; refineExecution?: unknown; }): ResolvedH3VideoOptions; interface H3JobParameters extends Record { mode: H3Mode; prompt: string; width: number; height: number; duration_seconds: number; add_guide?: { source_job_id: string; guide_frames: 22; include_guide_audio: boolean; source_media: "native_latent"; }; refine?: { profile: "latent_upscale_2mp_v1"; execution: "auto" | "manual"; }; } export interface H3JobPayload { parameters: H3JobParameters; inputs: Array<{ role: "reference_image" | "reference_audio"; asset_id: string; }>; } /** Build an H3 v2 payload; default R2V keeps image and audio references in upload order. */ export declare function buildH3JobPayload(input: { mode?: H3Mode; prompt: string; quality: string; duration: number; imageAssetIds: string[]; audioAssetIds: string[]; addGuideSourceJobId?: string; includeGuideAudio?: boolean; refine?: boolean; refineExecution?: "auto" | "manual"; }): H3JobPayload; /** Read an existing GPU job without creating a replacement. */ export declare function readGpuJob(baseUrl: string, token: string, jobId: string, signal?: AbortSignal): Promise; /** Submit native latent continuation with a caller-owned, persisted idempotency key. */ export declare function submitH3Refinement(baseUrl: string, token: string, sourceJobId: string, idempotencyKey: string, signal?: AbortSignal): Promise; /** Input shared by standalone tools and durable Studio generation. */ export interface H3VideoRequest { mode?: H3Mode; prompt: string; quality: string; duration: number; imagePaths: string[]; audioPaths: string[]; addGuideSourceJobId?: string; includeGuideAudio?: boolean; refine?: boolean; refineExecution?: "auto" | "manual"; } /** Upload validated references once; persist the returned payload before submission. */ export declare function prepareH3VideoJob(baseUrl: string, token: string, input: H3VideoRequest, signal?: AbortSignal): Promise; /** Successful source media and its recoverable native-refinement eligibility. */ export interface H3VideoResult { path: string; jobId: string; mimeType: string; quality: string; duration: number; refine: boolean; refineExecution?: "auto" | "manual"; canContinueRefine?: boolean; firstPassPath?: string; firstPassMimeType?: string; width?: number; height?: number; addGuideSourceJobId?: string; guideFrames?: number; includeGuideAudio?: boolean; } /** Download a successful job by output identity; manual first pass uses video, not first_pass. */ export declare function collectH3VideoJob(baseUrl: string, token: string, completed: GpuJob, input: { quality: string; duration: number; refine?: boolean; refineExecution?: "auto" | "manual"; outputDir: string; signal?: AbortSignal; }): Promise; /** Standalone execution shares upload, submission, polling and download with Studio. */ export declare function generateH3Video(baseUrl: string, token: string, input: H3VideoRequest & { outputDir: string; signal?: AbortSignal; onProgress?: (p: GpuProgress) => void | Promise; }): Promise; export declare function buildMusic3JobPayload(input: { caption: string; lyrics?: string; instrumental?: boolean; maxDuration?: number; seed?: number; outputFormat?: string; tiledDecode?: boolean; }): Record; export declare function generateMusic3(baseUrl: string, token: string, input: { caption: string; lyrics?: string; instrumental?: boolean; maxDuration?: number; seed?: number; outputFormat?: string; tiledDecode?: boolean; outputDir: string; signal?: AbortSignal; onProgress?: (p: GpuProgress) => void | Promise; }): Promise>>; export declare function generateErnieImage(baseUrl: string, token: string, input: { prompt: string; size: string; seed?: number; outputDir: string; signal?: AbortSignal; }): Promise>>; export declare function buildQwenImageParameters(input: { prompt: string; size?: string; mode?: "t2i" | "i2i" | "edit"; referenceImagePaths?: string[]; steps?: number; promptEnhance?: boolean; seed?: number; }): { seed?: number | undefined; prompt: string; mode: "t2i" | "i2i" | "edit"; width: number; height: number; steps: number; prompt_enhance: boolean; }; export declare function generateQwenImage(baseUrl: string, token: string, input: Parameters[0] & { outputDir: string; signal?: AbortSignal; }): Promise>>; export declare function transcribeAudio(baseUrl: string, token: string, input: { audioPath: string; language?: "auto" | "zh" | "en"; outputDir: string; signal?: AbortSignal; }): Promise<{ jobId: string; model: string; files: Record; transcript: unknown; }>; export declare const RUNWARE_IMAGE_MODELS: readonly ["google:nano-banana@2-lite", "google:4@1", "openai:gpt-image@2"]; export declare function generateRunwareImage(apiKey: string, input: { prompt: string; model: string; size: string; referenceImagePaths?: string[]; outputDir: string; signal?: AbortSignal; }): Promise>>; /** Generate and persist one natural-duration reference voice through Xiaomi MiMo VoiceDesign. */ export declare function generateMimoVoiceDesign(input: { apiKey: string; baseUrl: string; model: string; voiceDescription: string; text: string; outputDir: string; signal?: AbortSignal; }): Promise>; /** MiMo preset, voice design and clone use the same documented chat-completions audio contract. */ export declare function generateMimoSpeech(input: { apiKey: string; baseUrl: string; mode: "preset" | "design" | "clone"; content: string; voiceId?: string; voiceDescription?: string; referenceAudio?: string; direction?: string; outputDir: string; signal?: AbortSignal; }): Promise>>; export declare function generateSpeech(input: { arkApiKey: string; ttsApiKey: string; ttsResourceId: string; toneModel?: string; content: string; voiceId: string; direction?: string; outputDir: string; signal?: AbortSignal; }): Promise>>; export interface CharacterLibraryPaths { root: string; indexPath: string; } export declare function characterLibraryPaths(root: string): CharacterLibraryPaths; export type CharacterAssetKind = "image" | "video" | "audio" | "other"; export type CharacterAsset = { key: string; relativePath: string; mimeType: string; byteSize?: number; sha256?: string; localPath: string; kind: CharacterAssetKind; source?: "published" | "generated" | "local"; }; export type CharacterEntry = { id: string; name: string; chineseName?: string; subtitle?: string; summary?: string; voiceDescription?: string; voiceId?: string; livechatSpeakerId?: string; prompt?: string; directory?: string; mainImageKey?: string; assets?: CharacterAsset[]; catalogSource?: "published" | "local"; }; export interface LocalCharacterInput { name: string; summary?: string; prompt?: string; mainImagePath: string; otherImagePaths?: string[]; referenceAudioPath?: string; } /** Copy the legacy package-owned character cache into an empty Profile library. */ export declare function migrateLegacyCharacterLibrary(destination: CharacterLibraryPaths, sourceRoot?: string): Promise; /** Select the Profile-owned character library for this process without performing IO. */ export declare function configureCharacterLibrary(config: ProfileDirectoryConfig): CharacterLibraryPaths; /** Select and initialize the Profile-owned character library for this process. */ export declare function initializeCharacterLibrary(config: ProfileDirectoryConfig): Promise; /** Return the configured library root after migration has completed. */ export declare function characterLibraryRoot(): Promise; /** Pull all published entries; optional prose may be absent, and failure leaves the old library usable. */ export declare function pullCharacters(apiUrl: string, token: string, library?: CharacterLibraryPaths, options?: { signal?: AbortSignal; timeoutMs?: number; }): Promise<{ publishVersion: string; total: number; characters: CharacterEntry[]; added: number; updated: number; unchanged: number; assetsDownloaded: number; legacyVideoDirectoriesRemoved: number; }>; export declare function listCharacters(library?: CharacterLibraryPaths): Promise; export declare function setCharacterMainImage(characterId: string, assetKey: string, library?: CharacterLibraryPaths): Promise; /** Copy one project-generated image into a bound character's non-primary reference gallery. */ export declare function appendGeneratedCharacterImage(characterId: string, sourcePath: string, library?: CharacterLibraryPaths): Promise; /** Save one completed project character into the local character library. */ export declare function saveLocalCharacter(input: LocalCharacterInput, library?: CharacterLibraryPaths): Promise; export declare function sha256Hex(value: string): string; export {};