export declare enum ClapFormat { CLAP_0 = "clap-0", CLAP_0b = "clap-0b" } export declare enum ClapSegmentCategory { SPLAT = "SPLAT", MESH = "MESH", DEPTH = "DEPTH", EFFECT = "EFFECT", EVENT = "EVENT", INTERFACE = "INTERFACE", PHENOMENON = "PHENOMENON", VIDEO = "VIDEO", IMAGE = "IMAGE", TRANSITION = "TRANSITION", CHARACTER = "CHARACTER", LOCATION = "LOCATION", TIME = "TIME", ERA = "ERA", LIGHTING = "LIGHTING", WEATHER = "WEATHER", ACTION = "ACTION", MUSIC = "MUSIC", SOUND = "SOUND", DIALOGUE = "DIALOGUE", STYLE = "STYLE", CAMERA = "CAMERA", GROUP = "GROUP", GENERIC = "GENERIC" } /** * Image ratio (also valid for video) */ export declare enum ClapImageRatio { LANDSCAPE = "LANDSCAPE", PORTRAIT = "PORTRAIT", SQUARE = "SQUARE" } export declare enum ClapOutputType { TEXT = "TEXT", ANIMATION = "ANIMATION", INTERFACE = "INTERFACE", EVENT = "EVENT", PHENOMENON = "PHENOMENON", TRANSITION = "TRANSITION", IMAGE = "IMAGE", IMAGE_SEGMENTATION = "IMAGE_SEGMENTATION", IMAGE_DEPTH = "IMAGE_DEPTH", VIDEO = "VIDEO", VIDEO_SEGMENTATION = "VIDEO_SEGMENTATION", VIDEO_DEPTH = "VIDEO_DEPTH", AUDIO = "AUDIO" } export declare enum ClapSegmentStatus { TO_GENERATE = "TO_GENERATE", IN_PROGRESS = "IN_PROGRESS", TO_INTERPOLATE = "TO_INTERPOLATE", TO_UPSCALE = "TO_UPSCALE", COMPLETED = "COMPLETED", ERROR = "ERROR" } export type ClapAuthor = "auto" | "ai" | "human" | string; export declare enum ClapAssetSource { REMOTE = "REMOTE",// http:// or https:// PATH = "PATH",// a file path eg. /path or ./path/to/ or ../path/to/ DATA = "DATA",// a data URI, starting with data: PROMPT = "PROMPT",// by default, a plain text prompt EMPTY = "EMPTY" } export type ClapEntityGender = "male" | "female" | "person" | "object" | string; export type ClapEntityVariant = string; export type ClapEntityAppearance = "serious" | "neutral" | "friendly" | "chill" | string; export type ClapEntityRegion = "global" | "american" | "european" | "british" | "australian" | "canadian" | "indian" | "french" | "italian" | "german" | "chinese" | string; export type ClapEntityTimbre = "high" | "neutral" | "deep"; export type ClapEntityAudioEngine = "ElevenLabs" | "XTTS" | "Parler-TTS" | "OpenVoice" | string; export declare enum ClapSegmentFilteringMode { START = 0, END = 1, ANY = 2, BOTH = 3 } export type ClapVoice = { name: string; gender: ClapEntityGender; age: number; region: ClapEntityRegion; timbre: ClapEntityTimbre; appearance: ClapEntityAppearance; audioEngine: ClapEntityAudioEngine; audioId: string; }; export type ClapHeader = { format: ClapFormat; numberOfWorkflows: number; numberOfEntities: number; numberOfScenes: number; numberOfSegments: number; }; export type ClapMeta = { id: string; title: string; description: string; synopsis: string; licence: string; /** * Beats per minute */ bpm: number; /** * Number of frames per second * * 24 FPS: standard for most movies and streaming video content * 25 FPS (UK & Europe) and 30 FPS (the US & elsewhere): standard frame rate for TV video */ frameRate: number; /** * List of keywords used to describe the project. * * Examples: action, sci-fi, romance, advert, music video, */ tags: string[]; /** * A thumbnail representing the project. * * Can be hosted on a remote server or in base64 */ thumbnailUrl: string; /** * Tells what kind of image ratio is used * * LANDSCAPE (16:9) * PORTRAIT (9:16) * SQUARE (1:1) */ imageRatio: ClapImageRatio; durationInMs: number; width: number; height: number; /** * Global prompt used for image and video generation */ imagePrompt: string; /** * Global instructions used for the assistant */ systemPrompt: string; /** * Story prompt (or "screenplay") of the project */ storyPrompt: string; isLoop: boolean; isInteractive: boolean; }; export type ClapSceneEvent = { id: string; type: "description" | "dialogue" | "action"; character?: string; description: string; behavior: string; startAtLine: number; endAtLine: number; }; export type ClapScene = { id: string; scene: string; line: string; rawLine: string; sequenceFullText: string; sequenceStartAtLine: number; sequenceEndAtLine: number; startAtLine: number; endAtLine: number; events: ClapSceneEvent[]; }; export type ClapSegment = { id: string; /** * ID of the parent segment id */ parentId: string; /** * IDs of children segments */ childrenIds: string[]; track: number; startTimeInMs: number; endTimeInMs: number; category: ClapSegmentCategory; /** * ID of the entity attached to the segment * * This allows segments of different nature (image, voice) to be attached to the same or different entities. * * Eg. video of character A but voice of character B * * If you want multiple entities, you can add multiple segments. */ entityId: string; /** * ID of the workflow to use for the segment * * This is optional (empty string by default) * * If unspecified, a default workflow will be used */ workflowId: string; /** * Id of the scene to which the segment is attached * * This is optional (empty string by default) */ sceneId: string; /** * Statring line number to which the segment is attached * * This is optional (empty string by default) */ startTimeInLines: number; /** * Ending line number to which the segment is attached * * This is optional (empty string by default) */ endTimeInLines: number; /** * */ prompt: string; /** * Human-readable label to showfor this segment. * * Should be kept short. */ label: string; outputType: ClapOutputType; /** * Id of an external rendering job to which this segment could be attached. * * This is optional (empty string by default) * * It is possible that this field gets removed in the future, * and instead moved to TimelineSegment */ renderId: string; /** * Status of the segment (is it generated, to generate etc) */ status: ClapSegmentStatus; /** * The value of the segment, ie. the data * * It can come from the output of a workflow. * * This can be either a link to a remotely hosted resource, * a file path or a data URI (base64) * * I recommend the data URI for small projects, * as the other modes create additional complexity * (manage a cloud, access rights, deletes, downloads etc) */ assetUrl: string; /** * The duration of the asset itself. * * This might be different from the segment itself, * for instance if the asset has a zero length (a storyboard), * or if the asset is longer (eg. a cropped audio file) */ assetDurationInMs: number; assetSourceType: ClapAssetSource; assetFileFormat: string; createdAt: string; createdBy: ClapAuthor; revision: number; editedBy: ClapAuthor; /** * The volume of the segment */ outputGain: number; /** * The seed used to generate the asset data/value. * * This is mostly used fo tracking changes, * and reproduce result */ seed: number; }; export declare enum ClapInputCategory { PROMPT = "PROMPT", IMAGE_URL = "IMAGE_URL", SOUND_URL = "SOUND_URL", VIDEO_URL = "VIDEO_URL", IMAGE_URLS = "IMAGE_URLS", TARGET_IMAGE_URL = "TARGET_IMAGE_URL", SWAP_IMAGE_URL = "SWAP_IMAGE_URL", WIDTH = "WIDTH", HEIGHT = "HEIGHT", SEED = "SEED", LORA = "LORA", ITERATION_STEPS = "ITERATION_STEPS", GUIDANCE_SCALE = "GUIDANCE_SCALE", UPSCALING_FACTOR = "UPSCALING_FACTOR", UNKNOWN = "UNKNOWN" } export type ClapInputFieldNumber = { type: 'number'; minValue: number; maxValue: number; defaultValue: number; }; export type ClapInputFieldInteger = { type: 'integer'; minValue: number; maxValue: number; defaultValue: number; }; export type ClapInputFieldString = { type: 'string'; allowedValues: string[]; defaultValue: string; }; export type ClapInputFieldStrings = { type: 'string[]'; defaultValue: string[]; }; export type ClapInputFieldBoolean = { type: 'boolean'; defaultValue: boolean; }; export type ClapInputFieldAny = { type: 'any'; defaultValue: any; }; export type ClapInputField> = { /** * Machine readable input field name or identifier */ id: string; /** * Human-readable input field name */ label: string; /** * Description of what the input field does */ description: string; /** * The category of the input * This helps us associate an arbitrary parameter name * to one of the category recognized by clapper * * eg "hf_model", "hf_model_repo" -> ClapInputCategory.LORA */ category: ClapInputCategory; /** * Whether the field is optional or not */ /** * If the input is composed by other inputs, useful * for grouping the inputs */ inputFields?: ClapInputField[]; /** * Additional extension info about the input to better * handling of complex scenearios such as grouping inputs, etc */ metadata?: T; } & (ClapInputFieldNumber | ClapInputFieldInteger | ClapInputFieldString | ClapInputFieldStrings | ClapInputFieldBoolean | ClapInputFieldAny); export type ClapInputFields = ClapInputField[]; export interface ClapInputValueObject { [key: string]: ClapInputValue; } export type ClapInputValue = number | string | boolean | string[] | number[] | null | undefined | ClapInputValueObject; export type ClapInputValues = Record; export declare enum ClapWorkflowProvider { NONE = "NONE", BUILTIN = "BUILTIN", CUSTOM = "CUSTOM", AITUBE = "AITUBE",// https://aitube.at ANTHROPIC = "ANTHROPIC",// https://anthropic.com BIGMODEL = "BIGMODEL", CIVITAI = "CIVITAI",// https://civitai.com COHERE = "COHERE",// https://cohere.com COMFYDEPLOY = "COMFYDEPLOY",// https://comfydeploy.com COMFYICU = "COMFYICU",// https://comfy.icu COMFYUI = "COMFUI",// any ComfyUI server (local or remote) ELEVENLABS = "ELEVENLABS",// https://elevenlabs.io EVERARTAI = "EVERARTAI", FALAI = "FALAI",// https://fal.ai FIREWORKSAI = "FIREWORKSAI",// https://fireworks.ai GOOGLE = "GOOGLE",// https://google.com (in case you didn't know) GROQ = "GROQ",// https://groq.com HEDRA = "HEDRA", HOTSHOT = "HOTSHOT",// https://hotshot.co HUGGINGFACE = "HUGGINGFACE",// https://huggingface.co KITSAI = "KITSAI",// https://kits.ai KUAISHOU = "KUAISHOU", LEONARDOAI = "LEONARDOAI", LETZAI = "LETZAI", LUMALABS = "LUMALABS",// https://lumalabs.ai (Dream Machine etc) MIDJOURNEY = "MIDJOURNEY", MISTRALAI = "MISTRALAI",// https://mistral.ai MODELSLAB = "MODELSLAB",// https://modelslab.com OPENAI = "OPENAI",// https://openai.com PIAPI = "PIAPI",// (Kling etc) REPLICATE = "REPLICATE",// https://replicate.com RUNWAYML = "RUNWAYML", STABILITYAI = "STABILITYAI",// https://stability.ai SUNO = "SUNO", UDIO = "UDIO" } export declare enum ClapWorkflowCategory { ASSISTANT = "ASSISTANT", IMAGE_GENERATION = "IMAGE_GENERATION", IMAGE_FACESWAP = "iMAGE_FACESWAP", IMAGE_FILTERING = "IMAGE_FILTERING", IMAGE_UPSCALING = "IMAGE_UPSCALING", IMAGE_DEPTH_MAPPING = "IMAGE_DEPTH_MAPPING", IMAGE_SEGMENTATION = "IMAGE_SEGMENTATION", MUSIC_GENERATION = "MUSIC_GENERATION", SOUND_GENERATION = "SOUND_GENERATION", VOICE_GENERATION = "VOICE_GENERATION", VIDEO_GENERATION = "VIDEO_GENERATION", VIDEO_FACESWAP = "VIDEO_FACESWAP", VIDEO_LIPSYNC = "VIDEO_LIPSYNC", VIDEO_FILTERING = "VIDEO_FILTERING", VIDEO_UPSCALING = "VIDEO_UPSCALING", VIDEO_DEPTH_MAPPING = "VIDEO_DEPTH_MAPPING", VIDEO_SEGMENTATION = "VIDEO_SEGMENTATION" } export declare enum ClapWorkflowEngine { DEFAULT = "DEFAULT", REST_API = "REST_API", GRADIO_API = "GRADIO_API", OPENCLAP = "OPENCLAP", COMFYUI_WORKFLOW = "COMFYUI_WORKFLOW", FALAI_WORKFLOW = "FALAI_WORKFLOW", GLIF_WORKFLOW = "GLIF_WORKFLOW", VISUALBLOCKS_WORKFLOW = "VISUALBLOCKS_WORKFLOW" } export type ClapWorkflow = { id: string; /** * Human-readable label (this is the name or title of the workflow) */ label: string; /** * Long description of what the workflow is about. */ description: string; /** * List of keywords used to describe the workflow. * * Examples: upscaling, lip-sync, body animation, text-to-video.. */ tags: string[]; /** * The original author of the workflow * * Can be a name, email, social media handle.. */ author: string; /** * A thumbnail representing the workflow. * * Can be hosted on a remote server or in base64 * (we could use a "ClapAssetSource" here too, but the thumbnail is not * used within a workflow so there is no need to do any kind of precise optimization or verification here) */ thumbnailUrl: string; /** * Whether the workflow forbids commercial usage or not */ nonCommercial: boolean; engine: ClapWorkflowEngine; category: ClapWorkflowCategory; provider: ClapWorkflowProvider; /** * The workflow data itself * * This is typically a serialized JSON, although this can be other things * depending on which engine is used (YAML, base64, or even an ID to a proprietary commercial platform) */ data: string; /** * The workflow schema (optional) * * This is used to visualize the workflow in our workflow editor * */ schema: string; /** * Inputs of the workflow (this is used to build an UI for the workflow automatically) */ inputFields: ClapInputFields; /** * Default values (this is used to initialize the workflow automatically) */ inputValues: ClapInputValues; }; export type ClapEntity = { id: string; category: ClapSegmentCategory; /** * keyword referencing the entity within a screenplay * * Typically in UPPERCASE */ triggerName: string; /** * Human-readable label (this is the name or title of the entity) */ label: string; /** * Long description of what the entity is about. * * This can be for instance a short history or biography of the entity. */ description: string; /** * List of keywords used to describe the entity. * * Examples: location, character, male, female, car.. */ tags: string[]; /** * The original author of the entity * * Can be a name, email, social media handle.. */ author: string; /** * A thumbnail representing the entity. * * Can be hosted on a remote server or in base64 * (we could use a "ClapAssetSource" here too, but the thumbnail is not * used within a workflow so there is no need to do any kind of precise optimization or verification here) */ thumbnailUrl: string; /** * The seed associated with the entity. * * This can be used to reproduce the settings (eg. reproduce the image * from the image prompt, by re-using the same seed) */ seed: number; /** * Text prompt describing the appearance of the entity */ imagePrompt: string; /** * Where the image is hosted (remote, local file etc) */ imageSourceType: ClapAssetSource; /** * Can be used to tell the model used to generate the engine (eg. SDXL, Dalle-3) */ imageEngine: string; /** * The "identity picture" of the entity * * if this is too confusing to people, we can rename it * * this is a regular URI so, it can be a file path, a remote url, a base64.. */ imageId: string; /** * Text prompt describing the voice * * Eg. "low quality phone recording of an old man" */ audioPrompt: string; /** * Where the audio is hosted (remote, local file etc) */ audioSourceType: ClapAssetSource; /** * The engine used to generate the audio * * This is important as this impacts what is the vendor and type audioId */ audioEngine: ClapEntityAudioEngine; /** * The voice identity (the "identity picture" equivalent of the voice) * * Depending on the engine, this can be a voice sample or an ID to a 3rd party proprietary platform */ audioId: string; age: number; gender: ClapEntityGender; region: ClapEntityRegion; appearance: ClapEntityAppearance; }; export type ClapTrack = { id: number; name: string; isPreview: boolean; height: number; hue: number; occupied: boolean; visible: boolean; }; export type ClapTracks = ClapTrack[]; export type ClapProject = { meta: ClapMeta; workflows: ClapWorkflow[]; entities: ClapEntity[]; entityIndex: Record; scenes: ClapScene[]; segments: ClapSegment[]; }; export declare enum ClapCompletionMode { /** * the API and the client will return a full clap file. * This is a very convenient and simple mode, but it is also very ineficient, * so it should not be used for intensive applications. */ FULL = "FULL", /** * the API and the client will return a partial clap file containing only the changes, * containing only the new values and changes. * This is useful for real-time applications and streaming. */ PARTIAL = "PARTIAL", /** * the API will return a partial clap file containing only the changes, * and the client will return a merge of the original with the new values. * This is safe to run, there are no side-effects. */ MERGE = "MERGE", /** * the API will return a partial clap file, and the client will replace the original. * This is the most efficient mode, but it relies on side-effects and inline object updates. */ REPLACE = "REPLACE" } export type ParseClapProgressUpdate = ({ value, sleepDelay, message }: { value: number; sleepDelay?: number; message?: string; }) => Promise;