@mux/ai 0.40.0 → 0.42.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/dist/{index-UhRs9t1h.d.ts → index-NkSOF92U.d.ts} +211 -78
- package/dist/index.d.ts +3 -2
- package/dist/index.js +656 -167
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.js +1 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/prompts/index.d.ts +335 -0
- package/dist/prompts/index.js +490 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/workflows/index.d.ts +2 -1
- package/dist/workflows/index.js +618 -142
- package/dist/workflows/index.js.map +1 -1
- package/package.json +7 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { SafetyReport, PromptOverrides, SceneContextItemV1 } from './prompts/index.js';
|
|
2
3
|
import { createAnthropic } from '@ai-sdk/anthropic';
|
|
3
4
|
import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
4
5
|
import { createOpenAI } from '@ai-sdk/openai';
|
|
5
|
-
import { f as ScopedMuxAIOptions, I as ImageSubmissionMode, i as TokenUsage, M as MuxAIOptions, b as ChunkingStrategy, k as VideoEmbeddingsResult, H as Hotspot, v as Shot, j as ToneType, g as StorageAdapter } from './shots-CUI09Ohe.js';
|
|
6
|
+
import { l as WorkflowCredentialsInput, d as MuxAsset, A as AssetTextTrack, f as ScopedMuxAIOptions, I as ImageSubmissionMode, i as TokenUsage, M as MuxAIOptions, b as ChunkingStrategy, k as VideoEmbeddingsResult, H as Hotspot, v as Shot, j as ToneType, g as StorageAdapter } from './shots-CUI09Ohe.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Language Code Conversion Utilities
|
|
@@ -169,6 +170,138 @@ declare function isUndeterminedLanguageCode(code: string): boolean;
|
|
|
169
170
|
*/
|
|
170
171
|
declare function getLanguageName(code: string): string | undefined;
|
|
171
172
|
|
|
173
|
+
/**
|
|
174
|
+
* How a workflow treats tracks that already exist on the asset when it is
|
|
175
|
+
* about to create a new one.
|
|
176
|
+
*
|
|
177
|
+
* - `fail`: stop before doing any work if a same-language or same-name track exists.
|
|
178
|
+
* - `replace_all`: delete every same-language and same-name track first.
|
|
179
|
+
* - `replace_generated`: delete Mux-generated (ASR) tracks; stop if any other track is in the way.
|
|
180
|
+
* Audio tracks are never Mux-generated, so for audio this behaves like `fail`.
|
|
181
|
+
*/
|
|
182
|
+
type ReplaceExistingTracksPolicy = "fail" | "replace_all" | "replace_generated";
|
|
183
|
+
/** Mux track types that share a name-uniqueness group among themselves. */
|
|
184
|
+
type ReplaceableTrackType = "text" | "audio";
|
|
185
|
+
/** The `(type, language_code, name)` a workflow is about to write to Mux. `type` defaults to `text`. */
|
|
186
|
+
interface TextTrackTarget {
|
|
187
|
+
languageCode: string;
|
|
188
|
+
name: string;
|
|
189
|
+
type?: ReplaceableTrackType;
|
|
190
|
+
}
|
|
191
|
+
type TrackTarget = TextTrackTarget;
|
|
192
|
+
/** Serializable description of a track, safe to return across step boundaries. */
|
|
193
|
+
interface TextTrackSummary {
|
|
194
|
+
id: string;
|
|
195
|
+
type?: ReplaceableTrackType;
|
|
196
|
+
name?: string;
|
|
197
|
+
languageCode?: string;
|
|
198
|
+
status?: string;
|
|
199
|
+
textSource?: string;
|
|
200
|
+
passthrough?: string;
|
|
201
|
+
/** Audio only: the asset's original audio, which Mux refuses to delete. */
|
|
202
|
+
primary?: boolean;
|
|
203
|
+
}
|
|
204
|
+
type TrackSummary = TextTrackSummary;
|
|
205
|
+
type TextTrackReplacementPlan = {
|
|
206
|
+
kind: "clear";
|
|
207
|
+
} | {
|
|
208
|
+
kind: "blocked";
|
|
209
|
+
reason: string;
|
|
210
|
+
tracks: TextTrackSummary[];
|
|
211
|
+
} | {
|
|
212
|
+
kind: "replace";
|
|
213
|
+
toDelete: TextTrackSummary[];
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Every variant carries `deleted`: a `blocked` result can follow deletes when a
|
|
217
|
+
* conflicting track appears between the first pass and the duplicate-name retry,
|
|
218
|
+
* so callers must check it before assuming nothing was removed.
|
|
219
|
+
*/
|
|
220
|
+
type ReplaceAndCreateTextTrackResult = {
|
|
221
|
+
kind: "created";
|
|
222
|
+
trackId: string;
|
|
223
|
+
deleted: TextTrackSummary[];
|
|
224
|
+
} | {
|
|
225
|
+
kind: "blocked";
|
|
226
|
+
reason: string;
|
|
227
|
+
tracks: TextTrackSummary[];
|
|
228
|
+
deleted: TextTrackSummary[];
|
|
229
|
+
} | {
|
|
230
|
+
kind: "create_failed";
|
|
231
|
+
reason: string;
|
|
232
|
+
deleted: TextTrackSummary[];
|
|
233
|
+
};
|
|
234
|
+
/** Mux caps track `passthrough` at 255 characters. */
|
|
235
|
+
declare const MUX_TRACK_PASSTHROUGH_MAX_CHARS = 255;
|
|
236
|
+
/**
|
|
237
|
+
* Normalizes a track language code for matching: lowercase, ISO 639-3 → 639-1,
|
|
238
|
+
* primary subtag only (`en-US` → `en`). Returns `undefined` for codes that must
|
|
239
|
+
* never match anything (`auto`, `und`, `mul`, `mis`, `zxx`, empty).
|
|
240
|
+
*/
|
|
241
|
+
declare function normalizeTrackLanguageCode(code: string | undefined): string | undefined;
|
|
242
|
+
/** Normalizes a track name the way Mux compares them: trimmed, case-insensitive. */
|
|
243
|
+
declare function normalizeTrackName(name: string | undefined): string | undefined;
|
|
244
|
+
declare function isMuxGeneratedTextTrack(track: AssetTextTrack): boolean;
|
|
245
|
+
declare function summarizeTextTrack(track: AssetTextTrack): TextTrackSummary;
|
|
246
|
+
/**
|
|
247
|
+
* Tracks of the target's type whose language matches the target's, in any
|
|
248
|
+
* status but `deleted`. Text tracks must be subtitles; audio tracks match on
|
|
249
|
+
* language alone.
|
|
250
|
+
*/
|
|
251
|
+
declare function findSameLanguageTextTracks(asset: MuxAsset, target: TextTrackTarget): AssetTextTrack[];
|
|
252
|
+
/** Tracks of the target's type whose name collides with the target's under Mux's uniqueness rule. */
|
|
253
|
+
declare function findNameCollisionTextTracks(asset: MuxAsset, target: TextTrackTarget): AssetTextTrack[];
|
|
254
|
+
/**
|
|
255
|
+
* Decides which existing tracks stand in the way of `target` and what `policy`
|
|
256
|
+
* says to do about them. Pure: pass the freshest asset you have.
|
|
257
|
+
*
|
|
258
|
+
* `keepTrackIds` marks tracks that are allowed to coexist with the new one and
|
|
259
|
+
* are never treated as conflicts. edit-captions uses it under `fail` to keep
|
|
260
|
+
* the source track it is editing.
|
|
261
|
+
*
|
|
262
|
+
* A conflicting primary audio track always blocks: Mux refuses to delete it and
|
|
263
|
+
* it is the customer's original audio.
|
|
264
|
+
*/
|
|
265
|
+
declare function planTextTrackReplacement(asset: MuxAsset, target: TextTrackTarget, policy: ReplaceExistingTracksPolicy, options?: {
|
|
266
|
+
keepTrackIds?: string[];
|
|
267
|
+
}): TextTrackReplacementPlan;
|
|
268
|
+
/** True for Mux's `400 invalid_parameters` "Track name 'X' is not unique" rejection. */
|
|
269
|
+
declare function isDuplicateTrackNameError(error: unknown): boolean;
|
|
270
|
+
/** Default audit tag written to `passthrough` on tracks created by `@mux/ai`. */
|
|
271
|
+
declare function buildMuxAiTrackPassthrough(workflow: string): string;
|
|
272
|
+
declare function validateTrackPassthrough(passthrough: string | undefined): string | undefined;
|
|
273
|
+
interface ReplaceAndCreateTextTrackInput {
|
|
274
|
+
assetId: string;
|
|
275
|
+
target: TextTrackTarget;
|
|
276
|
+
policy: ReplaceExistingTracksPolicy;
|
|
277
|
+
presignedUrl: string;
|
|
278
|
+
/** Text tracks only. */
|
|
279
|
+
closedCaptions?: boolean;
|
|
280
|
+
passthrough?: string;
|
|
281
|
+
/** Tracks that may coexist with the new one; see `planTextTrackReplacement`. */
|
|
282
|
+
keepTrackIds?: string[];
|
|
283
|
+
credentials?: WorkflowCredentialsInput;
|
|
284
|
+
}
|
|
285
|
+
type ReplaceAndCreateTrackInput = ReplaceAndCreateTextTrackInput;
|
|
286
|
+
/**
|
|
287
|
+
* Fetches the asset fresh, deletes whatever `policy` allows, then creates the
|
|
288
|
+
* new track of `target.type` (default `text`). Known outcomes come back as
|
|
289
|
+
* discriminated results rather than throws so callers can react (Workflow
|
|
290
|
+
* DevKit turns repeated step throws into a FatalError).
|
|
291
|
+
*
|
|
292
|
+
* The only throw is a failed asset fetch before anything has been deleted,
|
|
293
|
+
* which is safe to retry. Once a track has been deleted every failure, Mux or
|
|
294
|
+
* otherwise, is returned as `create_failed` with the `deleted` list so the
|
|
295
|
+
* caller can restore what was removed.
|
|
296
|
+
*
|
|
297
|
+
* A duplicate-name rejection on create is retried once after re-planning
|
|
298
|
+
* against a fresh asset, which covers a track appearing between the plan and
|
|
299
|
+
* the create.
|
|
300
|
+
*/
|
|
301
|
+
declare function replaceAndCreateTrack(input: ReplaceAndCreateTextTrackInput): Promise<ReplaceAndCreateTextTrackResult>;
|
|
302
|
+
/** `replaceAndCreateTrack` pinned to text tracks. */
|
|
303
|
+
declare function replaceAndCreateTextTrack(input: ReplaceAndCreateTextTrackInput): Promise<ReplaceAndCreateTextTrackResult>;
|
|
304
|
+
|
|
172
305
|
interface ImageDownloadOptions {
|
|
173
306
|
/** Request timeout in milliseconds (default: 10000) */
|
|
174
307
|
timeout?: number;
|
|
@@ -182,56 +315,6 @@ interface ImageDownloadOptions {
|
|
|
182
315
|
exponentialBackoff?: boolean;
|
|
183
316
|
}
|
|
184
317
|
|
|
185
|
-
/**
|
|
186
|
-
* Which detector fired on a leak, or `null` when the text is clean.
|
|
187
|
-
*
|
|
188
|
-
* - `canary` — the system-prompt canary token appeared in the output.
|
|
189
|
-
* Near-zero false-positive rate; treat as a confirmed leak.
|
|
190
|
-
* - `prompt_tag` — an XML-like tag taken from our prompt structure
|
|
191
|
-
* appeared in the output. Low false-positive rate.
|
|
192
|
-
* - `encoded_blob` — a long run of base64- or hex-shaped characters
|
|
193
|
-
* appeared in a field expected to hold prose. Heuristic; some false
|
|
194
|
-
* positives on hashes or tokens in tech-content transcripts.
|
|
195
|
-
* - `unexpected_key` — the model emitted a JSON field not declared in
|
|
196
|
-
* the schema (see {@link detectUnexpectedKeys}). Stripped silently
|
|
197
|
-
* by zod's default `.strip()` mode; this signal surfaces the
|
|
198
|
-
* smuggling attempt rather than letting it go unseen.
|
|
199
|
-
*/
|
|
200
|
-
type LeakReason = "canary" | "prompt_tag" | "encoded_blob" | "unexpected_key" | null;
|
|
201
|
-
/**
|
|
202
|
-
* Per-field record of a detected leak. Collected across every scrub
|
|
203
|
-
* performed inside a single workflow invocation and returned to the
|
|
204
|
-
* caller in the workflow result's `safety` field.
|
|
205
|
-
*/
|
|
206
|
-
interface ScrubbedFieldReport {
|
|
207
|
-
/**
|
|
208
|
-
* Identifier for the field that leaked. Format is workflow-specific
|
|
209
|
-
* (e.g. "reasoning[0]", "moment_insight[2]", "description"). Intended
|
|
210
|
-
* for debugging and observability; do not parse programmatically.
|
|
211
|
-
*/
|
|
212
|
-
field: string;
|
|
213
|
-
/** Which detector fired — see {@link LeakReason}. */
|
|
214
|
-
reason: Exclude<LeakReason, null>;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Aggregate safety report returned from workflows that perform
|
|
218
|
-
* output-side scrubbing.
|
|
219
|
-
*
|
|
220
|
-
* Operators can use this to alert on suspected prompt-injection traffic
|
|
221
|
-
* without inspecting log warnings. Shape is stable across workflows so a
|
|
222
|
-
* single observer can consume it uniformly.
|
|
223
|
-
*/
|
|
224
|
-
interface SafetyReport {
|
|
225
|
-
/** `true` when at least one field was suppressed by the scrubber. */
|
|
226
|
-
leaksDetected: boolean;
|
|
227
|
-
/**
|
|
228
|
-
* One entry per suppressed field. Empty (but present) when no leaks
|
|
229
|
-
* were detected. Iteration order matches the order scrubs ran, so
|
|
230
|
-
* callers can correlate entries with workflow structure if they wish.
|
|
231
|
-
*/
|
|
232
|
-
scrubbedFields: ScrubbedFieldReport[];
|
|
233
|
-
}
|
|
234
|
-
|
|
235
318
|
type SupportedProvider = "openai" | "anthropic" | "google" | "baseten" | "openai-compatible";
|
|
236
319
|
type SupportedEmbeddingProvider = "openai" | "google" | "baseten" | "openai-compatible";
|
|
237
320
|
type OpenAIModelId = Parameters<ReturnType<typeof createOpenAI>["chat"]>[0];
|
|
@@ -497,28 +580,6 @@ type AskQuestionsType = z.infer<AskQuestionsSchema>;
|
|
|
497
580
|
*/
|
|
498
581
|
declare function askQuestions(assetId: string, questions: Question[], options?: AskQuestionsOptions): Promise<AskQuestionsResult>;
|
|
499
582
|
|
|
500
|
-
/**
|
|
501
|
-
* A single section of a prompt, rendered as an XML-like tag.
|
|
502
|
-
*/
|
|
503
|
-
interface PromptSection {
|
|
504
|
-
/** The XML tag name for this section */
|
|
505
|
-
tag: string;
|
|
506
|
-
/** The content inside the tag */
|
|
507
|
-
content: string;
|
|
508
|
-
/** Optional attributes to add to the tag (e.g., { format: "plain text" }) */
|
|
509
|
-
attributes?: Record<string, string>;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Configuration for building a prompt section.
|
|
513
|
-
* Can be a full PromptSection object, just a string (content only), or undefined to use default.
|
|
514
|
-
*/
|
|
515
|
-
type SectionOverride = string | PromptSection | undefined;
|
|
516
|
-
/**
|
|
517
|
-
* User-provided overrides for prompt sections.
|
|
518
|
-
* Each key can override the corresponding section's content or full definition.
|
|
519
|
-
*/
|
|
520
|
-
type PromptOverrides<TSections extends string> = Partial<Record<TSections, SectionOverride>>;
|
|
521
|
-
|
|
522
583
|
/** Structured payload returned from `hasBurnedInCaptions`. */
|
|
523
584
|
interface BurnedInCaptionsResult {
|
|
524
585
|
assetId: string;
|
|
@@ -727,6 +788,11 @@ interface ChaptersOptions extends ScopedMuxAIOptions {
|
|
|
727
788
|
* Falls back to unconstrained (LLM decides) if no language metadata is available.
|
|
728
789
|
*/
|
|
729
790
|
outputLanguageCode?: string;
|
|
791
|
+
/**
|
|
792
|
+
* Ordered scene context used to align chapter starts with scene boundaries.
|
|
793
|
+
* When omitted or empty, chapter generation retains its existing behavior.
|
|
794
|
+
*/
|
|
795
|
+
sceneContext?: readonly SceneContextItemV1[];
|
|
730
796
|
}
|
|
731
797
|
/**
|
|
732
798
|
* Sections of the chaptering system prompt that can be overridden.
|
|
@@ -771,7 +837,25 @@ interface EditCaptionsOptions<P extends SupportedProvider = SupportedProvider> e
|
|
|
771
837
|
replacements?: CaptionReplacement[];
|
|
772
838
|
/** Replacements applied only to bracketed speaker labels at the start of cues. */
|
|
773
839
|
speakerReplacements?: SpeakerReplacement[];
|
|
774
|
-
/**
|
|
840
|
+
/**
|
|
841
|
+
* What to do with the source track and any other text track in the same
|
|
842
|
+
* language or with the same name as the edited track. Defaults to
|
|
843
|
+
* `"replace_all"`: the edited track takes the source track's place.
|
|
844
|
+
* `"fail"` keeps the source and requires `trackName`.
|
|
845
|
+
*/
|
|
846
|
+
replaceExistingTracks?: ReplaceExistingTracksPolicy;
|
|
847
|
+
/** Name for the edited Mux text track. Defaults to the source track's name. */
|
|
848
|
+
trackName?: string;
|
|
849
|
+
/**
|
|
850
|
+
* `passthrough` written on the edited Mux text track. Defaults to a JSON
|
|
851
|
+
* audit tag identifying this workflow. Max 255 characters.
|
|
852
|
+
*/
|
|
853
|
+
trackPassthrough?: string;
|
|
854
|
+
/**
|
|
855
|
+
* @deprecated Use `replaceExistingTracks`. When set, the workflow keeps its
|
|
856
|
+
* previous behavior: create `<source name> (<trackNameSuffix>)`, then delete
|
|
857
|
+
* the source when `true`. Cannot be combined with `replaceExistingTracks` or `trackName`.
|
|
858
|
+
*/
|
|
775
859
|
deleteOriginalTrack?: boolean;
|
|
776
860
|
/**
|
|
777
861
|
* When `true` the edited VTT is uploaded to the configured
|
|
@@ -793,7 +877,11 @@ interface EditCaptionsOptions<P extends SupportedProvider = SupportedProvider> e
|
|
|
793
877
|
s3Region?: string;
|
|
794
878
|
/** Bucket that will store edited VTT files. */
|
|
795
879
|
s3Bucket?: string;
|
|
796
|
-
/**
|
|
880
|
+
/**
|
|
881
|
+
* @deprecated Use `trackName`. Suffix appended to the source track name in the
|
|
882
|
+
* previous naming scheme, e.g. "edited" produces "Subtitles (edited)". Setting
|
|
883
|
+
* it selects that scheme; cannot be combined with `replaceExistingTracks` or `trackName`.
|
|
884
|
+
*/
|
|
797
885
|
trackNameSuffix?: string;
|
|
798
886
|
/** Expiry duration in seconds for S3 presigned GET URLs. Defaults to 86400 (24 hours). */
|
|
799
887
|
s3SignedUrlExpirySeconds?: number;
|
|
@@ -815,6 +903,8 @@ interface EditCaptionsResult {
|
|
|
815
903
|
replacements: ReplacementRecord[];
|
|
816
904
|
};
|
|
817
905
|
uploadedTrackId?: string;
|
|
906
|
+
/** Existing text tracks deleted before the edited track was created. Includes the source track when it was replaced. */
|
|
907
|
+
replacedTracks?: TextTrackSummary[];
|
|
818
908
|
presignedUrl?: string;
|
|
819
909
|
usage?: TokenUsage;
|
|
820
910
|
/**
|
|
@@ -1253,6 +1343,11 @@ interface SummarizationOptions extends ScopedMuxAIOptions {
|
|
|
1253
1343
|
imageSubmissionMode?: ImageSubmissionMode;
|
|
1254
1344
|
/** Fine-tune storyboard downloads when `imageSubmissionMode` === 'base64'. */
|
|
1255
1345
|
imageDownloadOptions?: ImageDownloadOptions;
|
|
1346
|
+
/**
|
|
1347
|
+
* Ordered, normalized scenes that augment the storyboard and any transcript
|
|
1348
|
+
* with whole-asset progression. Scene context is treated as untrusted evidence.
|
|
1349
|
+
*/
|
|
1350
|
+
sceneContext?: readonly SceneContextItemV1[];
|
|
1256
1351
|
/**
|
|
1257
1352
|
* Override specific sections of the user prompt.
|
|
1258
1353
|
* Useful for customizing the AI's output for specific use cases (SEO, social media, etc.)
|
|
@@ -1288,6 +1383,11 @@ interface AudioTranslationResult {
|
|
|
1288
1383
|
dubbingId: string;
|
|
1289
1384
|
uploadedTrackId?: string;
|
|
1290
1385
|
presignedUrl?: string;
|
|
1386
|
+
/**
|
|
1387
|
+
* Existing tracks deleted before the dubbed audio track and, when enabled, the
|
|
1388
|
+
* captions track were created. Each entry's `type` says which group it came from.
|
|
1389
|
+
*/
|
|
1390
|
+
replacedTracks?: TextTrackSummary[];
|
|
1291
1391
|
/** Mux text track ID for the dubbed captions, present when `uploadCaptionsToMux` is true and the upload succeeded. */
|
|
1292
1392
|
captionsTrackId?: string;
|
|
1293
1393
|
/** Presigned URL for the dub's translated transcript (WebVTT) staged to S3. */
|
|
@@ -1334,10 +1434,28 @@ interface AudioTranslationOptions extends MuxAIOptions {
|
|
|
1334
1434
|
/**
|
|
1335
1435
|
* When true the dub's translated transcript (the same translation that was
|
|
1336
1436
|
* voiced) is attached as a subtitles text track on the Mux asset. Implies
|
|
1337
|
-
* `uploadToS3: true`. Defaults to false.
|
|
1338
|
-
*
|
|
1437
|
+
* `uploadToS3: true`. Defaults to false. Existing text tracks are handled
|
|
1438
|
+
* according to `replaceExistingTracks`, checked before dubbing starts.
|
|
1339
1439
|
*/
|
|
1340
1440
|
uploadCaptionsToMux?: boolean;
|
|
1441
|
+
/**
|
|
1442
|
+
* What to do when the asset already has an audio track (or, with
|
|
1443
|
+
* `uploadCaptionsToMux`, a text track) in the target language or with the
|
|
1444
|
+
* target name. Defaults to `"fail"`, which rejects before dubbing starts.
|
|
1445
|
+
* The asset's primary audio track is never deleted under any policy.
|
|
1446
|
+
*/
|
|
1447
|
+
replaceExistingTracks?: ReplaceExistingTracksPolicy;
|
|
1448
|
+
/**
|
|
1449
|
+
* Name for the created Mux tracks. Audio and text tracks are separate name
|
|
1450
|
+
* groups, so the same name is used for both. Defaults to
|
|
1451
|
+
* "<Language> (Auto-dubbed)", e.g. "Spanish (Auto-dubbed)".
|
|
1452
|
+
*/
|
|
1453
|
+
trackName?: string;
|
|
1454
|
+
/**
|
|
1455
|
+
* `passthrough` written on the created Mux tracks. Defaults to a JSON audit
|
|
1456
|
+
* tag identifying this workflow. Max 255 characters.
|
|
1457
|
+
*/
|
|
1458
|
+
trackPassthrough?: string;
|
|
1341
1459
|
/**
|
|
1342
1460
|
* Cleanup for the audio-only static rendition this run created as dubbing
|
|
1343
1461
|
* input: `"delete"` (default) removes it when the workflow finishes, success
|
|
@@ -1378,6 +1496,8 @@ interface TranslationResult {
|
|
|
1378
1496
|
originalVtt: string;
|
|
1379
1497
|
translatedVtt: string;
|
|
1380
1498
|
uploadedTrackId?: string;
|
|
1499
|
+
/** Existing text tracks deleted before the translated track was created. */
|
|
1500
|
+
replacedTracks?: TextTrackSummary[];
|
|
1381
1501
|
presignedUrl?: string;
|
|
1382
1502
|
/** Token usage from the AI provider (for efficiency/cost analysis). */
|
|
1383
1503
|
usage?: TokenUsage;
|
|
@@ -1423,6 +1543,19 @@ interface TranslationOptions<P extends SupportedProvider = SupportedProvider> ex
|
|
|
1423
1543
|
* required for track creation.
|
|
1424
1544
|
*/
|
|
1425
1545
|
uploadToMux?: boolean;
|
|
1546
|
+
/**
|
|
1547
|
+
* What to do when the asset already has a text track in the target language
|
|
1548
|
+
* or with the target name. Defaults to `"fail"`, which rejects before any
|
|
1549
|
+
* translation happens.
|
|
1550
|
+
*/
|
|
1551
|
+
replaceExistingTracks?: ReplaceExistingTracksPolicy;
|
|
1552
|
+
/** Name for the created Mux text track. Defaults to "<Language> (Auto-translated)", e.g. "Spanish (Auto-translated)". */
|
|
1553
|
+
trackName?: string;
|
|
1554
|
+
/**
|
|
1555
|
+
* `passthrough` written on the created Mux text track. Defaults to a JSON
|
|
1556
|
+
* audit tag identifying this workflow. Max 255 characters.
|
|
1557
|
+
*/
|
|
1558
|
+
trackPassthrough?: string;
|
|
1426
1559
|
/** Optional storage adapter override for upload + presign operations. */
|
|
1427
1560
|
storageAdapter?: StorageAdapter;
|
|
1428
1561
|
/** Expiry duration in seconds for S3 presigned GET URLs. Defaults to 86400 (24 hours). */
|
|
@@ -1621,4 +1754,4 @@ declare namespace index {
|
|
|
1621
1754
|
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, 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_GOOGLE_VISION_LIKELIHOOD_TO_SCORE as GOOGLE_VISION_LIKELIHOOD_TO_SCORE, 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_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_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_ThumbnailModerationScore as ThumbnailModerationScore, 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_askQuestions as askQuestions, index_buildReplacementRegex as buildReplacementRegex, index_burnedInCaptionsSchema as burnedInCaptionsSchema, index_censorVttContent as censorVttContent, index_chapterSchema as chapterSchema, index_chaptersSchema as chaptersSchema, index_createReplacer as createReplacer, index_editCaptions as editCaptions, index_extractTranscriptSegmentsForHotspots as extractTranscriptSegmentsForHotspots, index_generateChapters as generateChapters, index_generateEmbeddings as generateEmbeddings, index_generateEngagementInsights as generateEngagementInsights, index_generateVideoEmbeddings as generateVideoEmbeddings, index_getModerationScores as getModerationScores, index_getSummaryAndTags as getSummaryAndTags, index_hasBurnedInCaptions as hasBurnedInCaptions, index_mapShotsToHotspots as mapShotsToHotspots, index_normalizeTranslatedVtt as normalizeTranslatedVtt, index_profanityDetectionSchema as profanityDetectionSchema, index_questionAnswerSchema as questionAnswerSchema, 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 };
|
|
1622
1755
|
}
|
|
1623
1756
|
|
|
1624
|
-
export { type
|
|
1757
|
+
export { type Chapter as $, toISO639_1 as A, toISO639_3 as B, validateTrackPassthrough as C, index as D, ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH as E, ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH as F, ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL as G, ASK_QUESTIONS_MAX_QUESTION_LENGTH as H, type ISO639_1 as I, type AskQuestionsOptions as J, type AskQuestionsResult as K, type LanguageCodePair as L, MUX_TRACK_PASSTHROUGH_MAX_CHARS as M, type AskQuestionsType as N, type AudioTranslationOptions as O, type AudioTranslationResult as P, type AutoCensorProfanityOptions as Q, type ReplaceAndCreateTextTrackInput as R, type SupportedISO639_1 as S, type TextTrackReplacementPlan as T, type BurnedInCaptionsAnalysis as U, type BurnedInCaptionsOptions as V, type BurnedInCaptionsPromptOverrides as W, type BurnedInCaptionsPromptSections as X, type BurnedInCaptionsResult as Y, type CaptionReplacement as Z, type CensorMode as _, type ISO639_3 as a, normalizeTranslatedVtt as a$, type ChapterSystemPromptSections as a0, type ChaptersOptions as a1, type ChaptersPromptOverrides as a2, type ChaptersPromptSections as a3, type ChaptersResult as a4, type ChaptersType as a5, DEFAULT_DESCRIPTION_LENGTH as a6, DEFAULT_SUMMARY_KEYWORD_LIMIT as a7, DEFAULT_TITLE_LENGTH as a8, type EditCaptionsOptions as a9, type SummaryType as aA, type ThumbnailModerationScore as aB, type TranslationChunkingOptions as aC, type TranslationOptions as aD, type TranslationPayload as aE, type TranslationResult as aF, aggregateTokenUsage as aG, applyOverrideLists as aH, applyReplacements as aI, applySpeakerReplacements as aJ, askQuestions as aK, buildReplacementRegex as aL, burnedInCaptionsSchema as aM, censorVttContent as aN, chapterSchema as aO, chaptersSchema as aP, createReplacer as aQ, editCaptions as aR, extractTranscriptSegmentsForHotspots as aS, generateChapters as aT, generateEmbeddings as aU, generateEngagementInsights as aV, generateVideoEmbeddings as aW, getModerationScores as aX, getSummaryAndTags as aY, hasBurnedInCaptions as aZ, mapShotsToHotspots as a_, type EditCaptionsResult as aa, type EmbeddingsOptions as ab, type EmbeddingsResult as ac, type EngagementInsightsOptions as ad, type EngagementInsightsResult as ae, GOOGLE_VISION_LIKELIHOOD_TO_SCORE as af, HIVE_SEXUAL_CATEGORIES as ag, HIVE_VIOLENCE_CATEGORIES as ah, type HiveModerationOutput as ai, type HiveModerationSource as aj, type ModerationOptions as ak, type ModerationProvider as al, type ModerationResult as am, type MomentInsight as an, type OverallInsight as ao, type ProfanityDetectionPayload as ap, type Question as aq, type QuestionAnswer as ar, type QuestionAnswerType as as, type ReplacementRecord as at, type SpeakerReplacement as au, type StaticRenditionCleanupOutcome as av, type SummarizationOptions as aw, type SummarizationPromptOverrides as ax, type SummarizationPromptSections as ay, type SummaryAndTagsResult as az, type ReplaceAndCreateTextTrackResult as b, profanityDetectionSchema as b0, questionAnswerSchema as b1, shouldSplitChunkTranslationError as b2, summarySchema as b3, transformCueText as b4, translateAudio as b5, translateCaptions as b6, translationSchema as b7, validateNeverTranslateTerms as b8, verifyNeverTranslateTerms as b9, type ReplaceAndCreateTrackInput as c, type ReplaceExistingTracksPolicy as d, type ReplaceableTrackType as e, type SupportedISO639_3 as f, type TextTrackSummary as g, type TextTrackTarget as h, type TrackSummary as i, type TrackTarget as j, buildMuxAiTrackPassthrough as k, findNameCollisionTextTracks as l, findSameLanguageTextTracks as m, getLanguageCodePair as n, getLanguageName as o, isDuplicateTrackNameError as p, isMuxGeneratedTextTrack as q, isUndeterminedLanguageCode as r, isValidISO639_1 as s, isValidISO639_3 as t, normalizeTrackLanguageCode as u, normalizeTrackName as v, planTextTrackReplacement as w, replaceAndCreateTextTrack as x, replaceAndCreateTrack as y, summarizeTextTrack as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
export { I as ISO639_1, a as ISO639_3, L as LanguageCodePair, S as SupportedISO639_1,
|
|
1
|
+
export { I as ISO639_1, a as ISO639_3, L as LanguageCodePair, M as MUX_TRACK_PASSTHROUGH_MAX_CHARS, R as ReplaceAndCreateTextTrackInput, b as ReplaceAndCreateTextTrackResult, c as ReplaceAndCreateTrackInput, d as ReplaceExistingTracksPolicy, e as ReplaceableTrackType, S as SupportedISO639_1, f as SupportedISO639_3, T as TextTrackReplacementPlan, g as TextTrackSummary, h as TextTrackTarget, i as TrackSummary, j as TrackTarget, k as buildMuxAiTrackPassthrough, l as findNameCollisionTextTracks, m as findSameLanguageTextTracks, n as getLanguageCodePair, o as getLanguageName, p as isDuplicateTrackNameError, q as isMuxGeneratedTextTrack, r as isUndeterminedLanguageCode, s as isValidISO639_1, t as isValidISO639_3, u as normalizeTrackLanguageCode, v as normalizeTrackName, w as planTextTrackReplacement, x as replaceAndCreateTextTrack, y as replaceAndCreateTrack, z as summarizeTextTrack, A as toISO639_1, B as toISO639_3, C as validateTrackPassthrough, D as workflows } from './index-NkSOF92U.js';
|
|
2
2
|
import { W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './shots-CUI09Ohe.js';
|
|
3
3
|
export { A as AssetTextTrack, C as ChunkEmbedding, b as ChunkingStrategy, E as Encrypted, c as EncryptedPayload, I as ImageSubmissionMode, M as MuxAIOptions, d as MuxAsset, P as PlaybackAsset, e as PlaybackPolicy, f as ScopedMuxAIOptions, g as StorageAdapter, T as TextChunk, h as TokenChunkingConfig, i as TokenUsage, j as ToneType, U as UsageMetadata, V as VTTChunkingConfig, k as VideoEmbeddingsResult, l as WorkflowCredentialsInput, m as WorkflowMuxClient, n as WorkflowScope, o as decryptFromWorkflow, p as encryptForWorkflow } from './shots-CUI09Ohe.js';
|
|
4
4
|
import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
|
|
5
5
|
export { i as primitives } from './index-C2Pk7bbF.js';
|
|
6
6
|
import 'zod';
|
|
7
|
+
import './prompts/index.js';
|
|
7
8
|
import '@ai-sdk/anthropic';
|
|
8
9
|
import '@ai-sdk/google';
|
|
9
10
|
import '@ai-sdk/openai';
|
|
10
11
|
import '@mux/mux-node';
|
|
11
12
|
|
|
12
|
-
var version = "0.
|
|
13
|
+
var version = "0.42.0";
|
|
13
14
|
|
|
14
15
|
type MuxAiErrorType = "validation_error" | "processing_error" | "timeout_error" | "content_policy_error";
|
|
15
16
|
/**
|