@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.
@@ -1,5 +1,5 @@
1
1
  import { LanguageModel, generateText as generateText$1 } from 'ai';
2
- import { l as WorkflowCredentialsInput, M as MuxAsset, A as AssetTextTrack, T as TokenUsage, f as ScopedMuxAIOptions, I as ImageSubmissionMode, d as MuxAIOptions, b as ChunkingStrategy, k as VideoEmbeddingsResult, H as Hotspot, y as Shot, q as VTTCue, j as ToneType, g as StorageAdapter } from './transcripts-DxSHvTk9.js';
2
+ import { l as WorkflowCredentialsInput, M as MuxAsset, A as AssetTextTrack, T as TokenUsage, f as ScopedMuxAIOptions, I as ImageSubmissionMode, d as MuxAIOptions, b as ChunkingStrategy, k as VideoEmbeddingsResult, H as Hotspot, y as Shot, q as VTTCue, j as ToneType, g as StorageAdapter } from './transcripts-Brw74qlV.js';
3
3
  import { z } from 'zod';
4
4
  import { S as SafetyReport, e as PromptOverrides, h as SceneContextItemV1, D as DEFAULT_DESCRIPTION_LENGTH, a as DEFAULT_SUMMARY_KEYWORD_LIMIT, b as DEFAULT_TITLE_LENGTH } from './summarization-BFmhXeAu.js';
5
5
  import { createAnthropic } from '@ai-sdk/anthropic';
@@ -1,4 +1,4 @@
1
- import { l as WorkflowCredentialsInput, n as WorkflowScope, h as TextChunk, b as ChunkingStrategy, q as VTTCue, r as CompletedShotsResult, D as DeletedShotsResult, s as ErroredShotsResult, H as Hotspot, t as HotspotOptions, u as HotspotResponse, L as LOW_CONFIDENCE_THRESHOLD, v as MAX_CUE_TEXT_CHARS, w as ParseVTTCuesOptions, x as PendingShotsResult, y as Shot, z as ShotRequestOptions, B as ShotsResult, F as SkippedShotsResult, G as TranscriptEmptyReason, J as TranscriptFetchOptions, K as TranscriptFetchStepResult, N as TranscriptResult, O as WaitForShotsOptions, Q as buildTranscriptUrl, R as buildVttFromCueBlocks, X as buildVttFromTranslatedCueBlocks, Y as concatenateVttSegments, Z as extractTextFromVTT, _ as extractTimestampedTranscript, $ as fetchTranscriptDataForUrl, a0 as fetchTranscriptForAsset, a1 as filterVttByScope, a2 as findCaptionTrack, a3 as getHotspotsForAsset, a4 as getHotspotsForPlaybackId, a5 as getHotspotsForVideo, a6 as getReadyTextTracks, a7 as getReliableLanguageCode, a8 as getShotsForAsset, a9 as parseVTTCues, aa as replaceCueText, ab as requestShotsForAsset, ac as sanitizeUntrustedText, ad as secondsToTimestamp, ae as splitVttPreambleAndCueBlocks, af as stripVttMetadataBlocks, ag as vttTimestampToSeconds, ah as waitForShotsForAsset } from './transcripts-DxSHvTk9.js';
1
+ import { l as WorkflowCredentialsInput, n as WorkflowScope, h as TextChunk, b as ChunkingStrategy, q as VTTCue, r as CompletedShotsResult, D as DeletedShotsResult, s as ErroredShotsResult, H as Hotspot, t as HotspotOptions, u as HotspotResponse, L as LOW_CONFIDENCE_THRESHOLD, v as MAX_CUE_TEXT_CHARS, w as ParseVTTCuesOptions, x as PendingShotsResult, y as Shot, z as ShotRequestOptions, B as ShotsResult, F as SkippedShotsResult, G as TranscriptEmptyReason, J as TranscriptFetchOptions, K as TranscriptFetchStepResult, N as TranscriptResult, O as WaitForShotsOptions, Q as buildTranscriptUrl, R as buildVttFromCueBlocks, X as buildVttFromTranslatedCueBlocks, Y as concatenateVttSegments, Z as extractTextFromVTT, _ as extractTimestampedTranscript, $ as fetchTranscriptDataForUrl, a0 as fetchTranscriptForAsset, a1 as filterVttByScope, a2 as findCaptionTrack, a3 as getHotspotsForAsset, a4 as getHotspotsForPlaybackId, a5 as getHotspotsForVideo, a6 as getReadyTextTracks, a7 as getReliableLanguageCode, a8 as getShotsForAsset, a9 as parseVTTCues, aa as replaceCueText, ab as requestShotsForAsset, ac as sanitizeUntrustedText, ad as secondsToTimestamp, ae as splitVttPreambleAndCueBlocks, af as stripVttMetadataBlocks, ag as vttTimestampToSeconds, ah as waitForShotsForAsset } from './transcripts-Brw74qlV.js';
2
2
 
