@mux/ai 0.58.0 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -84,7 +84,7 @@ Workflows are high-level functions that handle complete media AI tasks end-to-en
84
84
  | [`editCaptions`](./docs/WORKFLOWS.md#caption-editing) | Edit captions: censor profanity and/or apply static replacements | OpenAI, Anthropic, Google, Baseten, OpenAI-compatible | Yes |
85
85
  | [`translateAudio`](./docs/WORKFLOWS.md#audio-dubbing) | Create AI-dubbed audio tracks | ElevenLabs | Yes |
86
86
 
87
- See the [Workflows guide](./docs/WORKFLOWS.md) for detailed documentation, options, and examples for each workflow. See the [API Reference](./docs/API.md) for complete parameter and return type details.
87
+ See the [Workflows guide](./docs/WORKFLOWS.md) for detailed documentation, options, and examples for each workflow. See the [API Reference](./docs/API.md) for complete parameter and return type details. See the [Errors guide](./docs/ERRORS.md) for how failures are classified and what to show end users.
88
88
 
89
89
  ### Quick Examples
90
90
 
@@ -1,10 +1,441 @@
1
1
  import { LanguageModel, generateText as generateText$1 } from 'ai';
2
- import { l as WorkflowCredentialsInput, M as MuxAsset, A as AssetTextTrack, T as TokenUsage, f as ScopedMuxAIOptions, I as ImageSubmissionMode, d as MuxAIOptions, b as ChunkingStrategy, k as VideoEmbeddingsResult, H as Hotspot, y as Shot, q as VTTCue, j as ToneType, g as StorageAdapter } from './transcripts-Brw74qlV.js';
2
+ import { i as TokenUsage, l as WorkflowCredentialsInput, M as MuxAsset, A as AssetTextTrack, f as ScopedMuxAIOptions, I as ImageSubmissionMode, d as MuxAIOptions, b as ChunkingStrategy, k as VideoEmbeddingsResult, H as Hotspot, y as Shot, q as VTTCue, j as ToneType, g as StorageAdapter } from './transcripts-DuNI058z.js';
3
3
  import { z } from 'zod';
4
4
  import { S as SafetyReport, e as PromptOverrides, h as SceneContextItemV1, D as DEFAULT_DESCRIPTION_LENGTH, a as DEFAULT_SUMMARY_KEYWORD_LIMIT, b as DEFAULT_TITLE_LENGTH } from './summarization-BFmhXeAu.js';
5
5
  import { createAnthropic } from '@ai-sdk/anthropic';
6
6
  import { createGoogleGenerativeAI } from '@ai-sdk/google';
7
7
  import { createOpenAI } from '@ai-sdk/openai';
8
+ import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
9
+
10
+ /**
11
+ * What a legacy error carries across a Workflow step boundary: the pre-classification
12
+ * shape, so it revives with its end-user message.
13
+ */
14
+ interface LegacySerializedMuxAiError {
15
+ message: string;
16
+ publicType: MuxAiErrorType;
17
+ retryable: boolean;
18
+ stack?: string;
19
+ usage?: TokenUsage;
20
+ finishReason?: string;
21
+ rawFinishReason?: string;
22
+ diagnostics?: ModelCallDiagnostics;
23
+ }
24
+
25
+ /**
26
+ * Public error categories for job outcomes. One list for the SDK and its consumers,
27
+ * which may extend it with their own types (e.g. request-time HTTP errors). Treat
28
+ * `type` as an open string, so adding a value is not a breaking change.
29
+ */
30
+ declare const MUX_AI_ERROR_TYPES: {
31
+ /** The request, the asset or the account can't be used as it is. */
32
+ readonly VALIDATION_ERROR: "validation_error";
33
+ /** The work was attempted and failed. */
34
+ readonly PROCESSING_ERROR: "processing_error";
35
+ /** The work didn't finish in time. */
36
+ readonly TIMEOUT_ERROR: "timeout_error";
37
+ /** Content was refused by a content policy. */
38
+ readonly CONTENT_POLICY_ERROR: "content_policy_error";
39
+ /** A service is rate limiting or over capacity. */
40
+ readonly CAPACITY_ERROR: "capacity_error";
41
+ /** A fault in this code or its configuration. */
42
+ readonly SERVER_ERROR: "server_error";
43
+ };
44
+ type MuxAiErrorType = typeof MUX_AI_ERROR_TYPES[keyof typeof MUX_AI_ERROR_TYPES];
45
+ declare const MUX_AI_ERROR_TYPE_VALUES: readonly MuxAiErrorType[];
46
+ /** Whose problem a failure is, judged from the SDK caller's side. A consumer may re-attribute it. */
47
+ declare const MUX_AI_ERROR_SOURCES: {
48
+ /** The caller's input, e.g. a scope past the end of the asset. */
49
+ readonly REQUEST: "request";
50
+ /** The Mux asset's state, e.g. no caption track in the requested language. */
51
+ readonly ASSET: "asset";
52
+ /** The Mux account or environment, e.g. missing permissions. */
53
+ readonly ACCOUNT: "account";
54
+ /** A remote service failed, e.g. the dubbing provider reported a failed dub. */
55
+ readonly UPSTREAM: "upstream";
56
+ /** This code, or the configuration of the service running it, e.g. missing signing keys. */
57
+ readonly INTERNAL: "internal";
58
+ };
59
+ type MuxAiErrorSource = typeof MUX_AI_ERROR_SOURCES[keyof typeof MUX_AI_ERROR_SOURCES];
60
+ declare const MUX_AI_ERROR_SOURCE_VALUES: readonly MuxAiErrorSource[];
61
+ /** A remote service reached over the network. Libraries in this process are not dependencies. */
62
+ declare const MUX_AI_ERROR_DEPENDENCIES: {
63
+ /** Mux Video: the API, stream and image delivery, and its static renditions and tracks. */
64
+ readonly MUX_VIDEO: "mux_video";
65
+ /** Mux Data: its API, e.g. engagement data (heatmaps and hotspots). */
66
+ readonly MUX_DATA: "mux_data";
67
+ /** A model or AI service provider, e.g. a language model API or the dubbing provider. */
68
+ readonly AI_PROVIDER: "ai_provider";
69
+ /** Object storage the SDK writes to or reads from, e.g. an S3-compatible bucket. */
70
+ readonly STORAGE: "storage";
71
+ };
72
+ type MuxAiErrorDependency = typeof MUX_AI_ERROR_DEPENDENCIES[keyof typeof MUX_AI_ERROR_DEPENDENCIES];
73
+ declare const MUX_AI_ERROR_DEPENDENCY_VALUES: readonly MuxAiErrorDependency[];
74
+ type MuxAiErrorFactValue = string | number | boolean | null | MuxAiErrorFactValue[] | {
75
+ [key: string]: MuxAiErrorFactValue;
76
+ };
77
+ /**
78
+ * Details of one occurrence, JSON-safe so they survive step boundaries. Internal by
79
+ * default: a consumer chooses what, if anything, to show. Dependency errors always
80
+ * carry `call` (the outside call's snake_case name), plus `status` and `requestId`
81
+ * when there was a response.
82
+ */
83
+ type MuxAiErrorFacts = Readonly<Record<string, MuxAiErrorFactValue>>;
84
+ /**
85
+ * What a code implies, in any catalog built on {@link ClassifiedError}: its type,
86
+ * source and dependency, and retry overrides that hold for every occurrence.
87
+ */
88
+ /**
89
+ * A failure's source and the remote service involved, if any. An `upstream` failure is a
90
+ * remote service's, so it always names the dependency; any other source names one when a
91
+ * remote call was involved (e.g. Mux's 404 for the caller's asset).
92
+ */
93
+ type SourceAndDependency<TDependency extends string = string> = {
94
+ source: typeof MUX_AI_ERROR_SOURCES.UPSTREAM;
95
+ dependency: TDependency;
96
+ } | {
97
+ source: Exclude<MuxAiErrorSource, typeof MUX_AI_ERROR_SOURCES.UPSTREAM>;
98
+ dependency?: TDependency;
99
+ };
100
+ type ErrorCatalogEntry<TType extends string = string, TDependency extends string = string> = {
101
+ type: TType;
102
+ /** Overrides the default from {@link defaultRetryable} for every error with this code. */
103
+ retryable?: boolean;
104
+ /** Overrides the default from {@link defaultTransient} for every error with this code. */
105
+ transient?: boolean;
106
+ } & SourceAndDependency<TDependency>;
107
+ /**
108
+ * Codes for conditions precise enough to name. A code implies its type, source and
109
+ * dependency (see {@link MUX_AI_ERROR_CATALOG}), so a site raising it can't contradict
110
+ * them. Codes name the condition, never the vendor.
111
+ */
112
+ declare const MUX_AI_ERROR_CODES: {
113
+ /** The requested time range is invalid, or has nothing to work with. Facts: `reason` (`invalid_start_time`, `invalid_end_time`, `exceeds_duration`, `empty_range`, `no_video`, `no_transcript`) and the bounds involved. */
114
+ readonly INVALID_SCOPE: "invalid_scope";
115
+ /** Existing tracks block writing the output track under the chosen replacement policy. Facts: `reason` (`policy_fail`, `not_generated`, `name_collision`, `primary_audio`), `conflictingTracks` and the target track. */
116
+ readonly TRACK_REPLACEMENT_BLOCKED: "track_replacement_blocked";
117
+ /** A numeric option is outside its allowed range. Facts: `parameter` (the caller's option name), `value`, `min`, `max`, and `integer` when it must be a whole number. */
118
+ readonly PARAMETER_OUT_OF_RANGE: "parameter_out_of_range";
119
+ /** No ready caption track matches the requested track or language. Facts: `trackId` or `languageCode`, and what is available. */
120
+ readonly CAPTION_TRACK_NOT_FOUND: "caption_track_not_found";
121
+ /** The asset has no public or signed playback ID (DRM-only assets included). */
122
+ readonly PLAYBACK_ID_NOT_FOUND: "playback_id_not_found";
123
+ /** The transcript has no usable content. */
124
+ readonly TRANSCRIPT_EMPTY: "transcript_empty";
125
+ /** The asset has no valid duration, so work that depends on it can't run. Facts: `assetId`. */
126
+ readonly ASSET_DURATION_UNAVAILABLE: "asset_duration_unavailable";
127
+ /** Mux won't add an audio track to this asset. Facts: `reason` (`clip`, `live_stream`, `audio_only`). */
128
+ readonly AUDIO_TRACK_UNSUPPORTED: "audio_track_unsupported";
129
+ /** The asset's existing static rendition can't be used as a source. Facts: `reason` (`unusable`, `too_large`) and the rendition's details. */
130
+ readonly STATIC_RENDITION_UNSUPPORTED: "static_rendition_unsupported";
131
+ /** Signed playback needs signing keys the service running the SDK didn't provide. */
132
+ readonly SIGNING_CREDENTIALS_MISSING: "signing_credentials_missing";
133
+ /** Storage is needed but the service running the SDK didn't configure it. */
134
+ readonly STORAGE_NOT_CONFIGURED: "storage_not_configured";
135
+ /** The model provider refused the content. Facts: `reason` and `category`. */
136
+ readonly CONTENT_POLICY_BLOCKED: "content_policy_blocked";
137
+ /** The model returned no output, or a required field was empty. Facts: `call`, `provider`, `model`, and `assetId` when there is one. */
138
+ readonly MODEL_OUTPUT_MISSING: "model_output_missing";
139
+ /** The model's output breaks the expected shape or constraints (counts, allowed values, limits). Facts: `call`, `provider`, `model`, and `assetId` when there is one. */
140
+ readonly MODEL_OUTPUT_INVALID: "model_output_invalid";
141
+ /** The model's output was withheld by the SDK's output safety filter (a suspected prompt leak). */
142
+ readonly MODEL_OUTPUT_SUPPRESSED: "model_output_suppressed";
143
+ /** The model stopped early for a reason other than the length limit. */
144
+ readonly MODEL_OUTPUT_INCOMPLETE: "model_output_incomplete";
145
+ /** The model hit the output length limit. */
146
+ readonly MODEL_OUTPUT_TRUNCATED: "model_output_truncated";
147
+ /** Mux reported the static rendition a workflow needs as errored. */
148
+ readonly STATIC_RENDITION_FAILED: "static_rendition_failed";
149
+ /** The dubbing provider doesn't support the requested language. Facts: `language` and `which` (`target` or `source`). */
150
+ readonly DUBBING_LANGUAGE_UNSUPPORTED: "dubbing_language_unsupported";
151
+ /** The dubbing provider ran the dub and reported it failed. Facts: `providerError`, the provider's display text, when it gave one. */
152
+ readonly DUBBING_FAILED: "dubbing_failed";
153
+ };
154
+ type MuxAiErrorCode = typeof MUX_AI_ERROR_CODES[keyof typeof MUX_AI_ERROR_CODES];
155
+ declare const MUX_AI_ERROR_CODE_VALUES: readonly MuxAiErrorCode[];
156
+ /** The classification and retry policy each code implies. */
157
+ declare const MUX_AI_ERROR_CATALOG: {
158
+ readonly invalid_scope: {
159
+ readonly type: "validation_error";
160
+ readonly source: "request";
161
+ };
162
+ readonly track_replacement_blocked: {
163
+ readonly type: "validation_error";
164
+ readonly source: "request";
165
+ };
166
+ readonly parameter_out_of_range: {
167
+ readonly type: "validation_error";
168
+ readonly source: "request";
169
+ };
170
+ readonly caption_track_not_found: {
171
+ readonly type: "validation_error";
172
+ readonly source: "asset";
173
+ };
174
+ readonly playback_id_not_found: {
175
+ readonly type: "validation_error";
176
+ readonly source: "asset";
177
+ };
178
+ readonly asset_duration_unavailable: {
179
+ readonly type: "validation_error";
180
+ readonly source: "asset";
181
+ };
182
+ readonly transcript_empty: {
183
+ readonly type: "validation_error";
184
+ readonly source: "asset";
185
+ };
186
+ readonly audio_track_unsupported: {
187
+ readonly type: "validation_error";
188
+ readonly source: "asset";
189
+ };
190
+ readonly static_rendition_unsupported: {
191
+ readonly type: "validation_error";
192
+ readonly source: "asset";
193
+ };
194
+ readonly signing_credentials_missing: {
195
+ readonly type: "server_error";
196
+ readonly source: "internal";
197
+ };
198
+ readonly storage_not_configured: {
199
+ readonly type: "server_error";
200
+ readonly source: "internal";
201
+ };
202
+ readonly content_policy_blocked: {
203
+ readonly type: "content_policy_error";
204
+ readonly source: "asset";
205
+ readonly dependency: "ai_provider";
206
+ };
207
+ readonly model_output_missing: {
208
+ readonly type: "processing_error";
209
+ readonly source: "upstream";
210
+ readonly dependency: "ai_provider";
211
+ readonly transient: false;
212
+ readonly retryable: false;
213
+ };
214
+ readonly model_output_invalid: {
215
+ readonly type: "processing_error";
216
+ readonly source: "upstream";
217
+ readonly dependency: "ai_provider";
218
+ readonly transient: false;
219
+ readonly retryable: false;
220
+ };
221
+ readonly model_output_suppressed: {
222
+ readonly type: "processing_error";
223
+ readonly source: "upstream";
224
+ readonly dependency: "ai_provider";
225
+ readonly transient: false;
226
+ readonly retryable: false;
227
+ };
228
+ readonly model_output_incomplete: {
229
+ readonly type: "processing_error";
230
+ readonly source: "upstream";
231
+ readonly dependency: "ai_provider";
232
+ readonly transient: false;
233
+ };
234
+ readonly model_output_truncated: {
235
+ readonly type: "processing_error";
236
+ readonly source: "internal";
237
+ readonly dependency: "ai_provider";
238
+ };
239
+ readonly static_rendition_failed: {
240
+ readonly type: "processing_error";
241
+ readonly source: "upstream";
242
+ readonly dependency: "mux_video";
243
+ readonly transient: false;
244
+ readonly retryable: false;
245
+ };
246
+ readonly dubbing_language_unsupported: {
247
+ readonly type: "validation_error";
248
+ readonly source: "request";
249
+ readonly dependency: "ai_provider";
250
+ };
251
+ readonly dubbing_failed: {
252
+ readonly type: "processing_error";
253
+ readonly source: "upstream";
254
+ readonly dependency: "ai_provider";
255
+ readonly transient: false;
256
+ };
257
+ };
258
+ interface ModelCallDiagnostics {
259
+ phase: "brief" | "draft" | "format_repair" | "length_repair";
260
+ provider: string;
261
+ modelId: string;
262
+ maxOutputTokens?: number;
263
+ }
264
+ /**
265
+ * No response, a timeout, "too early", rate limiting or a server error: worth retrying.
266
+ * A 409 is not: unlike the AI SDK's own retry loop, a conflict here means state that
267
+ * a retry would hit again.
268
+ */
269
+ declare function isTransientStatus(status: number | undefined): boolean;
270
+ /** A short record of one raw cause, kept across step boundaries in place of the cause itself. */
271
+ interface ErrorCauseSummary {
272
+ name: string;
273
+ message: string;
274
+ status?: number;
275
+ }
276
+ /**
277
+ * The classification a coded site states: the code, and the type, source and dependency
278
+ * its catalog entry implies. Each code accepts only its own, so a site reads on its own
279
+ * and can't contradict the catalog.
280
+ */
281
+ type CodedClassification<TCatalog extends Readonly<Record<string, ErrorCatalogEntry>>> = {
282
+ [C in keyof TCatalog & string]: {
283
+ code: C;
284
+ type: TCatalog[C]["type"];
285
+ source: TCatalog[C]["source"];
286
+ } & (TCatalog[C] extends {
287
+ dependency: infer D extends string;
288
+ } ? {
289
+ dependency: D;
290
+ } : {
291
+ dependency?: never;
292
+ });
293
+ }[keyof TCatalog & string];
294
+ /**
295
+ * How a site classifies an error: always a type and source (with the dependency for an
296
+ * `upstream` failure), plus a code when the condition has one, plus what varies. With a
297
+ * catalog type (`TCatalog`), a code accepts only the type, source and dependency its
298
+ * catalog entry implies.
299
+ */
300
+ type ClassifiedErrorInit<TType extends string, TCode extends string, TDependency extends string, TCatalog extends Readonly<Record<string, ErrorCatalogEntry>> = never> = (([TCatalog] extends [never] ? ({
301
+ code: TCode;
302
+ type: TType;
303
+ } & SourceAndDependency<TDependency>) : CodedClassification<TCatalog>) | ({
304
+ code?: never;
305
+ type: TType;
306
+ } & SourceAndDependency<TDependency>)) & {
307
+ facts?: MuxAiErrorFacts;
308
+ /**
309
+ * Whether submitting the same job again, unchanged, may succeed. Not "fixable":
310
+ * whether the caller can change something first is what `source` and `code` say.
311
+ * Defaults from the classification ({@link defaultRetryable}); set it only to
312
+ * override, with a comment saying why. Ignored when the error is transient.
313
+ */
314
+ retryable?: boolean;
315
+ /**
316
+ * Whether the step runner should retry the step. Defaults from the classification
317
+ * ({@link defaultTransient}); set it only to override, with a comment saying why
318
+ * (e.g. a call that isn't idempotent).
319
+ */
320
+ transient?: boolean;
321
+ /** The raw cause. Kept locally only; a bounded summary crosses step boundaries. */
322
+ cause?: unknown;
323
+ };
324
+ type MuxAiErrorInit = ClassifiedErrorInit<MuxAiErrorType, MuxAiErrorCode, MuxAiErrorDependency, typeof MUX_AI_ERROR_CATALOG>;
325
+ /**
326
+ * A classified error's fields as JSON-safe data, for a subclass's Workflow serializer
327
+ * (see {@link serializeClassification} and {@link restoreClassification}).
328
+ */
329
+ interface SerializedClassification<TType extends string = string, TCode extends string = string, TDependency extends string = string> {
330
+ message: string;
331
+ type: TType;
332
+ source: MuxAiErrorSource;
333
+ dependency?: TDependency;
334
+ code?: TCode;
335
+ facts: MuxAiErrorFacts;
336
+ retryable: boolean;
337
+ transient: boolean;
338
+ causes: ErrorCauseSummary[];
339
+ stack?: string;
340
+ }
341
+ /**
342
+ * What crosses a Workflow step boundary. A run replays the events it already wrote,
343
+ * so `v` is bumped on a shape change and earlier versions stay readable.
344
+ */
345
+ interface SerializedMuxAiError extends SerializedClassification<MuxAiErrorType, MuxAiErrorCode, MuxAiErrorDependency> {
346
+ v: 2;
347
+ usage?: TokenUsage;
348
+ finishReason?: string;
349
+ rawFinishReason?: string;
350
+ diagnostics?: ModelCallDiagnostics;
351
+ }
352
+ /**
353
+ * The shared error model: a `type` and `source` on every instance, a `dependency`
354
+ * for remote failures, a `code` for conditions precise enough to name, JSON-safe
355
+ * `facts`, and a retry policy derived from the classification. `message` is internal
356
+ * detail, never end-user text (see `createPublicErrorView()`).
357
+ *
358
+ * `MuxAiError` is built on it, and consumers can build their own errors on it with
359
+ * their own type list, code catalog and dependencies, so policy, serialization and
360
+ * the public view work the same way everywhere. A subclass supplies its catalog,
361
+ * a brand for its own `is()`, and Workflow serializer hooks built from
362
+ * {@link serializeClassification} and {@link restoreClassification}.
363
+ */
364
+ declare class ClassifiedError<TType extends string = string, TCode extends string = string, TDependency extends string = string> extends Error {
365
+ /** Structural brand shared by every classified error, for duck-type identification across realms. */
366
+ readonly __classified_error = true;
367
+ readonly type: TType;
368
+ readonly source: MuxAiErrorSource;
369
+ readonly dependency?: TDependency;
370
+ readonly code?: TCode;
371
+ readonly facts: MuxAiErrorFacts;
372
+ /** Whether submitting the same job again, unchanged, may succeed. Always true when transient. */
373
+ readonly retryable: boolean;
374
+ /**
375
+ * Whether the step runner should retry the step. Workflow DevKit skips retries
376
+ * for errors named `FatalError`, so only non-transient errors take that name.
377
+ */
378
+ readonly transient: boolean;
379
+ /** Raw cause; non-enumerable, local only. */
380
+ readonly cause?: unknown;
381
+ /** Bounded summary of the cause chain; non-enumerable, crosses step boundaries. */
382
+ readonly causes: ErrorCauseSummary[];
383
+ constructor(message: string, init: ClassifiedErrorInit<TType, TCode, TDependency>, catalog: Readonly<Partial<Record<TCode, ErrorCatalogEntry<TType, TDependency>>>>);
384
+ /** Whether `value` is any classified error, from this copy of the SDK or another. */
385
+ static isClassified(value: unknown): value is ClassifiedError;
386
+ }
387
+ /** The classification of `error`, for a subclass's `WORKFLOW_SERIALIZE` hook. */
388
+ declare function serializeClassification<TType extends string, TCode extends string, TDependency extends string>(error: ClassifiedError<TType, TCode, TDependency>): SerializedClassification<TType, TCode, TDependency>;
389
+ /**
390
+ * The constructor options that rebuild a serialized classification, for a
391
+ * subclass's `WORKFLOW_DESERIALIZE` hook; follow with {@link restoreClassification}.
392
+ * The stored classification wins over the catalog's current mapping for a code.
393
+ */
394
+ declare function classificationInit<TType extends string, TCode extends string, TDependency extends string>(record: SerializedClassification<TType, TCode, TDependency>): ClassifiedErrorInit<TType, TCode, TDependency>;
395
+ /** Restores what the constructor can't take back: the code, the cause summaries and the stack. */
396
+ declare function restoreClassification<T extends ClassifiedError>(error: T, record: SerializedClassification): T;
397
+ /**
398
+ * A classified @mux/ai failure, built on {@link ClassifiedError} with the SDK's
399
+ * catalog. `message` is internal detail for developers and logs, never end-user
400
+ * text: render what end users see with `toPublicError()`, which only exposes
401
+ * allowlisted codes and facts. See docs/ERRORS.md.
402
+ *
403
+ * Fields, not subclasses, carry the classification: a custom Workflow codec keeps
404
+ * them across step boundaries, and every subclass revives as `MuxAiError`.
405
+ */
406
+ declare class MuxAiError extends ClassifiedError<MuxAiErrorType, MuxAiErrorCode, MuxAiErrorDependency> {
407
+ /** Structural brand for duck-type identification across copies of the SDK. */
408
+ readonly __mux_ai_error = true;
409
+ usage?: TokenUsage;
410
+ diagnostics?: ModelCallDiagnostics;
411
+ constructor(message: string, init: MuxAiErrorInit);
412
+ static is(value: unknown): value is MuxAiError;
413
+ static [WORKFLOW_SERIALIZE](instance: MuxAiError): SerializedMuxAiError | LegacySerializedMuxAiError;
414
+ static [WORKFLOW_DESERIALIZE](value: SerializedMuxAiError): MuxAiError;
415
+ }
416
+ /**
417
+ * Prepares free text from a dependency (a provider's failure reason, a raw error
418
+ * message) for an error's facts: URL tokens stripped, high-confidence prompt leaks
419
+ * suppressed, length capped.
420
+ */
421
+ declare function errorDetailFact(text: string, maxLength?: number): string;
422
+ /**
423
+ * Re-throws a classified error unchanged, merging any `facts` into it (its own
424
+ * values win). Anything else becomes an `internal` error: a remote failure would
425
+ * already have been classified where the call was made, so what reaches here
426
+ * unclassified is this code's own failure.
427
+ *
428
+ * Use this in catch blocks that re-throw, so a classified error from a callee
429
+ * keeps its classification. Token usage carries over either way.
430
+ */
431
+ declare function wrapError(error: unknown, message: string, facts?: MuxAiErrorFacts): never;
432
+ /**
433
+ * This code's own failure: a broken invariant, an unexpected shape it produced, or
434
+ * an in-process library throwing. Use it instead of `throw new Error(...)`.
435
+ */
436
+ declare function internalError(message: string, facts?: MuxAiErrorFacts, cause?: unknown): MuxAiError;
437
+ /** Exhaustiveness guard for switch statements over closed unions. */
438
+ declare function assertNever(value: never, what?: string): never;
8
439
 
9
440
  /**
10
441
  * Language Code Conversion Utilities
@@ -242,13 +673,29 @@ interface TextTrackSummary {
242
673
  primary?: boolean;
243
674
  }
244
675
  type TrackSummary = TextTrackSummary;
245
- type TextTrackReplacementPlan = {
246
- kind: "clear";
247
- } | {
676
+ /**
677
+ * Why a replacement was blocked:
678
+ *
679
+ * - `policy_fail`: the `fail` policy and a conflicting track exists.
680
+ * - `not_generated`: `replace_generated` and a conflicting track is not Mux-generated.
681
+ * - `name_collision`: another track already has the target's name.
682
+ * - `primary_audio`: the asset's primary audio track conflicts; it can never be replaced.
683
+ */
684
+ type TrackReplacementBlockedReason = "policy_fail" | "not_generated" | "name_collision" | "primary_audio";
685
+ interface TrackReplacementBlocked {
248
686
  kind: "blocked";
687
+ /** Human-readable explanation naming the conflicting tracks. */
249
688
  reason: string;
689
+ /** Machine-readable reason for the block. */
690
+ code: TrackReplacementBlockedReason;
691
+ /** The conflicting tracks. */
250
692
  tracks: TextTrackSummary[];
251
- } | {
693
+ /** Whether any conflicting track matched on language (rather than only on name). */
694
+ conflictsOnLanguage: boolean;
695
+ }
696
+ type TextTrackReplacementPlan = {
697
+ kind: "clear";
698
+ } | TrackReplacementBlocked | {
252
699
  kind: "replace";
253
700
  toDelete: TextTrackSummary[];
254
701
  };
@@ -261,12 +708,9 @@ type ReplaceAndCreateTextTrackResult = {
261
708
  kind: "created";
262
709
  trackId: string;
263
710
  deleted: TextTrackSummary[];
264
- } | {
265
- kind: "blocked";
266
- reason: string;
267
- tracks: TextTrackSummary[];
711
+ } | (TrackReplacementBlocked & {
268
712
  deleted: TextTrackSummary[];
269
- } | {
713
+ }) | {
270
714
  kind: "create_failed";
271
715
  reason: string;
272
716
  deleted: TextTrackSummary[];
@@ -303,6 +747,18 @@ declare function planTextTrackReplacement(asset: MuxAsset, target: TextTrackTarg
303
747
  declare function planSourceTrackReplacement(asset: MuxAsset, sourceTrackId: string, target: TextTrackTarget, policy: SourceTrackReplacementPolicy): TextTrackReplacementPlan;
304
748
  /** True for Mux's `400 invalid_parameters` "Track name 'X' is not unique" rejection. */
305
749
  declare function isDuplicateTrackNameError(error: unknown): boolean;
750
+ /** The track a write was for, as error facts: `trackType`, `languageCode` and `trackName`. */
751
+ declare function trackTargetFacts(target: TextTrackTarget): MuxAiErrorFacts;
752
+ /**
753
+ * The error for a blocked replacement plan or outcome. The caller chose the policy
754
+ * and the name, so it is `track_replacement_blocked` (`request`), except the
755
+ * asset's primary audio in the target's language: no option avoids that, so it is
756
+ * the `asset`'s.
757
+ */
758
+ declare function trackReplacementBlockedError(blocked: Pick<TrackReplacementBlocked, "reason" | "code" | "tracks" | "conflictsOnLanguage">, options?: {
759
+ message?: string;
760
+ facts?: MuxAiErrorFacts;
761
+ }): MuxAiError;
306
762
  /** Default audit tag written to `passthrough` on tracks created by `@mux/ai`. */
307
763
  declare function buildMuxAiTrackPassthrough(workflow: string): string;
308
764
  declare function validateTrackPassthrough(passthrough: string | undefined): string | undefined;
@@ -2308,4 +2764,4 @@ declare namespace index {
2308
2764
  export { index_ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH as ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH, index_ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH as ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH, index_ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL as ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL, index_ASK_QUESTIONS_MAX_QUESTION_LENGTH as ASK_QUESTIONS_MAX_QUESTION_LENGTH, type index_AskQuestionsOptions as AskQuestionsOptions, type index_AskQuestionsResult as AskQuestionsResult, type index_AskQuestionsType as AskQuestionsType, type index_AudioTranslationOptions as AudioTranslationOptions, type index_AudioTranslationResult as AudioTranslationResult, type index_AutoCensorProfanityOptions as AutoCensorProfanityOptions, type index_BurnedInCaptionsAnalysis as BurnedInCaptionsAnalysis, type index_BurnedInCaptionsOptions as BurnedInCaptionsOptions, type index_BurnedInCaptionsPromptOverrides as BurnedInCaptionsPromptOverrides, type index_BurnedInCaptionsPromptSections as BurnedInCaptionsPromptSections, type index_BurnedInCaptionsResult as BurnedInCaptionsResult, type index_CaptionReplacement as CaptionReplacement, type index_CensorMode as CensorMode, type index_Chapter as Chapter, type index_ChapterSystemPromptSections as ChapterSystemPromptSections, type index_ChaptersOptions as ChaptersOptions, type index_ChaptersPromptOverrides as ChaptersPromptOverrides, type index_ChaptersPromptSections as ChaptersPromptSections, type index_ChaptersResult as ChaptersResult, type index_ChaptersType as ChaptersType, index_DEFAULT_DESCRIPTION_LENGTH as DEFAULT_DESCRIPTION_LENGTH, index_DEFAULT_SUMMARY_KEYWORD_LIMIT as DEFAULT_SUMMARY_KEYWORD_LIMIT, index_DEFAULT_TITLE_LENGTH as DEFAULT_TITLE_LENGTH, index_DEFAULT_TRANSCRIPT_WINDOWING as DEFAULT_TRANSCRIPT_WINDOWING, type index_DubbedCaptionsOutcome as DubbedCaptionsOutcome, type index_EditCaptionsOptions as EditCaptionsOptions, type index_EditCaptionsResult as EditCaptionsResult, type index_EmbeddingsOptions as EmbeddingsOptions, type index_EmbeddingsResult as EmbeddingsResult, type index_EngagementInsightsOptions as EngagementInsightsOptions, type index_EngagementInsightsResult as EngagementInsightsResult, index_GENERATE_TEXT_CALLS_TO_ACTION as GENERATE_TEXT_CALLS_TO_ACTION, index_GENERATE_TEXT_CHANNELS as GENERATE_TEXT_CHANNELS, index_GENERATE_TEXT_CHANNEL_CEILINGS as GENERATE_TEXT_CHANNEL_CEILINGS, index_GENERATE_TEXT_FORMATS as GENERATE_TEXT_FORMATS, index_GENERATE_TEXT_LENGTH_BOUNDS as GENERATE_TEXT_LENGTH_BOUNDS, index_GENERATE_TEXT_MAX_ARTIFACTS as GENERATE_TEXT_MAX_ARTIFACTS, index_GENERATE_TEXT_MAX_AUDIENCE_CHARS as GENERATE_TEXT_MAX_AUDIENCE_CHARS, index_GENERATE_TEXT_MAX_BRAND_TERMS as GENERATE_TEXT_MAX_BRAND_TERMS, index_GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS as GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS, index_GENERATE_TEXT_MAX_BRAND_TERM_CHARS as GENERATE_TEXT_MAX_BRAND_TERM_CHARS, index_GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS as GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS, index_GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS as GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS, index_GENERATE_TEXT_MAX_SHOT_FRAMES as GENERATE_TEXT_MAX_SHOT_FRAMES, index_GENERATE_TEXT_MAX_VARIANTS as GENERATE_TEXT_MAX_VARIANTS, index_GENERATE_TEXT_VOICES as GENERATE_TEXT_VOICES, index_GOOGLE_VISION_LIKELIHOOD_TO_SCORE as GOOGLE_VISION_LIKELIHOOD_TO_SCORE, type index_GenerateTextArtifact as GenerateTextArtifact, type index_GenerateTextCallToAction as GenerateTextCallToAction, type index_GenerateTextChannel as GenerateTextChannel, type index_GenerateTextFormat as GenerateTextFormat, type index_GenerateTextKeyedItem as GenerateTextKeyedItem, type index_GenerateTextLengthLimit as GenerateTextLengthLimit, type index_GenerateTextOptions as GenerateTextOptions, type index_GenerateTextResult as GenerateTextResult, type index_GenerateTextVariant as GenerateTextVariant, type index_GenerateTextVoice as GenerateTextVoice, type index_GeneratedTextArtifact as GeneratedTextArtifact, type index_GeneratedTextVariant as GeneratedTextVariant, index_HIVE_SEXUAL_CATEGORIES as HIVE_SEXUAL_CATEGORIES, index_HIVE_VIOLENCE_CATEGORIES as HIVE_VIOLENCE_CATEGORIES, type index_HiveModerationOutput as HiveModerationOutput, type index_HiveModerationSource as HiveModerationSource, type index_ModerationOptions as ModerationOptions, type index_ModerationProvider as ModerationProvider, type index_ModerationResult as ModerationResult, type index_ModerationSurfaceStatus as ModerationSurfaceStatus, type index_MomentInsight as MomentInsight, type index_OverallInsight as OverallInsight, type index_ProfanityDetectionPayload as ProfanityDetectionPayload, type index_Question as Question, type index_QuestionAnswer as QuestionAnswer, type index_QuestionAnswerType as QuestionAnswerType, type index_RepairAttempt as RepairAttempt, type index_RepairCall as RepairCall, type index_RepairOptions as RepairOptions, type index_RepairPlan as RepairPlan, type index_RepairResult as RepairResult, type index_RepairSpan as RepairSpan, type index_ReplacementRecord as ReplacementRecord, type index_SpeakerReplacement as SpeakerReplacement, type index_StaticRenditionCleanupOutcome as StaticRenditionCleanupOutcome, type index_SummarizationOptions as SummarizationOptions, type index_SummarizationPromptOverrides as SummarizationPromptOverrides, type index_SummarizationPromptSections as SummarizationPromptSections, type index_SummaryAndTagsResult as SummaryAndTagsResult, type index_SummaryType as SummaryType, type index_TextLengthLimit as TextLengthLimit, type index_TextRepairModelOptions as TextRepairModelOptions, type index_ThumbnailModerationScore as ThumbnailModerationScore, type index_ThumbnailModerationSkipReason as ThumbnailModerationSkipReason, type index_ThumbnailModerationStatus as ThumbnailModerationStatus, type index_TranscriptModerationScore as TranscriptModerationScore, type index_TranscriptModerationSkipReason as TranscriptModerationSkipReason, type index_TranscriptModerationStatus as TranscriptModerationStatus, type index_TranslationChunkingOptions as TranslationChunkingOptions, type index_TranslationOptions as TranslationOptions, type index_TranslationPayload as TranslationPayload, type index_TranslationResult as TranslationResult, index_aggregateTokenUsage as aggregateTokenUsage, index_applyOverrideLists as applyOverrideLists, index_applyReplacements as applyReplacements, index_applySpeakerReplacements as applySpeakerReplacements, index_applyTextRepair as applyTextRepair, index_askQuestions as askQuestions, index_buildReplacementRegex as buildReplacementRegex, index_buildTranscriptWindows as buildTranscriptWindows, index_burnedInCaptionsSchema as burnedInCaptionsSchema, index_censorVttContent as censorVttContent, index_chapterSchema as chapterSchema, index_chaptersSchema as chaptersSchema, index_createReplacer as createReplacer, index_createTextRepairGenerator as createTextRepairGenerator, index_editCaptions as editCaptions, index_extractTranscriptSegmentsForHotspots as extractTranscriptSegmentsForHotspots, index_findGenerateTextLengthViolation as findGenerateTextLengthViolation, index_generateChapters as generateChapters, index_generateEmbeddings as generateEmbeddings, index_generateEngagementInsights as generateEngagementInsights, index_generateText as generateText, index_generateVideoEmbeddings as generateVideoEmbeddings, index_getModerationScores as getModerationScores, index_getSummaryAndTags as getSummaryAndTags, index_hasBurnedInCaptions as hasBurnedInCaptions, index_mapShotsToHotspots as mapShotsToHotspots, index_measureGenerateTextLength as measureGenerateTextLength, index_normalizeTranslatedVtt as normalizeTranslatedVtt, index_planTextRepair as planTextRepair, index_profanityDetectionSchema as profanityDetectionSchema, index_questionAnswerSchema as questionAnswerSchema, index_repairJsonSchema as repairJsonSchema, index_repairText as repairText, index_resolveGenerateTextLengthLimit as resolveGenerateTextLengthLimit, index_resolveGenerateTextLengthLimits as resolveGenerateTextLengthLimits, index_resolveGenerateTextOptions as resolveGenerateTextOptions, index_runTextRepairLoop as runTextRepairLoop, index_selectGenerateTextShotFrames as selectGenerateTextShotFrames, index_shouldSplitChunkTranslationError as shouldSplitChunkTranslationError, index_summarySchema as summarySchema, index_transformCueText as transformCueText, index_translateAudio as translateAudio, index_translateCaptions as translateCaptions, index_translationSchema as translationSchema, index_validateNeverTranslateTerms as validateNeverTranslateTerms, index_verifyNeverTranslateTerms as verifyNeverTranslateTerms };
2309
2765
  }
2310
2766
 
2311
- export { type BurnedInCaptionsPromptSections as $, replaceAndCreateTextTrack as A, replaceAndCreateTrack as B, replaceSourceTrack as C, summarizeTextTrack as D, toISO639_1 as E, toISO639_3 as F, validateTrackPassthrough as G, index as H, type ISO639_1 as I, ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH as J, ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH as K, type LanguageCodePair as L, MUX_TRACK_PASSTHROUGH_MAX_CHARS as M, ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL as N, ASK_QUESTIONS_MAX_QUESTION_LENGTH as O, type AskQuestionsOptions as P, type AskQuestionsResult as Q, type ReplaceAndCreateTextTrackInput as R, type SourceTrackReplacementPolicy as S, type TextTrackReplacementPlan as T, type AskQuestionsType as U, type AudioTranslationOptions as V, type AudioTranslationResult as W, type AutoCensorProfanityOptions as X, type BurnedInCaptionsAnalysis as Y, type BurnedInCaptionsOptions as Z, type BurnedInCaptionsPromptOverrides as _, type ISO639_3 as a, type RepairPlan as a$, type BurnedInCaptionsResult as a0, type CaptionReplacement as a1, type CensorMode as a2, type Chapter as a3, type ChapterSystemPromptSections as a4, type ChaptersOptions as a5, type ChaptersPromptOverrides as a6, type ChaptersPromptSections as a7, type ChaptersResult as a8, type ChaptersType as a9, type GenerateTextChannel as aA, type GenerateTextFormat as aB, type GenerateTextKeyedItem as aC, type GenerateTextLengthLimit as aD, type GenerateTextOptions as aE, type GenerateTextResult as aF, type GenerateTextVariant as aG, type GenerateTextVoice as aH, type GeneratedTextArtifact as aI, type GeneratedTextVariant as aJ, HIVE_SEXUAL_CATEGORIES as aK, HIVE_VIOLENCE_CATEGORIES as aL, type HiveModerationOutput as aM, type HiveModerationSource as aN, type ModerationOptions as aO, type ModerationProvider as aP, type ModerationResult as aQ, type ModerationSurfaceStatus as aR, type MomentInsight as aS, type OverallInsight as aT, type ProfanityDetectionPayload as aU, type Question as aV, type QuestionAnswer as aW, type QuestionAnswerType as aX, type RepairAttempt as aY, type RepairCall as aZ, type RepairOptions as a_, DEFAULT_TRANSCRIPT_WINDOWING as aa, type DubbedCaptionsOutcome as ab, type EditCaptionsOptions as ac, type EditCaptionsResult as ad, type EmbeddingsOptions as ae, type EmbeddingsResult as af, type EngagementInsightsOptions as ag, type EngagementInsightsResult as ah, GENERATE_TEXT_CALLS_TO_ACTION as ai, GENERATE_TEXT_CHANNELS as aj, GENERATE_TEXT_CHANNEL_CEILINGS as ak, GENERATE_TEXT_FORMATS as al, GENERATE_TEXT_LENGTH_BOUNDS as am, GENERATE_TEXT_MAX_ARTIFACTS as an, GENERATE_TEXT_MAX_AUDIENCE_CHARS as ao, GENERATE_TEXT_MAX_BRAND_TERMS as ap, GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS as aq, GENERATE_TEXT_MAX_BRAND_TERM_CHARS as ar, GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS as as, GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS as at, GENERATE_TEXT_MAX_SHOT_FRAMES as au, GENERATE_TEXT_MAX_VARIANTS as av, GENERATE_TEXT_VOICES as aw, GOOGLE_VISION_LIKELIHOOD_TO_SCORE as ax, type GenerateTextArtifact as ay, type GenerateTextCallToAction as az, type ReplaceAndCreateTextTrackResult as b, translateAudio as b$, type RepairResult as b0, type RepairSpan as b1, type ReplacementRecord as b2, type SpeakerReplacement as b3, type StaticRenditionCleanupOutcome as b4, type SummarizationOptions as b5, type SummarizationPromptOverrides as b6, type SummarizationPromptSections as b7, type SummaryAndTagsResult as b8, type SummaryType as b9, editCaptions as bA, extractTranscriptSegmentsForHotspots as bB, findGenerateTextLengthViolation as bC, generateChapters as bD, generateEmbeddings as bE, generateEngagementInsights as bF, generateText as bG, generateVideoEmbeddings as bH, getModerationScores as bI, getSummaryAndTags as bJ, hasBurnedInCaptions as bK, mapShotsToHotspots as bL, measureGenerateTextLength as bM, normalizeTranslatedVtt as bN, planTextRepair as bO, profanityDetectionSchema as bP, questionAnswerSchema as bQ, repairJsonSchema as bR, repairText as bS, resolveGenerateTextLengthLimit as bT, resolveGenerateTextLengthLimits as bU, resolveGenerateTextOptions as bV, runTextRepairLoop as bW, selectGenerateTextShotFrames as bX, shouldSplitChunkTranslationError as bY, summarySchema as bZ, transformCueText as b_, type TextLengthLimit as ba, type TextRepairModelOptions as bb, type ThumbnailModerationScore as bc, type ThumbnailModerationSkipReason as bd, type ThumbnailModerationStatus as be, type TranscriptModerationScore as bf, type TranscriptModerationSkipReason as bg, type TranscriptModerationStatus as bh, type TranslationChunkingOptions as bi, type TranslationOptions as bj, type TranslationPayload as bk, type TranslationResult as bl, aggregateTokenUsage as bm, applyOverrideLists as bn, applyReplacements as bo, applySpeakerReplacements as bp, applyTextRepair as bq, askQuestions as br, buildReplacementRegex as bs, buildTranscriptWindows as bt, burnedInCaptionsSchema as bu, censorVttContent as bv, chapterSchema as bw, chaptersSchema as bx, createReplacer as by, createTextRepairGenerator as bz, type ReplaceAndCreateTrackInput as c, translateCaptions as c0, translationSchema as c1, validateNeverTranslateTerms as c2, verifyNeverTranslateTerms as c3, type ReplaceExistingTracksPolicy as d, type ReplaceSourceTrackInput as e, type ReplaceableTrackType as f, type SupportedISO639_1 as g, type SupportedISO639_3 as h, type TextTrackSummary as i, type TextTrackTarget as j, type TrackSummary as k, type TrackTarget as l, buildMuxAiTrackPassthrough as m, findNameCollisionTextTracks as n, findSameLanguageTextTracks as o, getLanguageCodePair as p, getLanguageName as q, isDuplicateTrackNameError as r, isMuxGeneratedTextTrack as s, isUndeterminedLanguageCode as t, isValidISO639_1 as u, isValidISO639_3 as v, normalizeTrackLanguageCode as w, normalizeTrackName as x, planSourceTrackReplacement as y, planTextTrackReplacement as z };
2767
+ export { isDuplicateTrackNameError as $, type SourceAndDependency as A, type SourceTrackReplacementPolicy as B, ClassifiedError as C, type SupportedISO639_1 as D, type ErrorCatalogEntry as E, type SupportedISO639_3 as F, type TextTrackSummary as G, type TextTrackTarget as H, type ISO639_1 as I, type TrackReplacementBlocked as J, type TrackReplacementBlockedReason as K, type LanguageCodePair as L, type MuxAiErrorDependency as M, type TrackSummary as N, type TrackTarget as O, assertNever as P, buildMuxAiTrackPassthrough as Q, type ReplaceAndCreateTextTrackInput as R, type SerializedClassification as S, type TextTrackReplacementPlan as T, classificationInit as U, errorDetailFact as V, findNameCollisionTextTracks as W, findSameLanguageTextTracks as X, getLanguageCodePair as Y, getLanguageName as Z, internalError as _, type MuxAiErrorFacts as a, GENERATE_TEXT_MAX_BRAND_TERM_CHARS as a$, isMuxGeneratedTextTrack as a0, isTransientStatus as a1, isUndeterminedLanguageCode as a2, isValidISO639_1 as a3, isValidISO639_3 as a4, normalizeTrackLanguageCode as a5, normalizeTrackName as a6, planSourceTrackReplacement as a7, planTextTrackReplacement as a8, replaceAndCreateTextTrack as a9, type BurnedInCaptionsResult as aA, type CaptionReplacement as aB, type CensorMode as aC, type Chapter as aD, type ChapterSystemPromptSections as aE, type ChaptersOptions as aF, type ChaptersPromptOverrides as aG, type ChaptersPromptSections as aH, type ChaptersResult as aI, type ChaptersType as aJ, DEFAULT_TRANSCRIPT_WINDOWING as aK, type DubbedCaptionsOutcome as aL, type EditCaptionsOptions as aM, type EditCaptionsResult as aN, type EmbeddingsOptions as aO, type EmbeddingsResult as aP, type EngagementInsightsOptions as aQ, type EngagementInsightsResult as aR, GENERATE_TEXT_CALLS_TO_ACTION as aS, GENERATE_TEXT_CHANNELS as aT, GENERATE_TEXT_CHANNEL_CEILINGS as aU, GENERATE_TEXT_FORMATS as aV, GENERATE_TEXT_LENGTH_BOUNDS as aW, GENERATE_TEXT_MAX_ARTIFACTS as aX, GENERATE_TEXT_MAX_AUDIENCE_CHARS as aY, GENERATE_TEXT_MAX_BRAND_TERMS as aZ, GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS as a_, replaceAndCreateTrack as aa, replaceSourceTrack as ab, restoreClassification as ac, serializeClassification as ad, summarizeTextTrack as ae, toISO639_1 as af, toISO639_3 as ag, trackReplacementBlockedError as ah, trackTargetFacts as ai, validateTrackPassthrough as aj, index as ak, wrapError as al, ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH as am, ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH as an, ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL as ao, ASK_QUESTIONS_MAX_QUESTION_LENGTH as ap, type AskQuestionsOptions as aq, type AskQuestionsResult as ar, type AskQuestionsType as as, type AudioTranslationOptions as at, type AudioTranslationResult as au, type AutoCensorProfanityOptions as av, type BurnedInCaptionsAnalysis as aw, type BurnedInCaptionsOptions as ax, type BurnedInCaptionsPromptOverrides as ay, type BurnedInCaptionsPromptSections as az, type MuxAiErrorSource as b, askQuestions as b$, GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS as b0, GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS as b1, GENERATE_TEXT_MAX_SHOT_FRAMES as b2, GENERATE_TEXT_MAX_VARIANTS as b3, GENERATE_TEXT_VOICES as b4, GOOGLE_VISION_LIKELIHOOD_TO_SCORE as b5, type GenerateTextArtifact as b6, type GenerateTextCallToAction as b7, type GenerateTextChannel as b8, type GenerateTextFormat as b9, type RepairResult as bA, type RepairSpan as bB, type ReplacementRecord as bC, type SpeakerReplacement as bD, type StaticRenditionCleanupOutcome as bE, type SummarizationOptions as bF, type SummarizationPromptOverrides as bG, type SummarizationPromptSections as bH, type SummaryAndTagsResult as bI, type SummaryType as bJ, type TextLengthLimit as bK, type TextRepairModelOptions as bL, type ThumbnailModerationScore as bM, type ThumbnailModerationSkipReason as bN, type ThumbnailModerationStatus as bO, type TranscriptModerationScore as bP, type TranscriptModerationSkipReason as bQ, type TranscriptModerationStatus as bR, type TranslationChunkingOptions as bS, type TranslationOptions as bT, type TranslationPayload as bU, type TranslationResult as bV, aggregateTokenUsage as bW, applyOverrideLists as bX, applyReplacements as bY, applySpeakerReplacements as bZ, applyTextRepair as b_, type GenerateTextKeyedItem as ba, type GenerateTextLengthLimit as bb, type GenerateTextOptions as bc, type GenerateTextResult as bd, type GenerateTextVariant as be, type GenerateTextVoice as bf, type GeneratedTextArtifact as bg, type GeneratedTextVariant as bh, HIVE_SEXUAL_CATEGORIES as bi, HIVE_VIOLENCE_CATEGORIES as bj, type HiveModerationOutput as bk, type HiveModerationSource as bl, type ModerationOptions as bm, type ModerationProvider as bn, type ModerationResult as bo, type ModerationSurfaceStatus as bp, type MomentInsight as bq, type OverallInsight as br, type ProfanityDetectionPayload as bs, type Question as bt, type QuestionAnswer as bu, type QuestionAnswerType as bv, type RepairAttempt as bw, type RepairCall as bx, type RepairOptions as by, type RepairPlan as bz, type MuxAiErrorType as c, buildReplacementRegex as c0, buildTranscriptWindows as c1, burnedInCaptionsSchema as c2, censorVttContent as c3, chapterSchema as c4, chaptersSchema as c5, createReplacer as c6, createTextRepairGenerator as c7, editCaptions as c8, extractTranscriptSegmentsForHotspots as c9, translateCaptions as cA, translationSchema as cB, validateNeverTranslateTerms as cC, verifyNeverTranslateTerms as cD, findGenerateTextLengthViolation as ca, generateChapters as cb, generateEmbeddings as cc, generateEngagementInsights as cd, generateText as ce, generateVideoEmbeddings as cf, getModerationScores as cg, getSummaryAndTags as ch, hasBurnedInCaptions as ci, mapShotsToHotspots as cj, measureGenerateTextLength as ck, normalizeTranslatedVtt as cl, planTextRepair as cm, profanityDetectionSchema as cn, questionAnswerSchema as co, repairJsonSchema as cp, repairText as cq, resolveGenerateTextLengthLimit as cr, resolveGenerateTextLengthLimits as cs, resolveGenerateTextOptions as ct, runTextRepairLoop as cu, selectGenerateTextShotFrames as cv, shouldSplitChunkTranslationError as cw, summarySchema as cx, transformCueText as cy, translateAudio as cz, MuxAiError as d, type MuxAiErrorFactValue as e, type MuxAiErrorCode as f, type ClassifiedErrorInit as g, type CodedClassification as h, type ErrorCauseSummary as i, type ISO639_3 as j, MUX_AI_ERROR_CATALOG as k, MUX_AI_ERROR_CODES as l, MUX_AI_ERROR_CODE_VALUES as m, MUX_AI_ERROR_DEPENDENCIES as n, MUX_AI_ERROR_DEPENDENCY_VALUES as o, MUX_AI_ERROR_SOURCES as p, MUX_AI_ERROR_SOURCE_VALUES as q, MUX_AI_ERROR_TYPES as r, MUX_AI_ERROR_TYPE_VALUES as s, MUX_TRACK_PASSTHROUGH_MAX_CHARS as t, type MuxAiErrorInit as u, type ReplaceAndCreateTextTrackResult as v, type ReplaceAndCreateTrackInput as w, type ReplaceExistingTracksPolicy as x, type ReplaceSourceTrackInput as y, type ReplaceableTrackType as z };
@@ -1,4 +1,4 @@
1
- import { l as WorkflowCredentialsInput, n as WorkflowScope, h as TextChunk, b as ChunkingStrategy, q as VTTCue, r as CompletedShotsResult, D as DeletedShotsResult, s as ErroredShotsResult, H as Hotspot, t as HotspotOptions, u as HotspotResponse, L as LOW_CONFIDENCE_THRESHOLD, v as MAX_CUE_TEXT_CHARS, w as ParseVTTCuesOptions, x as PendingShotsResult, y as Shot, z as ShotRequestOptions, B as ShotsResult, F as SkippedShotsResult, G as TranscriptEmptyReason, J as TranscriptFetchOptions, K as TranscriptFetchStepResult, N as TranscriptResult, O as WaitForShotsOptions, Q as buildTranscriptUrl, R as buildVttFromCueBlocks, X as buildVttFromTranslatedCueBlocks, Y as concatenateVttSegments, Z as extractTextFromVTT, _ as extractTimestampedTranscript, $ as fetchTranscriptDataForUrl, a0 as fetchTranscriptForAsset, a1 as filterVttByScope, a2 as findCaptionTrack, a3 as getHotspotsForAsset, a4 as getHotspotsForPlaybackId, a5 as getHotspotsForVideo, a6 as getReadyTextTracks, a7 as getReliableLanguageCode, a8 as getShotsForAsset, a9 as parseVTTCues, aa as replaceCueText, ab as requestShotsForAsset, ac as sanitizeUntrustedText, ad as secondsToTimestamp, ae as splitVttPreambleAndCueBlocks, af as stripVttMetadataBlocks, ag as vttTimestampToSeconds, ah as waitForShotsForAsset } from './transcripts-Brw74qlV.js';
1
+ import { l as WorkflowCredentialsInput, n as WorkflowScope, T as TextChunk, b as ChunkingStrategy, q as VTTCue, r as CompletedShotsResult, D as DeletedShotsResult, s as ErroredShotsResult, H as Hotspot, t as HotspotOptions, u as HotspotResponse, L as LOW_CONFIDENCE_THRESHOLD, v as MAX_CUE_TEXT_CHARS, w as ParseVTTCuesOptions, x as PendingShotsResult, y as Shot, z as ShotRequestOptions, B as ShotsResult, F as SkippedShotsResult, G as TranscriptEmptyReason, J as TranscriptFetchOptions, K as TranscriptFetchStepResult, N as TranscriptResult, O as WaitForShotsOptions, Q as buildTranscriptUrl, R as buildVttFromCueBlocks, X as buildVttFromTranslatedCueBlocks, Y as concatenateVttSegments, Z as extractTextFromVTT, _ as extractTimestampedTranscript, $ as fetchTranscriptDataForUrl, a0 as fetchTranscriptForAsset, a1 as filterVttByScope, a2 as findCaptionTrack, a3 as getHotspotsForAsset, a4 as getHotspotsForPlaybackId, a5 as getHotspotsForVideo, a6 as getReadyTextTracks, a7 as getReliableLanguageCode, a8 as getShotsForAsset, a9 as parseVTTCues, aa as replaceCueText, ab as requestShotsForAsset, ac as sanitizeUntrustedText, ad as secondsToTimestamp, ae as splitVttPreambleAndCueBlocks, af as stripVttMetadataBlocks, ag as vttTimestampToSeconds, ah as waitForShotsForAsset } from './transcripts-DuNI058z.js';
2
2
 
3
3
  interface HeatmapOptions {
4
4
  /** Time window for results, e.g., '7:days' (default: '7:days') */