@mux/ai 0.55.0 → 0.56.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-BBk0AcY1.d.ts → index-Bav9fNtf.d.ts} +1 -1
- package/dist/{index-B-rLy1do.d.ts → index-DiuqBw6I.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +16 -11
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +2 -2
- package/dist/primitives/index.js +13 -8
- package/dist/primitives/index.js.map +1 -1
- package/dist/{transcripts-DxSHvTk9.d.ts → transcripts-Brw74qlV.d.ts} +7 -1
- package/dist/workflows/index.d.ts +2 -2
- package/dist/workflows/index.js +15 -10
- package/dist/workflows/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -527,7 +527,13 @@ declare const MAX_CUE_TEXT_CHARS = 2000;
|
|
|
527
527
|
*/
|
|
528
528
|
declare function stripVttMetadataBlocks(vttContent: string): string;
|
|
529
529
|
declare function extractTextFromVTT(vttContent: string): string;
|
|
530
|
-
|
|
530
|
+
/**
|
|
531
|
+
* Converts a WebVTT timestamp (`HH:MM:SS.mmm` or `MM:SS.mmm`) to seconds.
|
|
532
|
+
*
|
|
533
|
+
* @param timestamp - The timestamp to convert
|
|
534
|
+
* @returns The timestamp in seconds, or `undefined` if it is malformed
|
|
535
|
+
*/
|
|
536
|
+
declare function vttTimestampToSeconds(timestamp: string): number | undefined;
|
|
531
537
|
/**
|
|
532
538
|
* Converts seconds to a human-readable timestamp.
|
|
533
539
|
* Returns M:SS for durations under an hour, H:MM:SS for an hour or more.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { J as ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH, K as ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH, N as ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL, O as ASK_QUESTIONS_MAX_QUESTION_LENGTH, P as AskQuestionsOptions, Q as AskQuestionsResult, U as AskQuestionsType, V as AudioTranslationOptions, W as AudioTranslationResult, X as AutoCensorProfanityOptions, Y as BurnedInCaptionsAnalysis, Z as BurnedInCaptionsOptions, _ as BurnedInCaptionsPromptOverrides, $ as BurnedInCaptionsPromptSections, a0 as BurnedInCaptionsResult, a1 as CaptionReplacement, a2 as CensorMode, a3 as Chapter, a4 as ChapterSystemPromptSections, a5 as ChaptersOptions, a6 as ChaptersPromptOverrides, a7 as ChaptersPromptSections, a8 as ChaptersResult, a9 as ChaptersType, aa as DEFAULT_TRANSCRIPT_WINDOWING, ab as EditCaptionsOptions, ac as EditCaptionsResult, ad as EmbeddingsOptions, ae as EmbeddingsResult, af as EngagementInsightsOptions, ag as EngagementInsightsResult, ah as GENERATE_TEXT_CALLS_TO_ACTION, ai as GENERATE_TEXT_CHANNELS, aj as GENERATE_TEXT_CHANNEL_CEILINGS, ak as GENERATE_TEXT_FORMATS, al as GENERATE_TEXT_LENGTH_BOUNDS, am as GENERATE_TEXT_MAX_ARTIFACTS, an as GENERATE_TEXT_MAX_AUDIENCE_CHARS, ao as GENERATE_TEXT_MAX_BRAND_TERMS, ap as GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS, aq as GENERATE_TEXT_MAX_BRAND_TERM_CHARS, ar as GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS, as as GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS, at as GENERATE_TEXT_MAX_SHOT_FRAMES, au as GENERATE_TEXT_MAX_VARIANTS, av as GENERATE_TEXT_VOICES, aw as GOOGLE_VISION_LIKELIHOOD_TO_SCORE, ax as GenerateTextArtifact, ay as GenerateTextCallToAction, az as GenerateTextChannel, aA as GenerateTextFormat, aB as GenerateTextKeyedItem, aC as GenerateTextLengthLimit, aD as GenerateTextOptions, aE as GenerateTextResult, aF as GenerateTextVariant, aG as GenerateTextVoice, aH as GeneratedTextArtifact, aI as GeneratedTextVariant, aJ as HIVE_SEXUAL_CATEGORIES, aK as HIVE_VIOLENCE_CATEGORIES, aL as HiveModerationOutput, aM as HiveModerationSource, aN as ModerationOptions, aO as ModerationProvider, aP as ModerationResult, aQ as ModerationSurfaceStatus, aR as MomentInsight, aS as OverallInsight, aT as ProfanityDetectionPayload, aU as Question, aV as QuestionAnswer, aW as QuestionAnswerType, aX as RepairAttempt, aY as RepairCall, aZ as RepairOptions, a_ as RepairPlan, a$ as RepairResult, b0 as RepairSpan, b1 as ReplacementRecord, b2 as SpeakerReplacement, b3 as StaticRenditionCleanupOutcome, b4 as SummarizationOptions, b5 as SummarizationPromptOverrides, b6 as SummarizationPromptSections, b7 as SummaryAndTagsResult, b8 as SummaryType, b9 as TextLengthLimit, ba as TextRepairModelOptions, bb as ThumbnailModerationScore, bc as ThumbnailModerationSkipReason, bd as ThumbnailModerationStatus, be as TranscriptModerationScore, bf as TranscriptModerationSkipReason, bg as TranscriptModerationStatus, bh as TranslationChunkingOptions, bi as TranslationOptions, bj as TranslationPayload, bk as TranslationResult, bl as aggregateTokenUsage, bm as applyOverrideLists, bn as applyReplacements, bo as applySpeakerReplacements, bp as applyTextRepair, bq as askQuestions, br as buildReplacementRegex, bs as buildTranscriptWindows, bt as burnedInCaptionsSchema, bu as censorVttContent, bv as chapterSchema, bw as chaptersSchema, bx as createReplacer, by as createTextRepairGenerator, bz as editCaptions, bA as extractTranscriptSegmentsForHotspots, bB as findGenerateTextLengthViolation, bC as generateChapters, bD as generateEmbeddings, bE as generateEngagementInsights, bF as generateText, bG as generateVideoEmbeddings, bH as getModerationScores, bI as getSummaryAndTags, bJ as hasBurnedInCaptions, bK as mapShotsToHotspots, bL as measureGenerateTextLength, bM as normalizeTranslatedVtt, bN as planTextRepair, bO as profanityDetectionSchema, bP as questionAnswerSchema, bQ as repairJsonSchema, bR as repairText, bS as resolveGenerateTextLengthLimit, bT as resolveGenerateTextLengthLimits, bU as resolveGenerateTextOptions, bV as runTextRepairLoop, bW as selectGenerateTextShotFrames, bX as shouldSplitChunkTranslationError, bY as summarySchema, bZ as transformCueText, b_ as translateAudio, b$ as translateCaptions, c0 as translationSchema, c1 as validateNeverTranslateTerms, c2 as verifyNeverTranslateTerms } from '../index-
|
|
1
|
+
export { J as ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH, K as ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH, N as ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL, O as ASK_QUESTIONS_MAX_QUESTION_LENGTH, P as AskQuestionsOptions, Q as AskQuestionsResult, U as AskQuestionsType, V as AudioTranslationOptions, W as AudioTranslationResult, X as AutoCensorProfanityOptions, Y as BurnedInCaptionsAnalysis, Z as BurnedInCaptionsOptions, _ as BurnedInCaptionsPromptOverrides, $ as BurnedInCaptionsPromptSections, a0 as BurnedInCaptionsResult, a1 as CaptionReplacement, a2 as CensorMode, a3 as Chapter, a4 as ChapterSystemPromptSections, a5 as ChaptersOptions, a6 as ChaptersPromptOverrides, a7 as ChaptersPromptSections, a8 as ChaptersResult, a9 as ChaptersType, aa as DEFAULT_TRANSCRIPT_WINDOWING, ab as EditCaptionsOptions, ac as EditCaptionsResult, ad as EmbeddingsOptions, ae as EmbeddingsResult, af as EngagementInsightsOptions, ag as EngagementInsightsResult, ah as GENERATE_TEXT_CALLS_TO_ACTION, ai as GENERATE_TEXT_CHANNELS, aj as GENERATE_TEXT_CHANNEL_CEILINGS, ak as GENERATE_TEXT_FORMATS, al as GENERATE_TEXT_LENGTH_BOUNDS, am as GENERATE_TEXT_MAX_ARTIFACTS, an as GENERATE_TEXT_MAX_AUDIENCE_CHARS, ao as GENERATE_TEXT_MAX_BRAND_TERMS, ap as GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS, aq as GENERATE_TEXT_MAX_BRAND_TERM_CHARS, ar as GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS, as as GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS, at as GENERATE_TEXT_MAX_SHOT_FRAMES, au as GENERATE_TEXT_MAX_VARIANTS, av as GENERATE_TEXT_VOICES, aw as GOOGLE_VISION_LIKELIHOOD_TO_SCORE, ax as GenerateTextArtifact, ay as GenerateTextCallToAction, az as GenerateTextChannel, aA as GenerateTextFormat, aB as GenerateTextKeyedItem, aC as GenerateTextLengthLimit, aD as GenerateTextOptions, aE as GenerateTextResult, aF as GenerateTextVariant, aG as GenerateTextVoice, aH as GeneratedTextArtifact, aI as GeneratedTextVariant, aJ as HIVE_SEXUAL_CATEGORIES, aK as HIVE_VIOLENCE_CATEGORIES, aL as HiveModerationOutput, aM as HiveModerationSource, aN as ModerationOptions, aO as ModerationProvider, aP as ModerationResult, aQ as ModerationSurfaceStatus, aR as MomentInsight, aS as OverallInsight, aT as ProfanityDetectionPayload, aU as Question, aV as QuestionAnswer, aW as QuestionAnswerType, aX as RepairAttempt, aY as RepairCall, aZ as RepairOptions, a_ as RepairPlan, a$ as RepairResult, b0 as RepairSpan, b1 as ReplacementRecord, b2 as SpeakerReplacement, b3 as StaticRenditionCleanupOutcome, b4 as SummarizationOptions, b5 as SummarizationPromptOverrides, b6 as SummarizationPromptSections, b7 as SummaryAndTagsResult, b8 as SummaryType, b9 as TextLengthLimit, ba as TextRepairModelOptions, bb as ThumbnailModerationScore, bc as ThumbnailModerationSkipReason, bd as ThumbnailModerationStatus, be as TranscriptModerationScore, bf as TranscriptModerationSkipReason, bg as TranscriptModerationStatus, bh as TranslationChunkingOptions, bi as TranslationOptions, bj as TranslationPayload, bk as TranslationResult, bl as aggregateTokenUsage, bm as applyOverrideLists, bn as applyReplacements, bo as applySpeakerReplacements, bp as applyTextRepair, bq as askQuestions, br as buildReplacementRegex, bs as buildTranscriptWindows, bt as burnedInCaptionsSchema, bu as censorVttContent, bv as chapterSchema, bw as chaptersSchema, bx as createReplacer, by as createTextRepairGenerator, bz as editCaptions, bA as extractTranscriptSegmentsForHotspots, bB as findGenerateTextLengthViolation, bC as generateChapters, bD as generateEmbeddings, bE as generateEngagementInsights, bF as generateText, bG as generateVideoEmbeddings, bH as getModerationScores, bI as getSummaryAndTags, bJ as hasBurnedInCaptions, bK as mapShotsToHotspots, bL as measureGenerateTextLength, bM as normalizeTranslatedVtt, bN as planTextRepair, bO as profanityDetectionSchema, bP as questionAnswerSchema, bQ as repairJsonSchema, bR as repairText, bS as resolveGenerateTextLengthLimit, bT as resolveGenerateTextLengthLimits, bU as resolveGenerateTextOptions, bV as runTextRepairLoop, bW as selectGenerateTextShotFrames, bX as shouldSplitChunkTranslationError, bY as summarySchema, bZ as transformCueText, b_ as translateAudio, b$ as translateCaptions, c0 as translationSchema, c1 as validateNeverTranslateTerms, c2 as verifyNeverTranslateTerms } from '../index-Bav9fNtf.js';
|
|
2
2
|
export { D as DEFAULT_DESCRIPTION_LENGTH, a as DEFAULT_SUMMARY_KEYWORD_LIMIT, b as DEFAULT_TITLE_LENGTH } from '../summarization-BFmhXeAu.js';
|
|
3
3
|
import 'ai';
|
|
4
|
-
import '../transcripts-
|
|
4
|
+
import '../transcripts-Brw74qlV.js';
|
|
5
5
|
import '@mux/ts';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import '@ai-sdk/anthropic';
|
package/dist/workflows/index.js
CHANGED
|
@@ -2670,14 +2670,13 @@ function extractTextFromVTT(vttContent) {
|
|
|
2670
2670
|
textLines.join(" ").replace(/\s+/g, " ").trim()
|
|
2671
2671
|
);
|
|
2672
2672
|
}
|
|
2673
|
+
var VTT_TIMESTAMP_RE = /^(?:(\d+):)?(\d{2}):(\d{2})(?:\.(\d{3}))?$/;
|
|
2673
2674
|
function vttTimestampToSeconds(timestamp) {
|
|
2674
|
-
const
|
|
2675
|
-
if (
|
|
2676
|
-
return 0;
|
|
2677
|
-
const hours =
|
|
2678
|
-
|
|
2679
|
-
const seconds = Number.parseFloat(parts[2]) || 0;
|
|
2680
|
-
return hours * 3600 + minutes * 60 + seconds;
|
|
2675
|
+
const match = VTT_TIMESTAMP_RE.exec(timestamp);
|
|
2676
|
+
if (!match)
|
|
2677
|
+
return void 0;
|
|
2678
|
+
const [, hours = "0", minutes, seconds, millis = "0"] = match;
|
|
2679
|
+
return Number(hours) * 3600 + Number(minutes) * 60 + Number(seconds) + Number(millis) / 1e3;
|
|
2681
2680
|
}
|
|
2682
2681
|
function secondsToTimestamp(seconds) {
|
|
2683
2682
|
const rounded = Math.max(0, Math.floor(seconds));
|
|
@@ -2700,6 +2699,8 @@ function extractTimestampedTranscript(vttContent) {
|
|
|
2700
2699
|
if (line.includes("-->")) {
|
|
2701
2700
|
const startTime = line.split(" --> ")[0].trim();
|
|
2702
2701
|
const timeInSeconds = vttTimestampToSeconds(startTime);
|
|
2702
|
+
if (timeInSeconds === void 0)
|
|
2703
|
+
continue;
|
|
2703
2704
|
let j = i + 1;
|
|
2704
2705
|
while (j < lines.length && !lines[j].trim()) {
|
|
2705
2706
|
j++;
|
|
@@ -2728,13 +2729,17 @@ function parseVTTCues(vttContent, options = {}) {
|
|
|
2728
2729
|
if (isTimingLine(line)) {
|
|
2729
2730
|
const [startStr, endStr] = line.split(" --> ").map((s) => s.trim());
|
|
2730
2731
|
const startTime = vttTimestampToSeconds(startStr);
|
|
2731
|
-
const endTime = vttTimestampToSeconds(endStr
|
|
2732
|
+
const endTime = vttTimestampToSeconds(endStr?.split(/\s+/)[0] ?? "");
|
|
2732
2733
|
const currentCueIdentifierLine = lines[i - 1]?.trim() ?? "";
|
|
2733
2734
|
const currentCueIdentifier = isLikelyCueIdentifier({
|
|
2734
2735
|
line: currentCueIdentifierLine,
|
|
2735
2736
|
nextLine: line,
|
|
2736
2737
|
previousCueIdentifier
|
|
2737
2738
|
}) ? parseNumericCueIdentifier(currentCueIdentifierLine) : null;
|
|
2739
|
+
if (startTime === void 0 || endTime === void 0) {
|
|
2740
|
+
previousCueIdentifier = currentCueIdentifier;
|
|
2741
|
+
continue;
|
|
2742
|
+
}
|
|
2738
2743
|
const rawTextLines = [];
|
|
2739
2744
|
let j = i + 1;
|
|
2740
2745
|
while (j < lines.length && lines[j].trim() && !isTimingLine(lines[j].trim())) {
|
|
@@ -4837,7 +4842,7 @@ function transformCueText(rawVtt, transform) {
|
|
|
4837
4842
|
const transformed = lines.map((line) => {
|
|
4838
4843
|
if (line.includes("-->")) {
|
|
4839
4844
|
const startTimestamp = line.split("-->")[0].trim();
|
|
4840
|
-
currentCueStartTime = vttTimestampToSeconds(startTimestamp);
|
|
4845
|
+
currentCueStartTime = vttTimestampToSeconds(startTimestamp) ?? currentCueStartTime;
|
|
4841
4846
|
inCueText = true;
|
|
4842
4847
|
return line;
|
|
4843
4848
|
}
|
|
@@ -4869,7 +4874,7 @@ function transformCueTextBlocks(rawVtt, transform) {
|
|
|
4869
4874
|
if (line.includes("-->")) {
|
|
4870
4875
|
flushCueText();
|
|
4871
4876
|
const startTimestamp = line.split("-->")[0].trim();
|
|
4872
|
-
currentCueStartTime = vttTimestampToSeconds(startTimestamp);
|
|
4877
|
+
currentCueStartTime = vttTimestampToSeconds(startTimestamp) ?? currentCueStartTime;
|
|
4873
4878
|
transformed.push(line);
|
|
4874
4879
|
cueTextLines = [];
|
|
4875
4880
|
continue;
|