3
3
  interface HeatmapOptions {
4
4
  /** Time window for results, e.g., '7:days' (default: '7:days') */
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
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 ReplaceSourceTrackInput, f as ReplaceableTrackType, S as SourceTrackReplacementPolicy, g as SupportedISO639_1, h as SupportedISO639_3, T as TextTrackReplacementPlan, i as TextTrackSummary, j as TextTrackTarget, k as TrackSummary, l as TrackTarget, m as buildMuxAiTrackPassthrough, n as findNameCollisionTextTracks, o as findSameLanguageTextTracks, p as getLanguageCodePair, q as getLanguageName, r as isDuplicateTrackNameError, s as isMuxGeneratedTextTrack, t as isUndeterminedLanguageCode, u as isValidISO639_1, v as isValidISO639_3, w as normalizeTrackLanguageCode, x as normalizeTrackName, y as planSourceTrackReplacement, z as planTextTrackReplacement, A as replaceAndCreateTextTrack, B as replaceAndCreateTrack, C as replaceSourceTrack, D as summarizeTextTrack, E as toISO639_1, F as toISO639_3, G as validateTrackPassthrough, H as workflows } from './index-BBk0AcY1.js';
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 ReplaceSourceTrackInput, f as ReplaceableTrackType, S as SourceTrackReplacementPolicy, g as SupportedISO639_1, h as SupportedISO639_3, T as TextTrackReplacementPlan, i as TextTrackSummary, j as TextTrackTarget, k as TrackSummary, l as TrackTarget, m as buildMuxAiTrackPassthrough, n as findNameCollisionTextTracks, o as findSameLanguageTextTracks, p as getLanguageCodePair, q as getLanguageName, r as isDuplicateTrackNameError, s as isMuxGeneratedTextTrack, t as isUndeterminedLanguageCode, u as isValidISO639_1, v as isValidISO639_3, w as normalizeTrackLanguageCode, x as normalizeTrackName, y as planSourceTrackReplacement, z as planTextTrackReplacement, A as replaceAndCreateTextTrack, B as replaceAndCreateTrack, C as replaceSourceTrack, D as summarizeTextTrack, E as toISO639_1, F as toISO639_3, G as validateTrackPassthrough, H as workflows } from './index-Bav9fNtf.js';
2
2
  import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
