@mux/ai 0.17.1 → 0.18.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 +1 -0
- package/dist/{index-BfsJvx3r.d.ts → index-BjwbvdoQ.d.ts} +276 -8
- package/dist/{index-3G00N5QH.d.ts → index-Drj9Cy_k.d.ts} +75 -2
- package/dist/index.d.ts +22 -3
- package/dist/index.js +912 -166
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.js +260 -6
- package/dist/primitives/index.js.map +1 -1
- package/dist/workflows/index.d.ts +1 -1
- package/dist/workflows/index.js +913 -170
- package/dist/workflows/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -229,6 +229,7 @@ import { workflows, primitives } from "@mux/ai";
|
|
|
229
229
|
| [Audio-Only Workflows](./docs/AUDIO-ONLY.md) | Working with audio-only assets (no video track) |
|
|
230
230
|
| [Evaluations](./docs/EVALS.md) | AI eval testing with the 3 E's framework — [public dashboard](https://evaluating-mux-ai.vercel.app/) |
|
|
231
231
|
| [Examples](./docs/EXAMPLES.md) | Running the example scripts from the repository |
|
|
232
|
+
| [Security](./docs/SECURITY.md) | Prompt-injection threat model, trust boundaries for workflow options, and the `safety` field on results |
|
|
232
233
|
|
|
233
234
|
### Additional Resources
|
|
234
235
|
|
|
@@ -17,6 +17,56 @@ interface ImageDownloadOptions {
|
|
|
17
17
|
exponentialBackoff?: boolean;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Which detector fired on a leak, or `null` when the text is clean.
|
|
22
|
+
*
|
|
23
|
+
* - `canary` — the system-prompt canary token appeared in the output.
|
|
24
|
+
* Near-zero false-positive rate; treat as a confirmed leak.
|
|
25
|
+
* - `prompt_tag` — an XML-like tag taken from our prompt structure
|
|
26
|
+
* appeared in the output. Low false-positive rate.
|
|
27
|
+
* - `encoded_blob` — a long run of base64- or hex-shaped characters
|
|
28
|
+
* appeared in a field expected to hold prose. Heuristic; some false
|
|
29
|
+
* positives on hashes or tokens in tech-content transcripts.
|
|
30
|
+
* - `unexpected_key` — the model emitted a JSON field not declared in
|
|
31
|
+
* the schema (see {@link detectUnexpectedKeys}). Stripped silently
|
|
32
|
+
* by zod's default `.strip()` mode; this signal surfaces the
|
|
33
|
+
* smuggling attempt rather than letting it go unseen.
|
|
34
|
+
*/
|
|
35
|
+
type LeakReason = "canary" | "prompt_tag" | "encoded_blob" | "unexpected_key" | null;
|
|
36
|
+
/**
|
|
37
|
+
* Per-field record of a detected leak. Collected across every scrub
|
|
38
|
+
* performed inside a single workflow invocation and returned to the
|
|
39
|
+
* caller in the workflow result's `safety` field.
|
|
40
|
+
*/
|
|
41
|
+
interface ScrubbedFieldReport {
|
|
42
|
+
/**
|
|
43
|
+
* Identifier for the field that leaked. Format is workflow-specific
|
|
44
|
+
* (e.g. "reasoning[0]", "moment_insight[2]", "description"). Intended
|
|
45
|
+
* for debugging and observability; do not parse programmatically.
|
|
46
|
+
*/
|
|
47
|
+
field: string;
|
|
48
|
+
/** Which detector fired — see {@link LeakReason}. */
|
|
49
|
+
reason: Exclude<LeakReason, null>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Aggregate safety report returned from workflows that perform
|
|
53
|
+
* output-side scrubbing.
|
|
54
|
+
*
|
|
55
|
+
* Operators can use this to alert on suspected prompt-injection traffic
|
|
56
|
+
* without inspecting log warnings. Shape is stable across workflows so a
|
|
57
|
+
* single observer can consume it uniformly.
|
|
58
|
+
*/
|
|
59
|
+
interface SafetyReport {
|
|
60
|
+
/** `true` when at least one field was suppressed by the scrubber. */
|
|
61
|
+
leaksDetected: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* One entry per suppressed field. Empty (but present) when no leaks
|
|
64
|
+
* were detected. Iteration order matches the order scrubs ran, so
|
|
65
|
+
* callers can correlate entries with workflow structure if they wish.
|
|
66
|
+
*/
|
|
67
|
+
scrubbedFields: ScrubbedFieldReport[];
|
|
68
|
+
}
|
|
69
|
+
|
|
20
70
|
type SupportedProvider = "openai" | "anthropic" | "google";
|
|
21
71
|
type SupportedEmbeddingProvider = "openai" | "google";
|
|
22
72
|
type OpenAIModelId = Parameters<ReturnType<typeof createOpenAI>["chat"]>[0];
|
|
@@ -72,6 +122,20 @@ interface AskQuestionsOptions extends MuxAIOptions {
|
|
|
72
122
|
imageDownloadOptions?: ImageDownloadOptions;
|
|
73
123
|
/** Storyboard width in pixels (defaults to 640). */
|
|
74
124
|
storyboardWidth?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Maximum length (in characters) allowed for each entry in a question's
|
|
127
|
+
* `answerOptions` array. Defaults to 150.
|
|
128
|
+
*
|
|
129
|
+
* The cap exists to reject instruction-shaped answer options — a common
|
|
130
|
+
* prompt-injection shape pairs sentence-length options that presuppose
|
|
131
|
+
* the desired outcome, making "answering correctly" equivalent to
|
|
132
|
+
* leaking. Domain-specific category labels (e.g. moderation labels like
|
|
133
|
+
* "Depicts underage individuals in sexual content") can legitimately
|
|
134
|
+
* run 40–80 characters, so the default is set generously. Raise this
|
|
135
|
+
* if your use case has genuinely longer category labels; never widen
|
|
136
|
+
* it to accept arbitrary untrusted input without other safeguards.
|
|
137
|
+
*/
|
|
138
|
+
maxAnswerOptionLength?: number;
|
|
75
139
|
}
|
|
76
140
|
/** Structured return payload for askQuestions workflow. */
|
|
77
141
|
interface AskQuestionsResult {
|
|
@@ -85,8 +149,37 @@ interface AskQuestionsResult {
|
|
|
85
149
|
usage?: TokenUsage;
|
|
86
150
|
/** Raw transcript text used for analysis (when includeTranscript is true). */
|
|
87
151
|
transcriptText?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Aggregate report of output-side scrubbing performed during this call.
|
|
154
|
+
* Populated by {@link scrubFreeTextField}. When present with
|
|
155
|
+
* `leaksDetected: true`, at least one free-text field was suppressed as
|
|
156
|
+
* a suspected prompt leak — consult `scrubbedFields` for details.
|
|
157
|
+
*/
|
|
158
|
+
safety?: SafetyReport;
|
|
88
159
|
}
|
|
89
|
-
/**
|
|
160
|
+
/**
|
|
161
|
+
* Zod schema for a single answer (matches the public QuestionAnswer interface).
|
|
162
|
+
*
|
|
163
|
+
* Uses zod's default `.strip()` mode (rather than `.strict()`) so that
|
|
164
|
+
* an extra key emitted by the model does not fail the whole workflow —
|
|
165
|
+
* it is silently stripped during parse. The smuggling-channel concern
|
|
166
|
+
* (a coerced model emitting a prompt fragment under an unexpected key)
|
|
167
|
+
* is handled out-of-band: the call site re-parses `response.text`,
|
|
168
|
+
* runs {@link detectUnexpectedKeysFromRawText}, and records each extra
|
|
169
|
+
* as an `unexpected_key` entry in the workflow's safety report.
|
|
170
|
+
*
|
|
171
|
+
* The `.max(1000)` cap on `reasoning` is a mechanical limit on how much
|
|
172
|
+
* content can be exfiltrated through this channel.
|
|
173
|
+
*
|
|
174
|
+
* Tuning notes:
|
|
175
|
+
* - `REASONING_FIELD_SCOPE` asks the model to keep reasoning to 1–3
|
|
176
|
+
* concise sentences. Observed lengths are typically 50–200 chars.
|
|
177
|
+
* - The 1000-char cap leaves ~5x headroom over typical output while
|
|
178
|
+
* making a full system-prompt dump (3000+ chars) unable to fit.
|
|
179
|
+
* - A plausible tighter value is 500. Before tightening, confirm via
|
|
180
|
+
* the `safety` telemetry that 90th-percentile observed lengths on
|
|
181
|
+
* legitimate traffic stay well under the new target.
|
|
182
|
+
*/
|
|
90
183
|
declare const questionAnswerSchema: z.ZodObject<{
|
|
91
184
|
question: z.ZodString;
|
|
92
185
|
answer: z.ZodNullable<z.ZodString>;
|
|
@@ -210,6 +303,15 @@ interface BurnedInCaptionsResult {
|
|
|
210
303
|
storyboardUrl: string;
|
|
211
304
|
/** Token usage from the AI provider (for efficiency/cost analysis). */
|
|
212
305
|
usage?: TokenUsage;
|
|
306
|
+
/**
|
|
307
|
+
* Aggregate report of output-side safety signals detected during this
|
|
308
|
+
* call. The workflow's free-text surface is limited to
|
|
309
|
+
* `detectedLanguage`, so most entries here will be `unexpected_key`
|
|
310
|
+
* records — the model emitting a field not declared in
|
|
311
|
+
* `burnedInCaptionsSchema` (which is then silently stripped by
|
|
312
|
+
* zod.strip() but surfaced here as a smuggling signal).
|
|
313
|
+
*/
|
|
314
|
+
safety?: SafetyReport;
|
|
213
315
|
}
|
|
214
316
|
/**
|
|
215
317
|
* Sections of the burned-in captions user prompt that can be overridden.
|
|
@@ -247,7 +349,27 @@ interface BurnedInCaptionsOptions extends MuxAIOptions {
|
|
|
247
349
|
*/
|
|
248
350
|
promptOverrides?: BurnedInCaptionsPromptOverrides;
|
|
249
351
|
}
|
|
250
|
-
/**
|
|
352
|
+
/**
|
|
353
|
+
* Schema used to validate burned-in captions analysis responses.
|
|
354
|
+
*
|
|
355
|
+
* Uses zod's default `.strip()` mode rather than `.strict()`: extra keys
|
|
356
|
+
* the model emits are silently dropped during parse so a provider
|
|
357
|
+
* quirk doesn't fail the whole workflow. The smuggling-channel concern
|
|
358
|
+
* (a coerced model emitting e.g. `{ ..., system_prompt_verbatim: "..." }`)
|
|
359
|
+
* is addressed out-of-band by the `detectUnexpectedKeys` call at the
|
|
360
|
+
* parse site — which logs the extras and records them in the workflow's
|
|
361
|
+
* safety report as `unexpected_key` leaks.
|
|
362
|
+
*
|
|
363
|
+
* `.max(100)` on `detectedLanguage` caps the one free-text field.
|
|
364
|
+
*
|
|
365
|
+
* Tuning notes:
|
|
366
|
+
* - Real language names are short ("English", "Mandarin Chinese",
|
|
367
|
+
* "Brazilian Portuguese"), typically 5–30 chars.
|
|
368
|
+
* - 100 chars leaves ~3x headroom while preventing a multi-hundred-
|
|
369
|
+
* character dump.
|
|
370
|
+
* - Could plausibly tighten to 60 once telemetry shows legitimate
|
|
371
|
+
* outputs consistently well under that.
|
|
372
|
+
*/
|
|
251
373
|
declare const burnedInCaptionsSchema: z.ZodObject<{
|
|
252
374
|
hasBurnedInCaptions: z.ZodBoolean;
|
|
253
375
|
confidence: z.ZodNumber;
|
|
@@ -265,6 +387,23 @@ declare const burnedInCaptionsSchema: z.ZodObject<{
|
|
|
265
387
|
type BurnedInCaptionsAnalysis = z.infer<typeof burnedInCaptionsSchema>;
|
|
266
388
|
declare function hasBurnedInCaptions(assetId: string, options?: BurnedInCaptionsOptions): Promise<BurnedInCaptionsResult>;
|
|
267
389
|
|
|
390
|
+
/**
|
|
391
|
+
* Uses zod's default `.strip()` on both schemas so extra keys the model
|
|
392
|
+
* emits are silently stripped rather than failing the workflow. The
|
|
393
|
+
* smuggling-channel concern (a coerced model emitting prompt fragments
|
|
394
|
+
* under an unexpected key) is surfaced by the call site's
|
|
395
|
+
* `detectUnexpectedKeysFromRawText` pass, which records each extra as
|
|
396
|
+
* an `unexpected_key` entry in the workflow's safety report.
|
|
397
|
+
*
|
|
398
|
+
* `.max(300)` on `title` caps the exfiltration channel.
|
|
399
|
+
*
|
|
400
|
+
* Tuning notes:
|
|
401
|
+
* - Chapter titles are short labels ("Introduction", "Main Topic
|
|
402
|
+
* Discussion") and typically run 10–50 characters.
|
|
403
|
+
* - 300 chars leaves generous headroom (~6x typical). Could plausibly
|
|
404
|
+
* tighten to 150 once telemetry shows no legitimate output
|
|
405
|
+
* approaches that length.
|
|
406
|
+
*/
|
|
268
407
|
declare const chapterSchema: z.ZodObject<{
|
|
269
408
|
startTime: z.ZodNumber;
|
|
270
409
|
title: z.ZodString;
|
|
@@ -306,6 +445,14 @@ interface ChaptersResult {
|
|
|
306
445
|
chapters: Chapter[];
|
|
307
446
|
/** Token usage from the AI provider (for efficiency/cost analysis). */
|
|
308
447
|
usage?: TokenUsage;
|
|
448
|
+
/**
|
|
449
|
+
* Aggregate report of output-side scrubbing performed during this call.
|
|
450
|
+
* When `leaksDetected` is `true`, at least one chapter title was
|
|
451
|
+
* suppressed. Suppressed chapters are dropped from the returned
|
|
452
|
+
* `chapters` array so playback timelines are not decorated with blank
|
|
453
|
+
* titles; consult `scrubbedFields` to know how many were removed.
|
|
454
|
+
*/
|
|
455
|
+
safety?: SafetyReport;
|
|
309
456
|
}
|
|
310
457
|
/**
|
|
311
458
|
* Sections of the chaptering user prompt that can be overridden.
|
|
@@ -360,7 +507,7 @@ interface ChaptersOptions extends MuxAIOptions {
|
|
|
360
507
|
* Sections of the chaptering system prompt that can be overridden.
|
|
361
508
|
* Use these to customize the AI's persona and constraints.
|
|
362
509
|
*/
|
|
363
|
-
type ChapterSystemPromptSections = "role" | "context" | "constraints" | "qualityGuidelines";
|
|
510
|
+
type ChapterSystemPromptSections = "role" | "context" | "security" | "constraints" | "qualityGuidelines";
|
|
364
511
|
declare function generateChapters(assetId: string, options?: ChaptersOptions): Promise<ChaptersResult>;
|
|
365
512
|
|
|
366
513
|
/** Replacement strategy for censored words. */
|
|
@@ -432,8 +579,35 @@ interface EditCaptionsResult {
|
|
|
432
579
|
uploadedTrackId?: string;
|
|
433
580
|
presignedUrl?: string;
|
|
434
581
|
usage?: TokenUsage;
|
|
582
|
+
/**
|
|
583
|
+
* Aggregate report of output-side scrubbing performed during this call.
|
|
584
|
+
* When `leaksDetected` is `true`, at least one entry returned by the
|
|
585
|
+
* profanity detector contained signs of a system-prompt leak (for
|
|
586
|
+
* example, a tag marker emitted in place of a profane word). Leaked
|
|
587
|
+
* entries are dropped before regex construction so they never drive
|
|
588
|
+
* transcript edits.
|
|
589
|
+
*/
|
|
590
|
+
safety?: SafetyReport;
|
|
435
591
|
}
|
|
436
|
-
/**
|
|
592
|
+
/**
|
|
593
|
+
* Schema used when requesting profanity detection from a language model.
|
|
594
|
+
*
|
|
595
|
+
* Uses zod's default `.strip()` mode. Extra keys emitted by the model
|
|
596
|
+
* are silently dropped at parse time; the call site re-parses
|
|
597
|
+
* `response.text` and records each extra as an `unexpected_key` entry
|
|
598
|
+
* in the workflow's safety report.
|
|
599
|
+
*
|
|
600
|
+
* `.max(100)` on each array entry caps how much content can be smuggled
|
|
601
|
+
* through a single "word" slot.
|
|
602
|
+
*
|
|
603
|
+
* Tuning notes:
|
|
604
|
+
* - Legitimate profane words and short phrases are typically 4–20
|
|
605
|
+
* chars, rarely more than 30.
|
|
606
|
+
* - 100 chars leaves ~3x headroom while preventing multi-hundred-char
|
|
607
|
+
* prompt fragments from hiding in a single entry.
|
|
608
|
+
* - Could plausibly tighten to 50 once telemetry shows no legitimate
|
|
609
|
+
* detection approaches that length.
|
|
610
|
+
*/
|
|
437
611
|
declare const profanityDetectionSchema: z.ZodObject<{
|
|
438
612
|
profanity: z.ZodArray<z.ZodString, "many">;
|
|
439
613
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -565,6 +739,14 @@ interface EngagementInsightsResult {
|
|
|
565
739
|
overallInsight: OverallInsight;
|
|
566
740
|
/** Token usage from the AI provider (for efficiency/cost analysis). */
|
|
567
741
|
usage?: TokenUsage;
|
|
742
|
+
/**
|
|
743
|
+
* Aggregate report of output-side scrubbing performed during this call.
|
|
744
|
+
* When `leaksDetected` is `true`, at least one `insight`, the overall
|
|
745
|
+
* `summary`, or an entry of `trends` was suppressed as a suspected
|
|
746
|
+
* prompt leak. Suppressed insights and the summary are replaced with
|
|
747
|
+
* a neutral placeholder; suppressed trends are dropped.
|
|
748
|
+
*/
|
|
749
|
+
safety?: SafetyReport;
|
|
568
750
|
}
|
|
569
751
|
/**
|
|
570
752
|
* Extracts transcript segments that align with hotspot time ranges.
|
|
@@ -712,11 +894,36 @@ declare function getModerationScores(assetId: string, options?: ModerationOption
|
|
|
712
894
|
declare const DEFAULT_SUMMARY_KEYWORD_LIMIT = 10;
|
|
713
895
|
declare const DEFAULT_TITLE_LENGTH = 10;
|
|
714
896
|
declare const DEFAULT_DESCRIPTION_LENGTH = 50;
|
|
897
|
+
/**
|
|
898
|
+
* Length caps (`.max(...)`) on each free-text field are a mechanical
|
|
899
|
+
* defence-in-depth against exfiltration: even if an injection payload
|
|
900
|
+
* coerces the model into leaking, it cannot fit more than the declared
|
|
901
|
+
* number of characters.
|
|
902
|
+
*
|
|
903
|
+
* Typical legitimate lengths and current margin:
|
|
904
|
+
*
|
|
905
|
+
* - `title`: real titles are 25–150 chars (10–20 words). Cap is 500 —
|
|
906
|
+
* very generous. Could plausibly tighten to 200 once telemetry from
|
|
907
|
+
* the `safety` field shows no legitimate outputs approach 200.
|
|
908
|
+
* - `description`: configurable via `descriptionLength` (word count).
|
|
909
|
+
* Default 50 words ≈ 300 chars. The exported schema uses a permissive
|
|
910
|
+
* 10000-char ceiling so consumers who call `summarySchema.parse`
|
|
911
|
+
* directly don't hit surprise failures on large `descriptionLength`
|
|
912
|
+
* configs; the workflow itself parses with a tighter dynamic cap —
|
|
913
|
+
* see {@link buildSummarySchema}.
|
|
914
|
+
* - `keywords` entries: legitimate tags are 10–30 chars. Cap is 200.
|
|
915
|
+
* Could tighten to 80 if we wanted less slack.
|
|
916
|
+
*
|
|
917
|
+
* Tuning signal: a `safety.leaksDetected` hit with `reason: "canary"`
|
|
918
|
+
* or `"prompt_tag"` while legitimate 90th-percentile lengths stay well
|
|
919
|
+
* below the cap is evidence the cap can be tightened without breaking
|
|
920
|
+
* real outputs.
|
|
921
|
+
*/
|
|
715
922
|
declare const summarySchema: z.ZodObject<{
|
|
716
923
|
keywords: z.ZodArray<z.ZodString, "many">;
|
|
717
924
|
title: z.ZodString;
|
|
718
925
|
description: z.ZodString;
|
|
719
|
-
}, "
|
|
926
|
+
}, "strip", z.ZodTypeAny, {
|
|
720
927
|
title: string;
|
|
721
928
|
description: string;
|
|
722
929
|
keywords: string[];
|
|
@@ -742,6 +949,15 @@ interface SummaryAndTagsResult {
|
|
|
742
949
|
usage?: TokenUsage;
|
|
743
950
|
/** Raw transcript text used for analysis (when includeTranscript is true). */
|
|
744
951
|
transcriptText?: string;
|
|
952
|
+
/**
|
|
953
|
+
* Aggregate report of output-side scrubbing performed during this call.
|
|
954
|
+
* When `leaksDetected` is `true`, at least one of `title`, `description`,
|
|
955
|
+
* or an element of `tags` was suppressed because the scrubber detected
|
|
956
|
+
* signs of a prompt leak — consult `scrubbedFields` for which.
|
|
957
|
+
* Suppressed fields are returned as empty strings or omitted from the
|
|
958
|
+
* tags array.
|
|
959
|
+
*/
|
|
960
|
+
safety?: SafetyReport;
|
|
745
961
|
}
|
|
746
962
|
/**
|
|
747
963
|
* Sections of the summarization user prompt that can be overridden.
|
|
@@ -975,6 +1191,15 @@ interface TranslationResult {
|
|
|
975
1191
|
presignedUrl?: string;
|
|
976
1192
|
/** Token usage from the AI provider (for efficiency/cost analysis). */
|
|
977
1193
|
usage?: TokenUsage;
|
|
1194
|
+
/**
|
|
1195
|
+
* Aggregate report of output-side scrubbing performed during this call.
|
|
1196
|
+
* When `leaksDetected` is `true`, at least one translated cue was
|
|
1197
|
+
* suppressed because the scrubber detected signs of a prompt leak; the
|
|
1198
|
+
* cue's source text is substituted back in place so the 1:1 cue
|
|
1199
|
+
* contract and timeline alignment are preserved. Consult
|
|
1200
|
+
* `scrubbedFields` to know which cues were affected.
|
|
1201
|
+
*/
|
|
1202
|
+
safety?: SafetyReport;
|
|
978
1203
|
}
|
|
979
1204
|
/** Configuration accepted by `translateCaptions`. */
|
|
980
1205
|
interface TranslationOptions<P extends SupportedProvider = SupportedProvider> extends MuxAIOptions {
|
|
@@ -1027,7 +1252,16 @@ interface TranslationChunkingOptions {
|
|
|
1027
1252
|
/** Approximate cap for cue text tokens included in a single AI translation chunk. Defaults to 2000. */
|
|
1028
1253
|
maxCueTextTokensPerChunk?: number;
|
|
1029
1254
|
}
|
|
1030
|
-
/**
|
|
1255
|
+
/**
|
|
1256
|
+
* Schema used when requesting caption translation from a language model.
|
|
1257
|
+
*
|
|
1258
|
+
* Uses zod's default `.strip()` mode. Extras emitted by the model are
|
|
1259
|
+
* silently dropped during parse so a benign provider quirk does not
|
|
1260
|
+
* fail the workflow; the call site re-parses `response.text` via
|
|
1261
|
+
* `detectUnexpectedKeysFromRawText` and records each extra as an
|
|
1262
|
+
* `unexpected_key` entry in the safety report — see the matching note
|
|
1263
|
+
* on `burnedInCaptionsSchema` for the full rationale.
|
|
1264
|
+
*/
|
|
1031
1265
|
declare const translationSchema: z.ZodObject<{
|
|
1032
1266
|
translation: z.ZodString;
|
|
1033
1267
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1039,6 +1273,39 @@ declare const translationSchema: z.ZodObject<{
|
|
|
1039
1273
|
type TranslationPayload = z.infer<typeof translationSchema>;
|
|
1040
1274
|
declare function shouldSplitChunkTranslationError(error: unknown): boolean;
|
|
1041
1275
|
declare function aggregateTokenUsage(usages: TokenUsage[]): TokenUsage;
|
|
1276
|
+
/**
|
|
1277
|
+
* Normalise a model-returned VTT string for robustness against
|
|
1278
|
+
* provider wrapping quirks.
|
|
1279
|
+
*
|
|
1280
|
+
* We have observed Anthropic (and occasionally other providers) wrap
|
|
1281
|
+
* their translated VTT output in code fences or HTML tags, lower-case
|
|
1282
|
+
* the `WEBVTT` header, or drop the header entirely. The Mux Video
|
|
1283
|
+
* track ingestion API and web-native VTT players both require the
|
|
1284
|
+
* exact uppercase `WEBVTT` header at the start of the file, so leaving
|
|
1285
|
+
* these quirks in place produces downstream breakage even though the
|
|
1286
|
+
* cue content is correct.
|
|
1287
|
+
*
|
|
1288
|
+
* Transformations (idempotent on already-valid VTT):
|
|
1289
|
+
*
|
|
1290
|
+
* - Strip a surrounding markdown fence with an optional language hint:
|
|
1291
|
+
* "```vtt\\nWEBVTT\\n...\\n```" -> "WEBVTT\\n..."
|
|
1292
|
+
* "```webvtt\\n...\\n```" -> "WEBVTT\\n..."
|
|
1293
|
+
* "```\\nWEBVTT\\n...\\n```" -> "WEBVTT\\n..."
|
|
1294
|
+
*
|
|
1295
|
+
* - Strip a surrounding <code> / <pre> wrapper (Anthropic's common
|
|
1296
|
+
* habit on this task):
|
|
1297
|
+
* "<code>webvtt\\n...\\n</code>" -> "webvtt\\n..." (then normalised)
|
|
1298
|
+
*
|
|
1299
|
+
* - Upper-case a lowercase `webvtt` / `Webvtt` header prefix.
|
|
1300
|
+
*
|
|
1301
|
+
* - Prepend `WEBVTT\\n\\n` if the header is missing entirely (model
|
|
1302
|
+
* jumped straight to the first cue block).
|
|
1303
|
+
*
|
|
1304
|
+
* Only the whole-VTT translation path calls this — the cue-chunked
|
|
1305
|
+
* path rebuilds the VTT locally via `buildVttFromTranslatedCueBlocks`,
|
|
1306
|
+
* so the header comes from our code and needs no fix-up.
|
|
1307
|
+
*/
|
|
1308
|
+
declare function normalizeTranslatedVtt(translation: string): string;
|
|
1042
1309
|
declare function translateCaptions<P extends SupportedProvider = SupportedProvider>(assetId: string, trackId: string, toLanguageCode: string, options: TranslationOptions<P>): Promise<TranslationResult>;
|
|
1043
1310
|
|
|
1044
1311
|
type index_AskQuestionsOptions = AskQuestionsOptions;
|
|
@@ -1114,6 +1381,7 @@ declare const index_getModerationScores: typeof getModerationScores;
|
|
|
1114
1381
|
declare const index_getSummaryAndTags: typeof getSummaryAndTags;
|
|
1115
1382
|
declare const index_hasBurnedInCaptions: typeof hasBurnedInCaptions;
|
|
1116
1383
|
declare const index_mapShotsToHotspots: typeof mapShotsToHotspots;
|
|
1384
|
+
declare const index_normalizeTranslatedVtt: typeof normalizeTranslatedVtt;
|
|
1117
1385
|
declare const index_profanityDetectionSchema: typeof profanityDetectionSchema;
|
|
1118
1386
|
declare const index_questionAnswerSchema: typeof questionAnswerSchema;
|
|
1119
1387
|
declare const index_shouldSplitChunkTranslationError: typeof shouldSplitChunkTranslationError;
|
|
@@ -1123,7 +1391,7 @@ declare const index_translateAudio: typeof translateAudio;
|
|
|
1123
1391
|
declare const index_translateCaptions: typeof translateCaptions;
|
|
1124
1392
|
declare const index_translationSchema: typeof translationSchema;
|
|
1125
1393
|
declare namespace index {
|
|
1126
|
-
export { 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_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_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_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_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 };
|
|
1394
|
+
export { 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_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_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_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 };
|
|
1127
1395
|
}
|
|
1128
1396
|
|
|
1129
|
-
export { type TranslationResult as $, type AskQuestionsOptions as A, type BurnedInCaptionsAnalysis as B, type CaptionReplacement as C, DEFAULT_DESCRIPTION_LENGTH as D, type EditCaptionsOptions as E, type HiveModerationOutput as F, type HiveModerationSource as G, HIVE_SEXUAL_CATEGORIES as H, type ModerationProvider as I, type ModerationResult as J, type MomentInsight as K, type QuestionAnswer as L, type ModerationOptions as M, type QuestionAnswerType as N, type OverallInsight as O, type ProfanityDetectionPayload as P, type Question as Q, type ReplacementRecord as R, type SummarizationOptions as S, type SummarizationPromptOverrides as T, type SummarizationPromptSections as U, type SummaryAndTagsResult as V, type SummaryType as W, type ThumbnailModerationScore as X, type TranslationChunkingOptions as Y, type TranslationOptions as Z, type TranslationPayload as _, type AskQuestionsResult as a, aggregateTokenUsage as a0, applyOverrideLists as a1, applyReplacements as a2, askQuestions as a3, buildReplacementRegex as a4, burnedInCaptionsSchema as a5, censorVttContent as a6, chapterSchema as a7, chaptersSchema as a8, createReplacer as a9, editCaptions as aa, extractTranscriptSegmentsForHotspots as ab, generateChapters as ac, generateEmbeddings as ad, generateEngagementInsights as ae, generateVideoEmbeddings as af, getModerationScores as ag, getSummaryAndTags as ah, hasBurnedInCaptions as ai, mapShotsToHotspots as aj,
|
|
1397
|
+
export { type TranslationResult as $, type AskQuestionsOptions as A, type BurnedInCaptionsAnalysis as B, type CaptionReplacement as C, DEFAULT_DESCRIPTION_LENGTH as D, type EditCaptionsOptions as E, type HiveModerationOutput as F, type HiveModerationSource as G, HIVE_SEXUAL_CATEGORIES as H, type ModerationProvider as I, type ModerationResult as J, type MomentInsight as K, type QuestionAnswer as L, type ModerationOptions as M, type QuestionAnswerType as N, type OverallInsight as O, type ProfanityDetectionPayload as P, type Question as Q, type ReplacementRecord as R, type SummarizationOptions as S, type SummarizationPromptOverrides as T, type SummarizationPromptSections as U, type SummaryAndTagsResult as V, type SummaryType as W, type ThumbnailModerationScore as X, type TranslationChunkingOptions as Y, type TranslationOptions as Z, type TranslationPayload as _, type AskQuestionsResult as a, aggregateTokenUsage as a0, applyOverrideLists as a1, applyReplacements as a2, askQuestions as a3, buildReplacementRegex as a4, burnedInCaptionsSchema as a5, censorVttContent as a6, chapterSchema as a7, chaptersSchema as a8, createReplacer as a9, editCaptions as aa, extractTranscriptSegmentsForHotspots as ab, generateChapters as ac, generateEmbeddings as ad, generateEngagementInsights as ae, generateVideoEmbeddings as af, getModerationScores as ag, getSummaryAndTags as ah, hasBurnedInCaptions as ai, mapShotsToHotspots as aj, normalizeTranslatedVtt as ak, profanityDetectionSchema as al, questionAnswerSchema as am, shouldSplitChunkTranslationError as an, summarySchema as ao, transformCueText as ap, translateAudio as aq, translateCaptions as ar, translationSchema as as, type AskQuestionsType as b, type AudioTranslationOptions as c, type AudioTranslationResult as d, type AutoCensorProfanityOptions as e, type BurnedInCaptionsOptions as f, type BurnedInCaptionsPromptOverrides as g, type BurnedInCaptionsPromptSections as h, index as i, type BurnedInCaptionsResult as j, type CensorMode as k, type Chapter as l, type ChapterSystemPromptSections as m, type ChaptersOptions as n, type ChaptersPromptOverrides as o, type ChaptersPromptSections as p, type ChaptersResult as q, type ChaptersType as r, DEFAULT_SUMMARY_KEYWORD_LIMIT as s, DEFAULT_TITLE_LENGTH as t, type EditCaptionsResult as u, type EmbeddingsOptions as v, type EmbeddingsResult as w, type EngagementInsightsOptions as x, type EngagementInsightsResult as y, HIVE_VIOLENCE_CATEGORIES as z };
|
|
@@ -106,6 +106,76 @@ declare const LOW_CONFIDENCE_THRESHOLD = 0.5;
|
|
|
106
106
|
* @param confidenceThreshold - Minimum confidence to trust auto-detected language (default: {@link LOW_CONFIDENCE_THRESHOLD})
|
|
107
107
|
*/
|
|
108
108
|
declare function getReliableLanguageCode(track: AssetTextTrack | undefined, confidenceThreshold?: number): string | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Sanitise untrusted text (typically a VTT cue or joined transcript)
|
|
111
|
+
* before it is interpolated into a prompt. Thin wrapper around the
|
|
112
|
+
* shared {@link normalizeUntrustedUnicode} helper, with a null/empty
|
|
113
|
+
* guard for convenience.
|
|
114
|
+
*/
|
|
115
|
+
declare function sanitizeUntrustedText(value: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* Upper bound on individual cue text length before we consider the cue
|
|
118
|
+
* adversarial and truncate it.
|
|
119
|
+
*
|
|
120
|
+
* Legitimate captions are short — a long monologue cue rarely exceeds
|
|
121
|
+
* 500 characters, and most captioning standards recommend well under
|
|
122
|
+
* that for readability. We set the cap at 2000 to give comfortable
|
|
123
|
+
* headroom for edge cases (stage directions, speaker identification,
|
|
124
|
+
* multi-line blocks) while making "hide a multi-kilobyte injection
|
|
125
|
+
* payload inside a single cue" mechanically infeasible.
|
|
126
|
+
*/
|
|
127
|
+
declare const MAX_CUE_TEXT_CHARS = 2000;
|
|
128
|
+
/**
|
|
129
|
+
* Strip VTT metadata blocks that are never rendered by players but can
|
|
130
|
+
* still carry text through to an LLM when the raw VTT is used in a prompt:
|
|
131
|
+
*
|
|
132
|
+
* - NOTE blocks (VTT comments)
|
|
133
|
+
* - STYLE blocks (CSS for cue styling)
|
|
134
|
+
* - REGION blocks (positioning definitions)
|
|
135
|
+
*
|
|
136
|
+
* Viewers never see the contents of these blocks. That makes them an
|
|
137
|
+
* ideal hiding spot for prompt-injection payloads — an attacker-controlled
|
|
138
|
+
* caption file can carry hundreds of bytes of "NOTE ignore previous
|
|
139
|
+
* instructions…" that will be stripped from any player but will reach the
|
|
140
|
+
* model if the raw VTT is passed through. Removing them before sending
|
|
141
|
+
* the VTT to the model closes that channel without changing what the
|
|
142
|
+
* model sees for legitimate cue content.
|
|
143
|
+
*
|
|
144
|
+
* Cue identifiers, timing lines, and cue payload text are preserved.
|
|
145
|
+
* In particular: a cue whose first payload line happens to start with
|
|
146
|
+
* `NOTE `/`STYLE `/`REGION ` (plausible in legitimate captions — e.g.
|
|
147
|
+
* `"NOTE THAT..."`, `"STYLE GUIDE"`, `"NOTE how the villain plots..."`)
|
|
148
|
+
* is NOT treated as a metadata block. The scanner tracks cue-payload
|
|
149
|
+
* state: metadata headers are only recognised between cues (i.e. when
|
|
150
|
+
* the previous non-blank line was not a timing line).
|
|
151
|
+
*
|
|
152
|
+
* Example input:
|
|
153
|
+
*
|
|
154
|
+
* WEBVTT
|
|
155
|
+
*
|
|
156
|
+
* NOTE This is a comment with hidden instructions
|
|
157
|
+
* that span multiple lines until a blank line appears.
|
|
158
|
+
*
|
|
159
|
+
* STYLE
|
|
160
|
+
* ::cue(b) { font-weight: bold; }
|
|
161
|
+
*
|
|
162
|
+
* 00:00:01.000 --> 00:00:04.000
|
|
163
|
+
* Legitimate caption text
|
|
164
|
+
*
|
|
165
|
+
* 00:00:05.000 --> 00:00:08.000
|
|
166
|
+
* NOTE THAT the hero wins
|
|
167
|
+
*
|
|
168
|
+
* Returns:
|
|
169
|
+
*
|
|
170
|
+
* WEBVTT
|
|
171
|
+
*
|
|
172
|
+
* 00:00:01.000 --> 00:00:04.000
|
|
173
|
+
* Legitimate caption text
|
|
174
|
+
*
|
|
175
|
+
* 00:00:05.000 --> 00:00:08.000
|
|
176
|
+
* NOTE THAT the hero wins
|
|
177
|
+
*/
|
|
178
|
+
declare function stripVttMetadataBlocks(vttContent: string): string;
|
|
109
179
|
declare function extractTextFromVTT(vttContent: string): string;
|
|
110
180
|
declare function vttTimestampToSeconds(timestamp: string): number;
|
|
111
181
|
/**
|
|
@@ -247,6 +317,7 @@ declare const index_Hotspot: typeof Hotspot;
|
|
|
247
317
|
declare const index_HotspotOptions: typeof HotspotOptions;
|
|
248
318
|
declare const index_HotspotResponse: typeof HotspotResponse;
|
|
249
319
|
declare const index_LOW_CONFIDENCE_THRESHOLD: typeof LOW_CONFIDENCE_THRESHOLD;
|
|
320
|
+
declare const index_MAX_CUE_TEXT_CHARS: typeof MAX_CUE_TEXT_CHARS;
|
|
250
321
|
declare const index_PendingShotsResult: typeof PendingShotsResult;
|
|
251
322
|
declare const index_Shot: typeof Shot;
|
|
252
323
|
declare const index_ShotRequestOptions: typeof ShotRequestOptions;
|
|
@@ -287,12 +358,14 @@ declare const index_getThumbnailUrls: typeof getThumbnailUrls;
|
|
|
287
358
|
declare const index_parseVTTCues: typeof parseVTTCues;
|
|
288
359
|
declare const index_replaceCueText: typeof replaceCueText;
|
|
289
360
|
declare const index_requestShotsForAsset: typeof requestShotsForAsset;
|
|
361
|
+
declare const index_sanitizeUntrustedText: typeof sanitizeUntrustedText;
|
|
290
362
|
declare const index_secondsToTimestamp: typeof secondsToTimestamp;
|
|
291
363
|
declare const index_splitVttPreambleAndCueBlocks: typeof splitVttPreambleAndCueBlocks;
|
|
364
|
+
declare const index_stripVttMetadataBlocks: typeof stripVttMetadataBlocks;
|
|
292
365
|
declare const index_vttTimestampToSeconds: typeof vttTimestampToSeconds;
|
|
293
366
|
declare const index_waitForShotsForAsset: typeof waitForShotsForAsset;
|
|
294
367
|
declare namespace index {
|
|
295
|
-
export { index_CompletedShotsResult as CompletedShotsResult, index_DEFAULT_STORYBOARD_WIDTH as DEFAULT_STORYBOARD_WIDTH, index_ErroredShotsResult as ErroredShotsResult, type index_HeatmapOptions as HeatmapOptions, type index_HeatmapResponse as HeatmapResponse, index_Hotspot as Hotspot, index_HotspotOptions as HotspotOptions, index_HotspotResponse as HotspotResponse, index_LOW_CONFIDENCE_THRESHOLD as LOW_CONFIDENCE_THRESHOLD, index_PendingShotsResult as PendingShotsResult, index_Shot as Shot, index_ShotRequestOptions as ShotRequestOptions, index_ShotsResult as ShotsResult, type index_ThumbnailOptions as ThumbnailOptions, type index_TranscriptFetchOptions as TranscriptFetchOptions, type index_TranscriptResult as TranscriptResult, type index_VTTCue as VTTCue, type index_VTTCueBudgetChunkingOptions as VTTCueBudgetChunkingOptions, type index_VTTDurationChunk as VTTDurationChunk, type index_VTTDurationChunkingOptions as VTTDurationChunkingOptions, index_WaitForShotsOptions as WaitForShotsOptions, index_buildTranscriptUrl as buildTranscriptUrl, index_buildVttFromCueBlocks as buildVttFromCueBlocks, index_buildVttFromTranslatedCueBlocks as buildVttFromTranslatedCueBlocks, index_chunkByTokens as chunkByTokens, index_chunkText as chunkText, index_chunkVTTCues as chunkVTTCues, index_chunkVTTCuesByBudget as chunkVTTCuesByBudget, index_chunkVTTCuesByDuration as chunkVTTCuesByDuration, index_concatenateVttSegments as concatenateVttSegments, index_estimateTokenCount as estimateTokenCount, index_extractTextFromVTT as extractTextFromVTT, index_extractTimestampedTranscript as extractTimestampedTranscript, index_fetchTranscriptForAsset as fetchTranscriptForAsset, index_findCaptionTrack as findCaptionTrack, index_getHeatmapForAsset as getHeatmapForAsset, index_getHeatmapForPlaybackId as getHeatmapForPlaybackId, index_getHeatmapForVideo as getHeatmapForVideo, index_getHotspotsForAsset as getHotspotsForAsset, index_getHotspotsForPlaybackId as getHotspotsForPlaybackId, index_getHotspotsForVideo as getHotspotsForVideo, index_getReadyTextTracks as getReadyTextTracks, index_getReliableLanguageCode as getReliableLanguageCode, index_getShotsForAsset as getShotsForAsset, index_getStoryboardUrl as getStoryboardUrl, index_getThumbnailUrls as getThumbnailUrls, index_parseVTTCues as parseVTTCues, index_replaceCueText as replaceCueText, index_requestShotsForAsset as requestShotsForAsset, index_secondsToTimestamp as secondsToTimestamp, index_splitVttPreambleAndCueBlocks as splitVttPreambleAndCueBlocks, index_vttTimestampToSeconds as vttTimestampToSeconds, index_waitForShotsForAsset as waitForShotsForAsset };
|
|
368
|
+
export { index_CompletedShotsResult as CompletedShotsResult, index_DEFAULT_STORYBOARD_WIDTH as DEFAULT_STORYBOARD_WIDTH, index_ErroredShotsResult as ErroredShotsResult, type index_HeatmapOptions as HeatmapOptions, type index_HeatmapResponse as HeatmapResponse, index_Hotspot as Hotspot, index_HotspotOptions as HotspotOptions, index_HotspotResponse as HotspotResponse, index_LOW_CONFIDENCE_THRESHOLD as LOW_CONFIDENCE_THRESHOLD, index_MAX_CUE_TEXT_CHARS as MAX_CUE_TEXT_CHARS, index_PendingShotsResult as PendingShotsResult, index_Shot as Shot, index_ShotRequestOptions as ShotRequestOptions, index_ShotsResult as ShotsResult, type index_ThumbnailOptions as ThumbnailOptions, type index_TranscriptFetchOptions as TranscriptFetchOptions, type index_TranscriptResult as TranscriptResult, type index_VTTCue as VTTCue, type index_VTTCueBudgetChunkingOptions as VTTCueBudgetChunkingOptions, type index_VTTDurationChunk as VTTDurationChunk, type index_VTTDurationChunkingOptions as VTTDurationChunkingOptions, index_WaitForShotsOptions as WaitForShotsOptions, index_buildTranscriptUrl as buildTranscriptUrl, index_buildVttFromCueBlocks as buildVttFromCueBlocks, index_buildVttFromTranslatedCueBlocks as buildVttFromTranslatedCueBlocks, index_chunkByTokens as chunkByTokens, index_chunkText as chunkText, index_chunkVTTCues as chunkVTTCues, index_chunkVTTCuesByBudget as chunkVTTCuesByBudget, index_chunkVTTCuesByDuration as chunkVTTCuesByDuration, index_concatenateVttSegments as concatenateVttSegments, index_estimateTokenCount as estimateTokenCount, index_extractTextFromVTT as extractTextFromVTT, index_extractTimestampedTranscript as extractTimestampedTranscript, index_fetchTranscriptForAsset as fetchTranscriptForAsset, index_findCaptionTrack as findCaptionTrack, index_getHeatmapForAsset as getHeatmapForAsset, index_getHeatmapForPlaybackId as getHeatmapForPlaybackId, index_getHeatmapForVideo as getHeatmapForVideo, index_getHotspotsForAsset as getHotspotsForAsset, index_getHotspotsForPlaybackId as getHotspotsForPlaybackId, index_getHotspotsForVideo as getHotspotsForVideo, index_getReadyTextTracks as getReadyTextTracks, index_getReliableLanguageCode as getReliableLanguageCode, index_getShotsForAsset as getShotsForAsset, index_getStoryboardUrl as getStoryboardUrl, index_getThumbnailUrls as getThumbnailUrls, index_parseVTTCues as parseVTTCues, index_replaceCueText as replaceCueText, index_requestShotsForAsset as requestShotsForAsset, index_sanitizeUntrustedText as sanitizeUntrustedText, index_secondsToTimestamp as secondsToTimestamp, index_splitVttPreambleAndCueBlocks as splitVttPreambleAndCueBlocks, index_stripVttMetadataBlocks as stripVttMetadataBlocks, index_vttTimestampToSeconds as vttTimestampToSeconds, index_waitForShotsForAsset as waitForShotsForAsset };
|
|
296
369
|
}
|
|
297
370
|
|
|
298
|
-
export { getStoryboardUrl as A, getThumbnailUrls as B, parseVTTCues as C, DEFAULT_STORYBOARD_WIDTH as D, replaceCueText as E,
|
|
371
|
+
export { getStoryboardUrl as A, getThumbnailUrls as B, parseVTTCues as C, DEFAULT_STORYBOARD_WIDTH as D, replaceCueText as E, sanitizeUntrustedText as F, secondsToTimestamp as G, type HeatmapOptions as H, splitVttPreambleAndCueBlocks as I, stripVttMetadataBlocks as J, vttTimestampToSeconds as K, LOW_CONFIDENCE_THRESHOLD as L, MAX_CUE_TEXT_CHARS as M, type ThumbnailOptions as T, type VTTCue as V, type HeatmapResponse as a, type TranscriptFetchOptions as b, type TranscriptResult as c, type VTTCueBudgetChunkingOptions as d, type VTTDurationChunk as e, type VTTDurationChunkingOptions as f, buildTranscriptUrl as g, buildVttFromCueBlocks as h, index as i, buildVttFromTranslatedCueBlocks as j, chunkByTokens as k, chunkText as l, chunkVTTCues as m, chunkVTTCuesByBudget as n, chunkVTTCuesByDuration as o, concatenateVttSegments as p, estimateTokenCount as q, extractTextFromVTT as r, extractTimestampedTranscript as s, fetchTranscriptForAsset as t, findCaptionTrack as u, getHeatmapForAsset as v, getHeatmapForPlaybackId as w, getHeatmapForVideo as x, getReadyTextTracks as y, getReliableLanguageCode as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './shots-BFYOfBgN.js';
|
|
2
2
|
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 StorageAdapter, T as TextChunk, g as TokenChunkingConfig, h as TokenUsage, i as ToneType, U as UsageMetadata, V as VTTChunkingConfig, j as VideoEmbeddingsResult, k as WorkflowCredentialsInput, l as WorkflowMuxClient, m as decryptFromWorkflow, n as encryptForWorkflow } from './shots-BFYOfBgN.js';
|
|
3
3
|
import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
|
|
4
|
-
export { i as primitives } from './index-
|
|
5
|
-
export { i as workflows } from './index-
|
|
4
|
+
export { i as primitives } from './index-Drj9Cy_k.js';
|
|
5
|
+
export { i as workflows } from './index-BjwbvdoQ.js';
|
|
6
6
|
import '@mux/mux-node';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import '@ai-sdk/anthropic';
|
|
9
9
|
import '@ai-sdk/google';
|
|
10
10
|
import '@ai-sdk/openai';
|
|
11
11
|
|
|
12
|
-
var version = "0.
|
|
12
|
+
var version = "0.18.0";
|
|
13
13
|
|
|
14
14
|
type MuxAiErrorType = "validation_error" | "processing_error" | "timeout_error";
|
|
15
15
|
/**
|
|
@@ -45,6 +45,25 @@ declare class MuxAiError extends Error {
|
|
|
45
45
|
*
|
|
46
46
|
* Use this in catch blocks that re-throw so a customer-safe error from a
|
|
47
47
|
* callee isn't accidentally converted into an internal error.
|
|
48
|
+
*
|
|
49
|
+
* The upstream `detail` is scrubbed for **high-confidence** signs of a
|
|
50
|
+
* system-prompt leak before being folded into the thrown message.
|
|
51
|
+
* Rationale: the AI SDK and some providers include the offending model
|
|
52
|
+
* output in their error messages (e.g. "Failed to parse structured
|
|
53
|
+
* output: { reasoning: '<role>…' }"). If an injection payload caused
|
|
54
|
+
* the parse failure, the raw output would otherwise bypass the
|
|
55
|
+
* free-text scrubber and reach the caller through the error channel.
|
|
56
|
+
*
|
|
57
|
+
* Only the `canary` and `prompt_tag` detectors trigger suppression
|
|
58
|
+
* here — they have very low false-positive rates. The `encoded_blob`
|
|
59
|
+
* heuristic is intentionally NOT applied to error messages: legitimate
|
|
60
|
+
* upstream errors from infrastructure (S3 errors containing ETags,
|
|
61
|
+
* git errors containing SHAs, AWS request IDs, content hashes) can
|
|
62
|
+
* match the encoded-blob shape without being a prompt leak. Suppressing
|
|
63
|
+
* those would erase useful debugging information with no security
|
|
64
|
+
* benefit, because an attacker exfiltrating through a shaped blob would
|
|
65
|
+
* trigger the much stronger field-level scrubber on the preceding
|
|
66
|
+
* model output.
|
|
48
67
|
*/
|
|
49
68
|
declare function wrapError(error: unknown, message: string): never;
|
|
50
69
|
|