@mux/ai 0.28.1 → 0.29.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,4 +1,4 @@
1
- import { k as WorkflowCredentialsInput, A as AssetTextTrack, d as MuxAsset, T as TextChunk, b as ChunkingStrategy, o as CompletedShotsResult, p as ErroredShotsResult, H as Hotspot, q as HotspotOptions, r as HotspotResponse, s as PendingShotsResult, t as Shot, u as ShotRequestOptions, v as ShotsResult, w as WaitForShotsOptions, x as getHotspotsForAsset, y as getHotspotsForPlaybackId, z as getHotspotsForVideo, B as getShotsForAsset, D as requestShotsForAsset, F as waitForShotsForAsset } from './shots-mGJfYGiO.js';
1
+ import { l as WorkflowCredentialsInput, n as WorkflowScope, A as AssetTextTrack, d as MuxAsset, T as TextChunk, b as ChunkingStrategy, q as CompletedShotsResult, r as ErroredShotsResult, H as Hotspot, s as HotspotOptions, t as HotspotResponse, u as PendingShotsResult, v as Shot, w as ShotRequestOptions, x as ShotsResult, y as WaitForShotsOptions, z as getHotspotsForAsset, B as getHotspotsForPlaybackId, D as getHotspotsForVideo, F as getShotsForAsset, G as requestShotsForAsset, J as waitForShotsForAsset } from './shots-BKd7TMFN.js';
2
2
 