3
- import { T as TokenUsage, M as MuxAsset, W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './transcripts-DxSHvTk9.js';
4
- export { A as AssetTextTrack, C as ChunkEmbedding, b as ChunkingStrategy, E as Encrypted, c as EncryptedPayload, I as ImageSubmissionMode, d as MuxAIOptions, P as PlaybackAsset, e as PlaybackPolicy, f as ScopedMuxAIOptions, g as StorageAdapter, h as TextChunk, i as TokenChunkingConfig, 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 './transcripts-DxSHvTk9.js';
5
- export { i as primitives } from './index-B-rLy1do.js';
3
+ import { T as TokenUsage, M as MuxAsset, W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './transcripts-Brw74qlV.js';
4
+ export { A as AssetTextTrack, C as ChunkEmbedding, b as ChunkingStrategy, E as Encrypted, c as EncryptedPayload, I as ImageSubmissionMode, d as MuxAIOptions, P as PlaybackAsset, e as PlaybackPolicy, f as ScopedMuxAIOptions, g as StorageAdapter, h as TextChunk, i as TokenChunkingConfig, 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 './transcripts-Brw74qlV.js';
5
+ export { i as primitives } from './index-DiuqBw6I.js';
6
6
  import 'ai';
7
7
  import 'zod';
8
8
  import './summarization-BFmhXeAu.js';
@@ -11,7 +11,7 @@ import '@ai-sdk/google';
11
11
  import '@ai-sdk/openai';
12
12
  import '@mux/ts';
13
13
 
14
- var version = "0.55.0";
14
+ var version = "0.56.0";
15
15
 
16
16
  type MuxAiErrorType = "validation_error" | "processing_error" | "timeout_error" | "content_policy_error";
17
17
  interface ModelCallDiagnostics {
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // package.json
8
- var version = "0.55.0";
8
+ var version = "0.56.0";
9
9
 
10
10
  // src/lib/language-codes.ts
11
11
  var ISO639_1_TO_3 = {
@@ -3112,14 +3112,13 @@ function extractTextFromVTT(vttContent) {
3112
3112
  textLines.join(" ").replace(/\s+/g, " ").trim()
3113
3113
  );
3114
3114
  }
3115
+ var VTT_TIMESTAMP_RE = /^(?:(\d+):)?(\d{2}):(\d{2})(?:\.(\d{3}))?$/;
3115
3116
  function vttTimestampToSeconds(timestamp) {
3116
- const parts = timestamp.split(":");
3117
- if (parts.length !== 3)
3118
- return 0;
3119
- const hours = Number.parseInt(parts[0], 10) || 0;
3120
- const minutes = Number.parseInt(parts[1], 10) || 0;
3121
- const seconds = Number.parseFloat(parts[2]) || 0;
3122
- return hours * 3600 + minutes * 60 + seconds;
3117
+ const match = VTT_TIMESTAMP_RE.exec(timestamp);
3118
+ if (!match)
3119
+ return void 0;
3120
+ const [, hours = "0", minutes, seconds, millis = "0"] = match;
3121
+ return Number(hours) * 3600 + Number(minutes) * 60 + Number(seconds) + Number(millis) / 1e3;
3123
3122
  }
3124
3123
  function secondsToTimestamp(seconds) {
3125
3124
  const rounded = Math.max(0, Math.floor(seconds));
@@ -3142,6 +3141,8 @@ function extractTimestampedTranscript(vttContent) {
3142
3141
  if (line.includes("-->")) {
3143
3142
  const startTime = line.split(" --> ")[0].trim();
3144
3143
  const timeInSeconds = vttTimestampToSeconds(startTime);
3144
+ if (timeInSeconds === void 0)
3145
+ continue;
3145
3146
  let j = i + 1;
3146
3147
  while (j < lines.length && !lines[j].trim()) {
3147
3148
  j++;
@@ -3170,13 +3171,17 @@ function parseVTTCues(vttContent, options = {}) {
3170
3171
  if (isTimingLine(line)) {
3171
3172
  const [startStr, endStr] = line.split(" --> ").map((s) => s.trim());
3172
3173
  const startTime = vttTimestampToSeconds(startStr);
3173
- const endTime = vttTimestampToSeconds(endStr.split(" ")[0]);
3174
+ const endTime = vttTimestampToSeconds(endStr?.split(/\s+/)[0] ?? "");
3174
3175
  const currentCueIdentifierLine = lines[i - 1]?.trim() ?? "";
3175
3176
  const currentCueIdentifier = isLikelyCueIdentifier({
3176
3177
  line: currentCueIdentifierLine,
3177
3178
  nextLine: line,
3178
3179
  previousCueIdentifier
3179
3180
  }) ? parseNumericCueIdentifier(currentCueIdentifierLine) : null;
3181
+ if (startTime === void 0 || endTime === void 0) {
3182
+ previousCueIdentifier = currentCueIdentifier;
3183
+ continue;
3184
+ }
3180
3185
  const rawTextLines = [];
3181
3186
  let j = i + 1;
3182
3187
  while (j < lines.length && lines[j].trim() && !isTimingLine(lines[j].trim())) {
@@ -5655,7 +5660,7 @@ function transformCueText(rawVtt, transform) {
5655
5660
  const transformed = lines.map((line) => {
5656
5661
  if (line.includes("-->")) {
5657
5662
  const startTimestamp = line.split("-->")[0].trim();
5658
- currentCueStartTime = vttTimestampToSeconds(startTimestamp);
5663
+ currentCueStartTime = vttTimestampToSeconds(startTimestamp) ?? currentCueStartTime;
5659
5664
  inCueText = true;
5660
5665
  return line;
5661
5666
  }
@@ -5687,7 +5692,7 @@ function transformCueTextBlocks(rawVtt, transform) {
5687
5692
  if (line.includes("-->")) {
5688
5693
  flushCueText();
5689
5694
  const startTimestamp = line.split("-->")[0].trim();
5690
- currentCueStartTime = vttTimestampToSeconds(startTimestamp);
5695
+ currentCueStartTime = vttTimestampToSeconds(startTimestamp) ?? currentCueStartTime;
5691
5696
  transformed.push(line);
5692
5697
  cueTextLines = [];
5693
5698
  continue;