import { z } from 'zod'; /** * The workflows as data, so the run form renders itself and the server validates and builds what it * sends from the same descriptors. Parameters are Robots v1's: every run starts on v1. * * Only documented parameters are listed. Where the reference and a guide disagree on a limit, the * stricter figure wins. Left out on purpose: `edit-captions`' `auto_censor_profanity.detection_method` * (one documented value). */ export declare const ROBOTS_WORKFLOW_KEYS: readonly ["generate-premium-captions", "edit-captions", "translate-captions", "translate-audio", "summarize", "ask-questions", "find-key-moments", "find-best-thumbnails", "generate-engagement-insights", "generate-chapters", "analyze-structure", "moderate", "find-scenes", "generate-contextual-text"]; export type RobotsWorkflow = (typeof ROBOTS_WORKFLOW_KEYS)[number]; export type RobotsParamKind = 'text' | 'textarea' | 'number' | 'boolean' | 'select' | 'language' /** * The language of the caption track a workflow reads. Robots v1 matches it exactly (`en` isn't * `en-US`), so the choice is the asset's own ready caption languages. */ | 'captionLanguage' | 'track' | 'stringList' /** Multi-select over a fixed enum. Never free text. */ | 'enumList' | 'questions' | 'replacements' /** `edit-captions`' renames of the bracketed speaker labels that start a cue. */ | 'speakerReplacements' /** A controlled vocabulary: `topic_taxonomy` / `tag_taxonomy`. */ | 'taxonomy'; export interface RobotsParamOption { value: string; label: string; } /** A ready caption track of the asset: one a workflow can read, and whose name a new track can't take. */ export interface RobotsCaptionTrack { id: string; name?: string; language_code?: string; } /** * What is known about the Mux asset itself, as opposed to what the person typed. Every member is * optional and stays optional: not knowing must never block a run or hide a control, so every rule * reads an explicit `true` / `false`. */ export interface RobotsAssetContext { hasCaptions?: boolean; isAudioOnly?: boolean; /** Seconds. */ duration?: number; /** Known only when the asset's tracks are. */ captionTracks?: RobotsCaptionTrack[]; /** Every text track, chapters and unready ones included: Mux keeps text track names unique. */ textTracks?: Array<{ id: string; name?: string; }>; } /** * When a field is rendered, and therefore when it is sent: off another field's value, or off what * the asset is. The context form is `notEquals` so an unknown context still shows the control. */ export type RobotsFieldCondition = { field: string; equals: unknown; } | { context: keyof RobotsAssetContext; notEquals: unknown; }; /** The documented caps on one controlled vocabulary. An absent limit means the reference states none. */ export interface RobotsTaxonomyLimits { maxValues?: number; maxNameLength?: number; maxLabelLength?: number; maxDescriptionLength?: number; maxAliases?: number; maxAliasLength?: number; /** Measured over the JSON of the object actually sent. */ maxSerializedLength?: number; } /** A warning the confirm step must show before a run that arms a destructive value. */ export interface RobotsConfirmWarning { whenValue: string; title: string; body: string; } /** A titled group of neighbouring fields in the run form. Presentation only. */ export interface RobotsParamSection { id: string; title: string; description?: string; } export interface RobotsParamField { kind: RobotsParamKind; /** Dotted path within the job's `parameters` object. */ name: string; label: string; helpText?: string; section?: RobotsParamSection; isRequired?: boolean; placeholder?: string; /** `select` and `enumList` only. */ options?: RobotsParamOption[]; /** `number` only. */ min?: number; max?: number; step?: number; /** `number` only: a count, never a fraction. */ integer?: boolean; /** `text` only. */ maxLength?: number; /** `track` only: which kind of existing asset track to pick from. */ trackType?: 'text' | 'audio'; /** `stringList` and `enumList`. */ maxItems?: number; /** `stringList` only. */ maxItemLength?: number; /** `stringList` only: the entries' combined length. */ maxTotalLength?: number; /** `taxonomy` only. */ taxonomyLimits?: RobotsTaxonomyLimits; /** The form's starting value. `''` means "untouched", and is never sent. */ defaultValue?: string | number | boolean; /** Render, and send, this parameter only while a condition holds. A hidden field is never sent. */ showWhen?: RobotsFieldCondition; /** A control that shapes the request without being a parameter itself. Never sent to Mux. */ formOnly?: boolean; /** Warnings the confirm step must show, by the value that arms them. */ confirmWarnings?: RobotsConfirmWarning[]; } export type RobotsCategory = 'Accessibility' | 'Insights' | 'Structure' | 'Trust & Safety'; export interface RobotsWorkflowDefinition { key: RobotsWorkflow; /** The workflow's resource on `client.robots.jobs` (v1) and `client.robotsV0.jobs` (v0). */ sdkKey: 'analyzeStructure' | 'askQuestions' | 'editCaptions' | 'findBestThumbnails' | 'findKeyMoments' | 'findScenes' | 'generateChapters' | 'generateContextualText' | 'generateEngagementInsights' | 'generatePremiumCaptions' | 'moderate' | 'summarize' | 'translateAudio' | 'translateCaptions'; /** How webhook types spell the workflow: `robots.v1.job..`, or `robots.job.…` on v0. */ eventKey: string; /** * A v0 workflow that v1 dropped. Its jobs are still listed and read, on v0, but it's never offered: * nothing can start it on v1. */ legacy?: boolean; /** Listed and read when a directive dispatches it, but not offered in the run form. */ listedOnly?: boolean; label: string; category: RobotsCategory; description: string; params: RobotsParamField[]; /** Shown in the confirm step. */ notes?: string[]; /** Needs Mux Data views accumulated before it has anything to analyze. */ requiresViewData?: boolean; /** Writes a track onto the Mux asset when it completes. */ producesTrack?: boolean; /** Not available on every plan. Informational: there's no way to check ahead. */ planRestricted?: boolean; /** Can't run on an audio-only asset. `find-best-thumbnails` is a product decision: it ranks frames. */ requiresVideoTrack?: boolean; } export declare const ROBOTS_CATALOG: RobotsWorkflowDefinition[]; export declare const ROBOTS_CATALOG_BY_KEY: Record<"summarize" | "analyze-structure" | "generate-premium-captions" | "edit-captions" | "translate-captions" | "translate-audio" | "ask-questions" | "find-key-moments" | "find-best-thumbnails" | "generate-engagement-insights" | "generate-chapters" | "moderate" | "find-scenes" | "generate-contextual-text", RobotsWorkflowDefinition>; export declare const ROBOTS_CATEGORIES: RobotsCategory[]; /** What the run form opens on. Runs on any asset. */ export declare const DEFAULT_ROBOTS_WORKFLOW: RobotsWorkflow; /** Looked up in the list, not by property: `constructor` or `__proto__` must not find anything. */ export declare const workflowByKey: (key: unknown) => RobotsWorkflowDefinition | undefined; export declare const workflowByEventKey: (eventKey: unknown) => RobotsWorkflowDefinition | undefined; export declare const workflowLabel: (workflow: unknown) => string; /** Whether the run form offers it, and the server starts it: on Robots v1. */ export declare const isRunnableWorkflow: (definition: RobotsWorkflowDefinition) => boolean; interface TrackLike { id?: string; type?: string; text_type?: string; status?: string; name?: string; language_code?: string; } interface AssetLike { duration?: number | null; tracks?: TrackLike[] | null; } /** The caption tracks a workflow can read or edit: ready subtitles, not the chapters track. */ export declare const readyCaptionTracks: (asset?: { tracks?: T[] | null; } | null) => T[]; /** What the stored Mux asset (`asset_data`) says about the video, for `RobotsAssetContext`. */ export declare function assetContextFrom(asset?: AssetLike | null): RobotsAssetContext; /** What an asset lacks for a workflow. */ export interface RobotsUnavailability { reason: 'audio-only' | 'no-captions'; /** A workflow that gives the asset what it lacks. */ fix?: RobotsWorkflow; } /** What stops this asset running a workflow, or `undefined` when nothing does. */ export declare function workflowUnavailability(definition: RobotsWorkflowDefinition, context?: RobotsAssetContext): RobotsUnavailability | undefined; /** The distinct languages of the asset's ready caption tracks, in track order. */ export declare const captionLanguages: (context: RobotsAssetContext) => string[]; /** Why this asset can't run a workflow, or `undefined` when it can. */ export declare function workflowUnavailableReason(definition: RobotsWorkflowDefinition, context?: RobotsAssetContext): string | undefined; /** * One `ask-questions` row. `answerMode` exists because `answer_options` and `free_form_reply` are * mutually exclusive: a mode per row makes them separate intents. */ export interface QuestionRow { question: string; answerOptions: string; answerMode?: 'options' | 'free_form'; } export declare const QUESTION_ANSWER_MODES: RobotsParamOption[]; export declare const emptyQuestionRow: () => QuestionRow; export interface ReplacementRow { find: string; replace: string; caseSensitive: boolean; } export interface SpeakerReplacementRow { find: string; replace: string; } /** One row of a controlled vocabulary. `aliases` is comma-separated text, split on the way out. */ export interface TaxonomyRow { label: string; description: string; aliases: string; } /** * A whole `topic_taxonomy` / `tag_taxonomy`, edited as one field so it's sent whole or not at all. * `allowOther` is always sent: the API rejects the object without it. It defaults to `true`, because * `false` filters the output to the vocabulary. */ export interface TaxonomyValue { name: string; allowOther: boolean; values: TaxonomyRow[]; } export declare const emptyTaxonomyRow: () => TaxonomyRow; export declare function asTaxonomyValue(value: unknown): TaxonomyValue; /** The form's starting values: the catalog's defaults, and one empty question row to fill in. */ export declare function defaultParamValues(fields: RobotsParamField[]): Record; export declare function isFieldVisible(field: RobotsParamField, values: Record, context?: RobotsAssetContext): boolean; export interface RobotsFieldGroup { section?: RobotsParamSection; fields: RobotsParamField[]; } /** Consecutive fields that share a section become one group; every other field stands alone. */ export declare function groupFieldsBySection(fields: RobotsParamField[]): RobotsFieldGroup[]; /** * Expands flat, dotted-path values into the nested `parameters` object Mux expects, always with * `asset_id`. Empty strings, empty arrays, `null` and `undefined` are dropped; `false` is sent. */ export declare function buildRobotsParameters(assetId: string, values: Record): Record; /** The job's `parameters`, from the form's flat values: visible, non-`formOnly` fields only. */ export declare function paramsFromFormValues(definition: RobotsWorkflowDefinition, assetId: string, values: Record, context?: RobotsAssetContext): Record; export declare function confirmWarnings(definition: RobotsWorkflowDefinition, values: Record, context?: RobotsAssetContext): RobotsConfirmWarning[]; /** Validation the person sees before a job is billed, rather than as a 400 afterwards. */ export declare function validateParams(definition: RobotsWorkflowDefinition, values: Record, context?: RobotsAssetContext): string[]; /** * The form values a workflow accepts: its own fields only, each with the type its widget produces. * What reaches Mux is still built from the catalog (`paramsFromFormValues`), never from the request. */ export declare const robotsValuesSchema: (definition: RobotsWorkflowDefinition) => z.ZodObject<{ [k: string]: z.ZodOptional; }, "strict", z.ZodTypeAny, { [x: string]: any; }, { [x: string]: any; }>; export {};