3
3
  interface HeatmapOptions {
4
4
  /** Time window for results, e.g., '7:days' (default: '7:days') */
@@ -53,9 +53,11 @@ declare const DEFAULT_STORYBOARD_WIDTH = 640;
53
53
  * @param playbackId - The Mux playback ID
54
54
  * @param width - Width of the storyboard in pixels (default: 640)
55
55
  * @param shouldSign - Flag for whether or not to use signed playback IDs (default: false)
56
+ * @param credentials - Optional workflow credentials used for signing
57
+ * @param scope - Optional asset-relative range for storyboard tiles
56
58
  * @returns Storyboard URL (signed if shouldSign is true)
57
59
  */
58
- declare function getStoryboardUrl(playbackId: string, width?: number, shouldSign?: boolean, credentials?: WorkflowCredentialsInput): Promise<string>;
60
+ declare function getStoryboardUrl(playbackId: string, width?: number, shouldSign?: boolean, credentials?: WorkflowCredentialsInput, scope?: WorkflowScope): Promise<string>;
59
61
 
60
62
  /** A single cue from a VTT file with timing info. */
61
63
  interface VTTCue {
@@ -66,6 +68,8 @@ interface VTTCue {
66
68
  interface TranscriptFetchOptions {
67
69
  languageCode?: string;
68
70
  cleanTranscript?: boolean;
71
+ /** Optional asset-relative time range used to filter transcript cues. */
72
+ scope?: WorkflowScope;
69
73
  /** Optional signing context for signed playback IDs */
70
74
  shouldSign?: boolean;
71
75
  credentials?: WorkflowCredentialsInput;
@@ -194,6 +198,13 @@ declare function extractTimestampedTranscript(vttContent: string): string;
194
198
  * @returns Array of VTT cues with start/end times and text
195
199
  */
196
200
  declare function parseVTTCues(vttContent: string): VTTCue[];
201
+ /**
202
+ * Keeps only VTT cues that overlap an asset-relative time range.
203
+ *
204
+ * Cue timestamps remain relative to the original asset; they are not rebased
205
+ * to the start of the scope.
206
+ */
207
+ declare function filterVttByScope(vttContent: string, scope: WorkflowScope | undefined): string;
197
208
  declare function splitVttPreambleAndCueBlocks(vttContent: string): {
198
209
  preamble: string;
199
210
  cueBlocks: string[];
@@ -293,6 +304,8 @@ interface ThumbnailOptions {
293
304
  maxSamples?: number;
294
305
  /** Workflow credentials for signing (optional). */
295
306
  credentials?: WorkflowCredentialsInput;
307
+ /** Optional asset-relative range from which thumbnails should be sampled. */
308
+ scope?: WorkflowScope;
296
309
  }
297
310
  /**
298
311
  * Generates thumbnail URLs at regular intervals based on video duration.
@@ -343,6 +356,7 @@ declare const index_estimateTokenCount: typeof estimateTokenCount;
343
356
  declare const index_extractTextFromVTT: typeof extractTextFromVTT;
344
357
  declare const index_extractTimestampedTranscript: typeof extractTimestampedTranscript;
345
358
  declare const index_fetchTranscriptForAsset: typeof fetchTranscriptForAsset;
359
+ declare const index_filterVttByScope: typeof filterVttByScope;
346
360
  declare const index_findCaptionTrack: typeof findCaptionTrack;
347
361
  declare const index_getHeatmapForAsset: typeof getHeatmapForAsset;
348
362
  declare const index_getHeatmapForPlaybackId: typeof getHeatmapForPlaybackId;
@@ -365,7 +379,7 @@ declare const index_stripVttMetadataBlocks: typeof stripVttMetadataBlocks;
365
379
  declare const index_vttTimestampToSeconds: typeof vttTimestampToSeconds;
366
380
  declare const index_waitForShotsForAsset: typeof waitForShotsForAsset;
367
381
  declare namespace index {
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 };
382
+ 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_filterVttByScope as filterVttByScope, 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 };
369
383
  }
370
384
 
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 };
385
+ export { getReliableLanguageCode as A, getStoryboardUrl as B, getThumbnailUrls as C, DEFAULT_STORYBOARD_WIDTH as D, parseVTTCues as E, replaceCueText as F, sanitizeUntrustedText as G, type HeatmapOptions as H, secondsToTimestamp as I, splitVttPreambleAndCueBlocks as J, stripVttMetadataBlocks as K, LOW_CONFIDENCE_THRESHOLD as L, MAX_CUE_TEXT_CHARS as M, vttTimestampToSeconds as N, 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, filterVttByScope as u, findCaptionTrack as v, getHeatmapForAsset as w, getHeatmapForPlaybackId as x, getHeatmapForVideo as y, getReadyTextTracks as z };
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { createAnthropic } from '@ai-sdk/anthropic';
3
3
  import { createGoogleGenerativeAI } from '@ai-sdk/google';
4
4
  import { createOpenAI } from '@ai-sdk/openai';
5
- import { M as MuxAIOptions, I as ImageSubmissionMode, h as TokenUsage, b as ChunkingStrategy, j as VideoEmbeddingsResult, H as Hotspot, t as Shot, i as ToneType, f as StorageAdapter } from './shots-mGJfYGiO.js';
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-BKd7TMFN.js';
6
6
 
7
7
  /**
8
8
  * Language Code Conversion Utilities
@@ -278,7 +278,7 @@ interface QuestionAnswer {
278
278
  skipped: boolean;
279
279
  }
280
280
  /** Configuration options for askQuestions workflow. */
281
- interface AskQuestionsOptions extends MuxAIOptions {
281
+ interface AskQuestionsOptions extends ScopedMuxAIOptions {
282
282
  /** AI provider to run (defaults to 'openai'). */
283
283
  provider?: SupportedProvider;
284
284
  /** Provider-specific chat model identifier. */
@@ -518,7 +518,7 @@ type BurnedInCaptionsPromptSections = "task" | "analysisSteps" | "positiveIndica
518
518
  */
519
519
  type BurnedInCaptionsPromptOverrides = PromptOverrides<BurnedInCaptionsPromptSections>;
520
520
  /** Configuration accepted by `hasBurnedInCaptions`. */
521
- interface BurnedInCaptionsOptions extends MuxAIOptions {
521
+ interface BurnedInCaptionsOptions extends ScopedMuxAIOptions {
522
522
  /** AI provider used for storyboard inspection (defaults to 'openai'). */
523
523
  provider?: SupportedProvider;
524
524
  /** Provider-specific model identifier. */
@@ -592,11 +592,11 @@ declare const chapterSchema: z.ZodObject<{
592
592
  startTime: z.ZodNumber;
593
593
  title: z.ZodString;
594
594
  }, "strip", z.ZodTypeAny, {
595
- title: string;
596
595
  startTime: number;
597
- }, {
598
596
  title: string;
597
+ }, {
599
598
  startTime: number;
599
+ title: string;
600
600
  }>;
601
601
  type Chapter = z.infer<typeof chapterSchema>;
602
602
  declare const chaptersSchema: z.ZodObject<{
@@ -604,21 +604,21 @@ declare const chaptersSchema: z.ZodObject<{
604
604
  startTime: z.ZodNumber;
605
605
  title: z.ZodString;
606
606
  }, "strip", z.ZodTypeAny, {
607
- title: string;
608
607
  startTime: number;
609
- }, {
610
608
  title: string;
609
+ }, {
611
610
  startTime: number;
611
+ title: string;
612
612
  }>, "many">;
613
613
  }, "strip", z.ZodTypeAny, {
614
614
  chapters: {
615
- title: string;
616
615
  startTime: number;
616
+ title: string;
617
617
  }[];
618
618
  }, {
619
619
  chapters: {
620
- title: string;
621
620
  startTime: number;
621
+ title: string;
622
622
  }[];
623
623
  }>;
624
624
  type ChaptersType = z.infer<typeof chaptersSchema>;
@@ -658,7 +658,7 @@ type ChaptersPromptSections = "task" | "outputFormat" | "chapterGuidelines" | "t
658
658
  */
659
659
  type ChaptersPromptOverrides = PromptOverrides<ChaptersPromptSections>;
660
660
  /** Configuration accepted by `generateChapters`. */
661
- interface ChaptersOptions extends MuxAIOptions {
661
+ interface ChaptersOptions extends ScopedMuxAIOptions {
662
662
  /** BCP 47 language code of the caption track to use (e.g. "en", "fr"). When omitted, prefers English if available. */
663
663
  languageCode?: string;
664
664
  /** AI provider used to interpret the transcript (defaults to 'openai'). */
@@ -850,7 +850,7 @@ declare function applyReplacements(rawVtt: string, replacements: CaptionReplacem
850
850
  declare function editCaptions<P extends SupportedProvider = SupportedProvider>(assetId: string, trackId: string, options: EditCaptionsOptions<P>): Promise<EditCaptionsResult>;
851
851
 
852
852
  /** Configuration accepted by `generateEmbeddings`. */
853
- interface EmbeddingsOptions extends MuxAIOptions {
853
+ interface EmbeddingsOptions extends ScopedMuxAIOptions {
854
854
  /** AI provider used to generate embeddings (defaults to 'openai'). */
855
855
  provider?: SupportedEmbeddingProvider;
856
856
  /** Provider-specific model identifier (defaults to text-embedding-3-small for OpenAI). */
@@ -1037,7 +1037,7 @@ interface HiveModerationOutput {
1037
1037
  }>;
1038
1038
  }
1039
1039
  /** Configuration accepted by `getModerationScores`. */
1040
- interface ModerationOptions extends MuxAIOptions {
1040
+ interface ModerationOptions extends ScopedMuxAIOptions {
1041
1041
  /** Provider used for moderation (defaults to 'openai'). */
1042
1042
  provider?: ModerationProvider;
1043
1043
  /** OpenAI moderation model identifier (defaults to 'omni-moderation-latest'). */
@@ -1176,7 +1176,7 @@ type SummarizationPromptSections = "task" | "title" | "description" | "keywords"
1176
1176
  */
1177
1177
  type SummarizationPromptOverrides = PromptOverrides<SummarizationPromptSections>;
1178
1178
  /** Configuration accepted by `getSummaryAndTags`. */
1179
- interface SummarizationOptions extends MuxAIOptions {
1179
+ interface SummarizationOptions extends ScopedMuxAIOptions {
1180
1180
  /** AI provider to run (defaults to 'openai'). */
1181
1181
  provider?: SupportedProvider;
1182
1182
  /** Provider-specific chat model identifier. */
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- export { I as ISO639_1, a as ISO639_3, L as LanguageCodePair, S as SupportedISO639_1, b as SupportedISO639_3, g as getLanguageCodePair, c as getLanguageName, i as isUndeterminedLanguageCode, d as isValidISO639_1, e as isValidISO639_3, t as toISO639_1, f as toISO639_3, h as workflows } from './index-DUVBpnj5.js';
2
- import { W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './shots-mGJfYGiO.js';
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 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-mGJfYGiO.js';
1
+ export { I as ISO639_1, a as ISO639_3, L as LanguageCodePair, S as SupportedISO639_1, b as SupportedISO639_3, g as getLanguageCodePair, c as getLanguageName, i as isUndeterminedLanguageCode, d as isValidISO639_1, e as isValidISO639_3, t as toISO639_1, f as toISO639_3, h as workflows } from './index-DJirK4fh.js';
2
+ import { W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './shots-BKd7TMFN.js';
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-BKd7TMFN.js';
4
4
  import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
5
- export { i as primitives } from './index-bjQi1ZCj.js';
5
+ export { i as primitives } from './index-CXwsu679.js';
6
6
  import 'zod';
7
7
  import '@ai-sdk/anthropic';
8
8
  import '@ai-sdk/google';
9
9
  import '@ai-sdk/openai';
10
10
  import '@mux/mux-node';
11
11
 
12
- var version = "0.28.1";
12
+ var version = "0.29.0";
13
13
 
14
14
  type MuxAiErrorType = "validation_error" | "processing_error" | "timeout_error";
15
15
  /**