@mux/ai 0.43.0 → 0.44.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 { z } from 'zod';
2
- import { SafetyReport, PromptOverrides, SceneContextItemV1 } from './prompts/index.js';
2
+ 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';
3
3
  import { createAnthropic } from '@ai-sdk/anthropic';
4
4
  import { createGoogleGenerativeAI } from '@ai-sdk/google';
5
5
  import { createOpenAI } from '@ai-sdk/openai';
@@ -1414,9 +1414,6 @@ declare const HIVE_VIOLENCE_CATEGORIES: string[];
1414
1414
  */
1415
1415
  declare function getModerationScores(assetId: string, options?: ModerationOptions): Promise<ModerationResult>;
1416
1416
 
1417
- declare const DEFAULT_SUMMARY_KEYWORD_LIMIT = 10;
1418
- declare const DEFAULT_TITLE_LENGTH = 10;
1419
- declare const DEFAULT_DESCRIPTION_LENGTH = 50;
1420
1417
  /**
1421
1418
  * Length caps (`.max(...)`) on each free-text field are a mechanical
1422
1419
  * defence-in-depth against exfiltration: even if an injection payload
@@ -1965,4 +1962,4 @@ declare namespace index {
1965
1962
  export { index_ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH as ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH, index_ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH as ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH, index_ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL as ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL, index_ASK_QUESTIONS_MAX_QUESTION_LENGTH as ASK_QUESTIONS_MAX_QUESTION_LENGTH, type index_AskQuestionsOptions as AskQuestionsOptions, type index_AskQuestionsResult as AskQuestionsResult, type index_AskQuestionsType as AskQuestionsType, type index_AudioTranslationOptions as AudioTranslationOptions, type index_AudioTranslationResult as AudioTranslationResult, type index_AutoCensorProfanityOptions as AutoCensorProfanityOptions, type index_BurnedInCaptionsAnalysis as BurnedInCaptionsAnalysis, type index_BurnedInCaptionsOptions as BurnedInCaptionsOptions, type index_BurnedInCaptionsPromptOverrides as BurnedInCaptionsPromptOverrides, type index_BurnedInCaptionsPromptSections as BurnedInCaptionsPromptSections, type index_BurnedInCaptionsResult as BurnedInCaptionsResult, type index_CaptionReplacement as CaptionReplacement, type index_CensorMode as CensorMode, type index_Chapter as Chapter, type index_ChapterSystemPromptSections as ChapterSystemPromptSections, type index_ChaptersOptions as ChaptersOptions, type index_ChaptersPromptOverrides as ChaptersPromptOverrides, type index_ChaptersPromptSections as ChaptersPromptSections, type index_ChaptersResult as ChaptersResult, type index_ChaptersType as ChaptersType, index_DEFAULT_DESCRIPTION_LENGTH as DEFAULT_DESCRIPTION_LENGTH, index_DEFAULT_SUMMARY_KEYWORD_LIMIT as DEFAULT_SUMMARY_KEYWORD_LIMIT, index_DEFAULT_TITLE_LENGTH as DEFAULT_TITLE_LENGTH, type index_EditCaptionsOptions as EditCaptionsOptions, type index_EditCaptionsResult as EditCaptionsResult, type index_EmbeddingsOptions as EmbeddingsOptions, type index_EmbeddingsResult as EmbeddingsResult, type index_EngagementInsightsOptions as EngagementInsightsOptions, type index_EngagementInsightsResult as EngagementInsightsResult, index_GENERATE_TEXT_CALLS_TO_ACTION as GENERATE_TEXT_CALLS_TO_ACTION, index_GENERATE_TEXT_CHANNELS as GENERATE_TEXT_CHANNELS, index_GENERATE_TEXT_CHANNEL_CEILINGS as GENERATE_TEXT_CHANNEL_CEILINGS, index_GENERATE_TEXT_FORMATS as GENERATE_TEXT_FORMATS, index_GENERATE_TEXT_LENGTH_BOUNDS as GENERATE_TEXT_LENGTH_BOUNDS, index_GENERATE_TEXT_MAX_ARTIFACTS as GENERATE_TEXT_MAX_ARTIFACTS, index_GENERATE_TEXT_MAX_AUDIENCE_CHARS as GENERATE_TEXT_MAX_AUDIENCE_CHARS, index_GENERATE_TEXT_MAX_BRAND_TERMS as GENERATE_TEXT_MAX_BRAND_TERMS, index_GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS as GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS, index_GENERATE_TEXT_MAX_BRAND_TERM_CHARS as GENERATE_TEXT_MAX_BRAND_TERM_CHARS, index_GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS as GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS, index_GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS as GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS, index_GENERATE_TEXT_MAX_SHOT_FRAMES as GENERATE_TEXT_MAX_SHOT_FRAMES, index_GENERATE_TEXT_MAX_VARIANTS as GENERATE_TEXT_MAX_VARIANTS, index_GENERATE_TEXT_VOICES as GENERATE_TEXT_VOICES, index_GOOGLE_VISION_LIKELIHOOD_TO_SCORE as GOOGLE_VISION_LIKELIHOOD_TO_SCORE, type index_GenerateTextArtifact as GenerateTextArtifact, type index_GenerateTextCallToAction as GenerateTextCallToAction, type index_GenerateTextChannel as GenerateTextChannel, type index_GenerateTextFormat as GenerateTextFormat, type index_GenerateTextKeyedItem as GenerateTextKeyedItem, type index_GenerateTextLengthLimit as GenerateTextLengthLimit, type index_GenerateTextOptions as GenerateTextOptions, type index_GenerateTextResult as GenerateTextResult, type index_GenerateTextVariant as GenerateTextVariant, type index_GenerateTextVoice as GenerateTextVoice, type index_GeneratedTextArtifact as GeneratedTextArtifact, type index_GeneratedTextVariant as GeneratedTextVariant, index_HIVE_SEXUAL_CATEGORIES as HIVE_SEXUAL_CATEGORIES, index_HIVE_VIOLENCE_CATEGORIES as HIVE_VIOLENCE_CATEGORIES, type index_HiveModerationOutput as HiveModerationOutput, type index_HiveModerationSource as HiveModerationSource, type index_ModerationOptions as ModerationOptions, type index_ModerationProvider as ModerationProvider, type index_ModerationResult as ModerationResult, type index_MomentInsight as MomentInsight, type index_OverallInsight as OverallInsight, type index_ProfanityDetectionPayload as ProfanityDetectionPayload, type index_Question as Question, type index_QuestionAnswer as QuestionAnswer, type index_QuestionAnswerType as QuestionAnswerType, type index_ReplacementRecord as ReplacementRecord, type index_SpeakerReplacement as SpeakerReplacement, type index_StaticRenditionCleanupOutcome as StaticRenditionCleanupOutcome, type index_SummarizationOptions as SummarizationOptions, type index_SummarizationPromptOverrides as SummarizationPromptOverrides, type index_SummarizationPromptSections as SummarizationPromptSections, type index_SummaryAndTagsResult as SummaryAndTagsResult, type index_SummaryType as SummaryType, type index_ThumbnailModerationScore as ThumbnailModerationScore, type index_TranslationChunkingOptions as TranslationChunkingOptions, type index_TranslationOptions as TranslationOptions, type index_TranslationPayload as TranslationPayload, type index_TranslationResult as TranslationResult, index_aggregateTokenUsage as aggregateTokenUsage, index_applyOverrideLists as applyOverrideLists, index_applyReplacements as applyReplacements, index_applySpeakerReplacements as applySpeakerReplacements, index_askQuestions as askQuestions, index_buildReplacementRegex as buildReplacementRegex, index_burnedInCaptionsSchema as burnedInCaptionsSchema, index_censorVttContent as censorVttContent, index_chapterSchema as chapterSchema, index_chaptersSchema as chaptersSchema, index_createReplacer as createReplacer, index_editCaptions as editCaptions, index_extractTranscriptSegmentsForHotspots as extractTranscriptSegmentsForHotspots, index_findGenerateTextLengthViolation as findGenerateTextLengthViolation, index_generateChapters as generateChapters, index_generateEmbeddings as generateEmbeddings, index_generateEngagementInsights as generateEngagementInsights, index_generateText as generateText, index_generateVideoEmbeddings as generateVideoEmbeddings, index_getModerationScores as getModerationScores, index_getSummaryAndTags as getSummaryAndTags, index_hasBurnedInCaptions as hasBurnedInCaptions, index_mapShotsToHotspots as mapShotsToHotspots, index_measureGenerateTextLength as measureGenerateTextLength, index_normalizeTranslatedVtt as normalizeTranslatedVtt, index_profanityDetectionSchema as profanityDetectionSchema, index_questionAnswerSchema as questionAnswerSchema, index_resolveGenerateTextLengthLimit as resolveGenerateTextLengthLimit, index_resolveGenerateTextLengthLimits as resolveGenerateTextLengthLimits, index_resolveGenerateTextOptions as resolveGenerateTextOptions, index_selectGenerateTextShotFrames as selectGenerateTextShotFrames, index_shouldSplitChunkTranslationError as shouldSplitChunkTranslationError, index_summarySchema as summarySchema, index_transformCueText as transformCueText, index_translateAudio as translateAudio, index_translateCaptions as translateCaptions, index_translationSchema as translationSchema, index_validateNeverTranslateTerms as validateNeverTranslateTerms, index_verifyNeverTranslateTerms as verifyNeverTranslateTerms };
1966
1963
  }
1967
1964
 
1968
- export { type Chapter as $, toISO639_1 as A, toISO639_3 as B, validateTrackPassthrough as C, index as D, ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH as E, ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH as F, ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL as G, ASK_QUESTIONS_MAX_QUESTION_LENGTH as H, type ISO639_1 as I, type AskQuestionsOptions as J, type AskQuestionsResult as K, type LanguageCodePair as L, MUX_TRACK_PASSTHROUGH_MAX_CHARS as M, type AskQuestionsType as N, type AudioTranslationOptions as O, type AudioTranslationResult as P, type AutoCensorProfanityOptions as Q, type ReplaceAndCreateTextTrackInput as R, type SupportedISO639_1 as S, type TextTrackReplacementPlan as T, type BurnedInCaptionsAnalysis as U, type BurnedInCaptionsOptions as V, type BurnedInCaptionsPromptOverrides as W, type BurnedInCaptionsPromptSections as X, type BurnedInCaptionsResult as Y, type CaptionReplacement as Z, type CensorMode as _, type ISO639_3 as a, type SummaryType as a$, type ChapterSystemPromptSections as a0, type ChaptersOptions as a1, type ChaptersPromptOverrides as a2, type ChaptersPromptSections as a3, type ChaptersResult as a4, type ChaptersType as a5, DEFAULT_DESCRIPTION_LENGTH as a6, DEFAULT_SUMMARY_KEYWORD_LIMIT as a7, DEFAULT_TITLE_LENGTH as a8, type EditCaptionsOptions as a9, type GenerateTextLengthLimit as aA, type GenerateTextOptions as aB, type GenerateTextResult as aC, type GenerateTextVariant as aD, type GenerateTextVoice as aE, type GeneratedTextArtifact as aF, type GeneratedTextVariant as aG, HIVE_SEXUAL_CATEGORIES as aH, HIVE_VIOLENCE_CATEGORIES as aI, type HiveModerationOutput as aJ, type HiveModerationSource as aK, type ModerationOptions as aL, type ModerationProvider as aM, type ModerationResult as aN, type MomentInsight as aO, type OverallInsight as aP, type ProfanityDetectionPayload as aQ, type Question as aR, type QuestionAnswer as aS, type QuestionAnswerType as aT, type ReplacementRecord as aU, type SpeakerReplacement as aV, type StaticRenditionCleanupOutcome as aW, type SummarizationOptions as aX, type SummarizationPromptOverrides as aY, type SummarizationPromptSections as aZ, type SummaryAndTagsResult as a_, type EditCaptionsResult as aa, type EmbeddingsOptions as ab, type EmbeddingsResult as ac, type EngagementInsightsOptions as ad, type EngagementInsightsResult as ae, GENERATE_TEXT_CALLS_TO_ACTION as af, GENERATE_TEXT_CHANNELS as ag, GENERATE_TEXT_CHANNEL_CEILINGS as ah, GENERATE_TEXT_FORMATS as ai, GENERATE_TEXT_LENGTH_BOUNDS as aj, GENERATE_TEXT_MAX_ARTIFACTS as ak, GENERATE_TEXT_MAX_AUDIENCE_CHARS as al, GENERATE_TEXT_MAX_BRAND_TERMS as am, GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS as an, GENERATE_TEXT_MAX_BRAND_TERM_CHARS as ao, GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS as ap, GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS as aq, GENERATE_TEXT_MAX_SHOT_FRAMES as ar, GENERATE_TEXT_MAX_VARIANTS as as, GENERATE_TEXT_VOICES as at, GOOGLE_VISION_LIKELIHOOD_TO_SCORE as au, type GenerateTextArtifact as av, type GenerateTextCallToAction as aw, type GenerateTextChannel as ax, type GenerateTextFormat as ay, type GenerateTextKeyedItem as az, type ReplaceAndCreateTextTrackResult as b, type ThumbnailModerationScore as b0, type TranslationChunkingOptions as b1, type TranslationOptions as b2, type TranslationPayload as b3, type TranslationResult as b4, aggregateTokenUsage as b5, applyOverrideLists as b6, applyReplacements as b7, applySpeakerReplacements as b8, askQuestions as b9, shouldSplitChunkTranslationError as bA, summarySchema as bB, transformCueText as bC, translateAudio as bD, translateCaptions as bE, translationSchema as bF, validateNeverTranslateTerms as bG, verifyNeverTranslateTerms as bH, buildReplacementRegex as ba, burnedInCaptionsSchema as bb, censorVttContent as bc, chapterSchema as bd, chaptersSchema as be, createReplacer as bf, editCaptions as bg, extractTranscriptSegmentsForHotspots as bh, findGenerateTextLengthViolation as bi, generateChapters as bj, generateEmbeddings as bk, generateEngagementInsights as bl, generateText as bm, generateVideoEmbeddings as bn, getModerationScores as bo, getSummaryAndTags as bp, hasBurnedInCaptions as bq, mapShotsToHotspots as br, measureGenerateTextLength as bs, normalizeTranslatedVtt as bt, profanityDetectionSchema as bu, questionAnswerSchema as bv, resolveGenerateTextLengthLimit as bw, resolveGenerateTextLengthLimits as bx, resolveGenerateTextOptions as by, selectGenerateTextShotFrames as bz, type ReplaceAndCreateTrackInput as c, type ReplaceExistingTracksPolicy as d, type ReplaceableTrackType as e, type SupportedISO639_3 as f, type TextTrackSummary as g, type TextTrackTarget as h, type TrackSummary as i, type TrackTarget as j, buildMuxAiTrackPassthrough as k, findNameCollisionTextTracks as l, findSameLanguageTextTracks as m, getLanguageCodePair as n, getLanguageName as o, isDuplicateTrackNameError as p, isMuxGeneratedTextTrack as q, isUndeterminedLanguageCode as r, isValidISO639_1 as s, isValidISO639_3 as t, normalizeTrackLanguageCode as u, normalizeTrackName as v, planTextTrackReplacement as w, replaceAndCreateTextTrack as x, replaceAndCreateTrack as y, summarizeTextTrack as z };
1965
+ export { type Chapter as $, toISO639_1 as A, toISO639_3 as B, validateTrackPassthrough as C, index as D, ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH as E, ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH as F, ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL as G, ASK_QUESTIONS_MAX_QUESTION_LENGTH as H, type ISO639_1 as I, type AskQuestionsOptions as J, type AskQuestionsResult as K, type LanguageCodePair as L, MUX_TRACK_PASSTHROUGH_MAX_CHARS as M, type AskQuestionsType as N, type AudioTranslationOptions as O, type AudioTranslationResult as P, type AutoCensorProfanityOptions as Q, type ReplaceAndCreateTextTrackInput as R, type SupportedISO639_1 as S, type TextTrackReplacementPlan as T, type BurnedInCaptionsAnalysis as U, type BurnedInCaptionsOptions as V, type BurnedInCaptionsPromptOverrides as W, type BurnedInCaptionsPromptSections as X, type BurnedInCaptionsResult as Y, type CaptionReplacement as Z, type CensorMode as _, type ISO639_3 as a, type TranslationOptions as a$, type ChapterSystemPromptSections as a0, type ChaptersOptions as a1, type ChaptersPromptOverrides as a2, type ChaptersPromptSections as a3, type ChaptersResult as a4, type ChaptersType as a5, type EditCaptionsOptions as a6, type EditCaptionsResult as a7, type EmbeddingsOptions as a8, type EmbeddingsResult as a9, type GenerateTextVariant as aA, type GenerateTextVoice as aB, type GeneratedTextArtifact as aC, type GeneratedTextVariant as aD, HIVE_SEXUAL_CATEGORIES as aE, HIVE_VIOLENCE_CATEGORIES as aF, type HiveModerationOutput as aG, type HiveModerationSource as aH, type ModerationOptions as aI, type ModerationProvider as aJ, type ModerationResult as aK, type MomentInsight as aL, type OverallInsight as aM, type ProfanityDetectionPayload as aN, type Question as aO, type QuestionAnswer as aP, type QuestionAnswerType as aQ, type ReplacementRecord as aR, type SpeakerReplacement as aS, type StaticRenditionCleanupOutcome as aT, type SummarizationOptions as aU, type SummarizationPromptOverrides as aV, type SummarizationPromptSections as aW, type SummaryAndTagsResult as aX, type SummaryType as aY, type ThumbnailModerationScore as aZ, type TranslationChunkingOptions as a_, type EngagementInsightsOptions as aa, type EngagementInsightsResult as ab, GENERATE_TEXT_CALLS_TO_ACTION as ac, GENERATE_TEXT_CHANNELS as ad, GENERATE_TEXT_CHANNEL_CEILINGS as ae, GENERATE_TEXT_FORMATS as af, GENERATE_TEXT_LENGTH_BOUNDS as ag, GENERATE_TEXT_MAX_ARTIFACTS as ah, GENERATE_TEXT_MAX_AUDIENCE_CHARS as ai, GENERATE_TEXT_MAX_BRAND_TERMS as aj, GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS as ak, GENERATE_TEXT_MAX_BRAND_TERM_CHARS as al, GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS as am, GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS as an, GENERATE_TEXT_MAX_SHOT_FRAMES as ao, GENERATE_TEXT_MAX_VARIANTS as ap, GENERATE_TEXT_VOICES as aq, GOOGLE_VISION_LIKELIHOOD_TO_SCORE as ar, type GenerateTextArtifact as as, type GenerateTextCallToAction as at, type GenerateTextChannel as au, type GenerateTextFormat as av, type GenerateTextKeyedItem as aw, type GenerateTextLengthLimit as ax, type GenerateTextOptions as ay, type GenerateTextResult as az, type ReplaceAndCreateTextTrackResult as b, type TranslationPayload as b0, type TranslationResult as b1, aggregateTokenUsage as b2, applyOverrideLists as b3, applyReplacements as b4, applySpeakerReplacements as b5, askQuestions as b6, buildReplacementRegex as b7, burnedInCaptionsSchema as b8, censorVttContent as b9, translateAudio as bA, translateCaptions as bB, translationSchema as bC, validateNeverTranslateTerms as bD, verifyNeverTranslateTerms as bE, chapterSchema as ba, chaptersSchema as bb, createReplacer as bc, editCaptions as bd, extractTranscriptSegmentsForHotspots as be, findGenerateTextLengthViolation as bf, generateChapters as bg, generateEmbeddings as bh, generateEngagementInsights as bi, generateText as bj, generateVideoEmbeddings as bk, getModerationScores as bl, getSummaryAndTags as bm, hasBurnedInCaptions as bn, mapShotsToHotspots as bo, measureGenerateTextLength as bp, normalizeTranslatedVtt as bq, profanityDetectionSchema as br, questionAnswerSchema as bs, resolveGenerateTextLengthLimit as bt, resolveGenerateTextLengthLimits as bu, resolveGenerateTextOptions as bv, selectGenerateTextShotFrames as bw, shouldSplitChunkTranslationError as bx, summarySchema as by, transformCueText as bz, type ReplaceAndCreateTrackInput as c, type ReplaceExistingTracksPolicy as d, type ReplaceableTrackType as e, type SupportedISO639_3 as f, type TextTrackSummary as g, type TextTrackTarget as h, type TrackSummary as i, type TrackTarget as j, buildMuxAiTrackPassthrough as k, findNameCollisionTextTracks as l, findSameLanguageTextTracks as m, getLanguageCodePair as n, getLanguageName as o, isDuplicateTrackNameError as p, isMuxGeneratedTextTrack as q, isUndeterminedLanguageCode as r, isValidISO639_1 as s, isValidISO639_3 as t, normalizeTrackLanguageCode as u, normalizeTrackName as v, planTextTrackReplacement as w, replaceAndCreateTextTrack as x, replaceAndCreateTrack as y, summarizeTextTrack as z };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
- export { I as ISO639_1, a as ISO639_3, L as LanguageCodePair, M as MUX_TRACK_PASSTHROUGH_MAX_CHARS, R as ReplaceAndCreateTextTrackInput, b as ReplaceAndCreateTextTrackResult, c as ReplaceAndCreateTrackInput, d as ReplaceExistingTracksPolicy, e as ReplaceableTrackType, S as SupportedISO639_1, f as SupportedISO639_3, T as TextTrackReplacementPlan, g as TextTrackSummary, h as TextTrackTarget, i as TrackSummary, j as TrackTarget, k as buildMuxAiTrackPassthrough, l as findNameCollisionTextTracks, m as findSameLanguageTextTracks, n as getLanguageCodePair, o as getLanguageName, p as isDuplicateTrackNameError, q as isMuxGeneratedTextTrack, r as isUndeterminedLanguageCode, s as isValidISO639_1, t as isValidISO639_3, u as normalizeTrackLanguageCode, v as normalizeTrackName, w as planTextTrackReplacement, x as replaceAndCreateTextTrack, y as replaceAndCreateTrack, z as summarizeTextTrack, A as toISO639_1, B as toISO639_3, C as validateTrackPassthrough, D as workflows } from './index-BCyjRRuI.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 ReplaceableTrackType, S as SupportedISO639_1, f as SupportedISO639_3, T as TextTrackReplacementPlan, g as TextTrackSummary, h as TextTrackTarget, i as TrackSummary, j as TrackTarget, k as buildMuxAiTrackPassthrough, l as findNameCollisionTextTracks, m as findSameLanguageTextTracks, n as getLanguageCodePair, o as getLanguageName, p as isDuplicateTrackNameError, q as isMuxGeneratedTextTrack, r as isUndeterminedLanguageCode, s as isValidISO639_1, t as isValidISO639_3, u as normalizeTrackLanguageCode, v as normalizeTrackName, w as planTextTrackReplacement, x as replaceAndCreateTextTrack, y as replaceAndCreateTrack, z as summarizeTextTrack, A as toISO639_1, B as toISO639_3, C as validateTrackPassthrough, D as workflows } from './index-DigKByh7.js';
2
2
  import { W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './shots-CUI09Ohe.js';
3
3
  export { A as AssetTextTrack, C as ChunkEmbedding, b as ChunkingStrategy, E as Encrypted, c as EncryptedPayload, I as ImageSubmissionMode, M as MuxAIOptions, d as MuxAsset, P as PlaybackAsset, e as PlaybackPolicy, f as ScopedMuxAIOptions, g as StorageAdapter, T as TextChunk, h as TokenChunkingConfig, i as TokenUsage, j as ToneType, U as UsageMetadata, V as VTTChunkingConfig, k as VideoEmbeddingsResult, l as WorkflowCredentialsInput, m as WorkflowMuxClient, n as WorkflowScope, o as decryptFromWorkflow, p as encryptForWorkflow } from './shots-CUI09Ohe.js';
4
4
  import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
5
5
  export { i as primitives } from './index-C2Pk7bbF.js';
6
6
  import 'zod';
7
- import './prompts/index.js';
7
+ import './summarization-BFmhXeAu.js';
8
8
  import '@ai-sdk/anthropic';
9
9
  import '@ai-sdk/google';
10
10
  import '@ai-sdk/openai';
11
11
  import '@mux/mux-node';
12
12
 
13
- var version = "0.43.0";
13
+ var version = "0.44.0";
14
14
 
15
15
  type MuxAiErrorType = "validation_error" | "processing_error" | "timeout_error" | "content_policy_error";
16
16
  /**
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.43.0";
8
+ var version = "0.44.0";
9
9
 
10
10
  // src/lib/language-codes.ts
11
11
  var ISO639_1_TO_3 = {
@@ -4699,8 +4699,32 @@ async function hasBurnedInCaptionsInternal(assetId, options, collectedUsage) {
4699
4699
 
4700
4700
  // src/workflows/chapters.ts
4701
4701
  import { generateText as generateText3, Output as Output3 } from "ai";
4702
- import dedent4 from "dedent";
4702
+ import dedent5 from "dedent";
4703
4703
  import { z as z5 } from "zod";
4704
+
4705
+ // src/prompts/chapters.ts
4706
+ import dedent4 from "dedent";
4707
+ function createChapterGuidance({
4708
+ terminologySource = "transcript"
4709
+ } = {}) {
4710
+ return {
4711
+ qualityGuidelines: {
4712
+ tag: "quality_guidelines",
4713
+ content: dedent4`
4714
+ - Create chapters at topic shifts or clear transitions
4715
+ - Keep chapter titles concise and descriptive`
4716
+ },
4717
+ titleGuidelines: {
4718
+ tag: "title_guidelines",
4719
+ content: dedent4`
4720
+ - Keep titles concise and descriptive
4721
+ - Avoid filler or generic labels like "Chapter 1"
4722
+ ${terminologySource === "transcript" ? "- Use the transcript's terminology" : "- Use terminology from the provided evidence"}`
4723
+ }
4724
+ };
4725
+ }
4726
+
4727
+ // src/workflows/chapters.ts
4704
4728
  var chapterSchema = z5.object({
4705
4729
  startTime: z5.number(),
4706
4730
  title: z5.string().max(300)
@@ -4758,6 +4782,7 @@ async function generateChaptersWithAI({
4758
4782
  unexpectedChapterKeys
4759
4783
  };
4760
4784
  }
4785
+ var chapterGuidance = createChapterGuidance();
4761
4786
  var chapterSystemPromptBuilder = createPromptBuilder({
4762
4787
  template: {
4763
4788
  role: {
@@ -4766,13 +4791,13 @@ var chapterSystemPromptBuilder = createPromptBuilder({
4766
4791
  },
4767
4792
  context: {
4768
4793
  tag: "context",
4769
- content: dedent4`
4794
+ content: dedent5`
4770
4795
  You receive a timestamped transcript with lines in the form "[12s] Caption text".
4771
4796
  Use those timestamps as anchors to determine chapter start times in seconds.`
4772
4797
  },
4773
4798
  security: {
4774
4799
  tag: "security",
4775
- content: dedent4`
4800
+ content: dedent5`
4776
4801
  ${NON_DISCLOSURE_CONSTRAINT}
4777
4802
 
4778
4803
  ${UNTRUSTED_USER_INPUT_NOTICE}
@@ -4781,34 +4806,32 @@ var chapterSystemPromptBuilder = createPromptBuilder({
4781
4806
  },
4782
4807
  constraints: {
4783
4808
  tag: "constraints",
4784
- content: dedent4`
4809
+ content: dedent5`
4785
4810
  - Only use information present in the transcript
4786
4811
  - Return structured data that matches the requested JSON schema
4787
4812
  - Do not add commentary or extra text outside the JSON
4788
4813
  - When a <language> section is provided, all chapter titles MUST be written in that language`
4789
4814
  },
4790
4815
  qualityGuidelines: {
4791
- tag: "quality_guidelines",
4792
- content: dedent4`
4793
- - Create chapters at topic shifts or clear transitions
4794
- - Keep chapter titles concise and descriptive
4795
- - Ensure the first chapter starts at 0 seconds`
4816
+ ...chapterGuidance.qualityGuidelines,
4817
+ content: `${chapterGuidance.qualityGuidelines.content}
4818
+ - Ensure the first chapter starts at 0 seconds`
4796
4819
  }
4797
4820
  },
4798
4821
  sectionOrder: ["role", "context", "security", "constraints", "qualityGuidelines"]
4799
4822
  });
4800
4823
  var AUDIO_ONLY_SYSTEM_PROMPT_OVERRIDES = {
4801
4824
  role: "You are an audio editor and transcript analyst specializing in segmenting content into logical chapters.",
4802
- context: dedent4`
4825
+ context: dedent5`
4803
4826
  You receive a timestamped transcript from audio-only content with lines in the form "[12s] Transcript text".
4804
4827
  Use those timestamps as anchors to determine chapter start times in seconds.`
4805
4828
  };
4806
4829
  var SCENE_CONTEXT_SYSTEM_PROMPT_OVERRIDES = {
4807
- context: dedent4`
4830
+ context: dedent5`
4808
4831
  You receive a timestamped transcript with lines in the form "[12s] Caption text" and an ordered scene context.
4809
4832
  Transcript timestamps are in seconds. Scene start and end timestamps are in milliseconds.
4810
4833
  Use the scene progression to choose logical chapter groupings and scene starts as chapter boundaries.`,
4811
- constraints: dedent4`
4834
+ constraints: dedent5`
4812
4835
  - Only use information present in the transcript and scene context
4813
4836
  - Return structured data that matches the requested JSON schema
4814
4837
  - Do not add commentary or extra text outside the JSON
@@ -4822,7 +4845,7 @@ var chaptersPromptBuilder = createPromptBuilder({
4822
4845
  },
4823
4846
  outputFormat: {
4824
4847
  tag: "output_format",
4825
- content: dedent4`
4848
+ content: dedent5`
4826
4849
  Return valid JSON in this exact shape:
4827
4850
  {
4828
4851
  "chapters": [
@@ -4839,13 +4862,7 @@ var chaptersPromptBuilder = createPromptBuilder({
4839
4862
  content: ""
4840
4863
  // Placeholder - always overridden with dynamic content
4841
4864
  },
4842
- titleGuidelines: {
4843
- tag: "title_guidelines",
4844
- content: dedent4`
4845
- - Keep titles concise and descriptive
4846
- - Avoid filler or generic labels like "Chapter 1"
4847
- - Use the transcript's terminology`
4848
- }
4865
+ titleGuidelines: chapterGuidance.titleGuidelines
4849
4866
  },
4850
4867
  sectionOrder: ["task", "outputFormat", "chapterGuidelines", "titleGuidelines"]
4851
4868
  });
@@ -4884,7 +4901,7 @@ function buildUserPrompt3({
4884
4901
  } else if (scope) {
4885
4902
  firstChapterGuideline = `- The first chapter must start at ${scope.startTime}s`;
4886
4903
  }
4887
- const dynamicChapterGuidelines = dedent4`
4904
+ const dynamicChapterGuidelines = dedent5`
4888
4905
  - Create at least ${minChaptersPerHour} and at most ${maxChaptersPerHour} chapters per hour of content
4889
4906
  - Use start times in seconds (not HH:MM:SS)
4890
4907
  ${scope ? `- Analyze only the range from ${scope.startTime}s (inclusive) to ${scope.endTime}s (exclusive)` : ""}
@@ -5862,7 +5879,7 @@ async function generateVideoEmbeddings(assetId, options = {}) {
5862
5879
 
5863
5880
  // src/workflows/engagement-insights.ts
5864
5881
  import { generateText as generateText5, Output as Output5 } from "ai";
5865
- import dedent5 from "dedent";
5882
+ import dedent6 from "dedent";
5866
5883
  import { z as z7 } from "zod";
5867
5884
  var aiMomentInsightSchema = z7.object({
5868
5885
  hotspotIndex: z7.number(),
@@ -5985,7 +6002,7 @@ var AUDIO_ONLY_SYSTEM_PROMPT2 = promptDedent`
5985
6002
  - Connect engagement data to content features
5986
6003
  </quality_guidelines>
5987
6004
  `;
5988
- var INSIGHT_GUIDELINES = dedent5`
6005
+ var INSIGHT_GUIDELINES = dedent6`
5989
6006
  Provide explanatory insights that describe WHY moments are engaging.
5990
6007
  Focus on observable patterns and viewer behavior correlation.
5991
6008
  Example: "The cooking demonstration at 2:15 has 3x average engagement
@@ -6003,7 +6020,7 @@ var engagementInsightsPromptBuilder = createPromptBuilder({
6003
6020
  },
6004
6021
  outputFormat: {
6005
6022
  tag: "output_format",
6006
- content: dedent5`
6023
+ content: dedent6`
6007
6024
  Return valid JSON matching the provided schema.
6008
6025
  Include insights for each hotspot and overall engagement trends.
6009
6026
  Each momentInsight must include the hotspotIndex matching the input.
@@ -6011,7 +6028,7 @@ var engagementInsightsPromptBuilder = createPromptBuilder({
6011
6028
  },
6012
6029
  visualContext: {
6013
6030
  tag: "visual_context",
6014
- content: dedent5`
6031
+ content: dedent6`
6015
6032
  Images are provided for each hotspot timestamp.
6016
6033
  A storyboard overview image may also be included showing the full video timeline.
6017
6034
  Use visual evidence from these images to support your engagement analysis.
@@ -6025,14 +6042,14 @@ function buildUserPrompt4(hotspots, transcriptSegments, heatmap, isAudioOnly) {
6025
6042
  const transcript = transcriptSegments[idx]?.text || "(no transcript)";
6026
6043
  const startTimestamp = secondsToTimestamp(h.startMs / 1e3);
6027
6044
  const endTimestamp = secondsToTimestamp(h.endMs / 1e3);
6028
- return dedent5`
6045
+ return dedent6`
6029
6046
  Hotspot ${idx} (hotspotIndex: ${idx}):
6030
6047
  - Time Range: ${startTimestamp} - ${endTimestamp}
6031
6048
  - Engagement Score: ${h.score.toFixed(2)} (0=low, 1=high)
6032
6049
  - Transcript: ${JSON.stringify(transcript)}
6033
6050
  `;
6034
6051
  }).join("\n\n");
6035
- const heatmapData = dedent5`
6052
+ const heatmapData = dedent6`
6036
6053
  Engagement Heatmap (${heatmap.length} values, each representing 1/${heatmap.length}th of the video, higher = more re-watches):
6037
6054
  [${heatmap.map((v) => v.toFixed(2)).join(", ")}]
6038
6055
  `;
@@ -7810,7 +7827,6 @@ async function getModerationScores(assetId, options = {}) {
7810
7827
 
7811
7828
  // src/workflows/summarization.ts
7812
7829
  import { generateText as generateText7, Output as Output7 } from "ai";
7813
- import dedent6 from "dedent";
7814
7830
  import { z as z9 } from "zod";
7815
7831
 
7816
7832
  // src/lib/markdown-normalization.ts
@@ -7820,124 +7836,128 @@ function normalizeMarkdownDescription(description) {
7820
7836
  return description.replace(ESCAPED_LINE_BREAK_REGEX, "\n").replace(/([^\n]) {2,}([*-]) (?=\S)/g, "$1\n$2 ").replace(/([.!?:;]) ([*-]) (?=\S)/g, "$1\n$2 ").replace(MULTIPLE_BLANK_LINES_REGEX, "\n\n");
7821
7837
  }
7822
7838
 
7823
- // src/workflows/summarization.ts
7839
+ // src/prompts/summarization.ts
7840
+ import dedent7 from "dedent";
7824
7841
  var DEFAULT_SUMMARY_KEYWORD_LIMIT = 10;
7825
7842
  var DEFAULT_TITLE_LENGTH = 10;
7826
7843
  var DEFAULT_DESCRIPTION_LENGTH = 50;
7827
- var summarySchema = z9.object({
7828
- keywords: z9.array(z9.string().max(200)),
7829
- title: z9.string().max(500),
7830
- description: z9.string().max(1e4)
7831
- });
7832
- function buildSummarySchema(descriptionLength) {
7833
- const descriptionMaxChars = Math.max(2e3, descriptionLength * 15);
7834
- return z9.object({
7835
- keywords: z9.array(z9.string().max(200)),
7836
- title: z9.string().max(500),
7837
- description: z9.string().max(descriptionMaxChars)
7838
- });
7839
- }
7840
- var VALID_TONES = ["neutral", "playful", "professional"];
7841
- var TONE_INSTRUCTIONS = {
7842
- neutral: "Provide a clear, straightforward analysis.",
7843
- playful: "Channel your inner diva! Answer with maximum sass, wit, and playful attitude. Don't hold back - be cheeky, clever, and delightfully snarky. Make it pop!",
7844
- professional: "Provide a professional, executive-level analysis suitable for business reporting."
7845
- };
7846
7844
  var DESCRIPTION_LENGTH_THRESHOLD_SMALL = 25;
7847
7845
  var DESCRIPTION_LENGTH_THRESHOLD_LARGE = 100;
7848
7846
  function buildDescriptionGuidance(wordCount, contentType) {
7849
7847
  if (wordCount < DESCRIPTION_LENGTH_THRESHOLD_SMALL) {
7850
7848
  if (contentType === "video") {
7851
- return dedent6`A brief summary of the video in no more than ${wordCount} words. Shorter is fine.
7849
+ return dedent7`A brief summary of the video in no more than ${wordCount} words. Shorter is fine.
7852
7850
  Focus on the single most important subject or action.
7853
7851
  Write in present tense.`;
7854
7852
  }
7855
- return dedent6`A brief summary of the audio content in no more than ${wordCount} words. Shorter is fine.
7853
+ return dedent7`A brief summary of the audio content in no more than ${wordCount} words. Shorter is fine.
7856
7854
  Focus on the single most important topic or theme.
7857
7855
  Write in present tense.`;
7858
7856
  }
7859
7857
  if (wordCount > DESCRIPTION_LENGTH_THRESHOLD_LARGE) {
7860
7858
  if (contentType === "video") {
7861
- return dedent6`A detailed summary that describes what happens across the video.
7859
+ return dedent7`A detailed summary that describes what happens across the video.
7862
7860
  Never exceed ${wordCount} words, but shorter is perfectly fine. You may use multiple sentences.
7863
7861
  Be thorough: cover subjects, actions, setting, progression, and any notable details visible across frames.
7864
7862
  Write in present tense. Be specific about observable details rather than making assumptions.
7865
7863
  If the transcript provides dialogue or narration, incorporate key points but prioritize visual content.`;
7866
7864
  }
7867
- return dedent6`A detailed summary that describes the audio content.
7865
+ return dedent7`A detailed summary that describes the audio content.
7868
7866
  Never exceed ${wordCount} words, but shorter is perfectly fine. You may use multiple sentences.
7869
7867
  Be thorough: cover topics, speakers, themes, progression, and any notable insights.
7870
7868
  Write in present tense. Be specific about what is discussed or presented rather than making assumptions.
7871
7869
  Focus on the spoken content and any key insights, dialogue, or narrative elements.`;
7872
7870
  }
7873
7871
  if (contentType === "video") {
7874
- return dedent6`A summary that describes what happens across the video.
7872
+ return dedent7`A summary that describes what happens across the video.
7875
7873
  Never exceed ${wordCount} words, but shorter is perfectly fine. You may use multiple sentences.
7876
7874
  Cover the main subjects, actions, setting, and any notable progression visible across frames.
7877
7875
  Write in present tense. Be specific about observable details rather than making assumptions.
7878
7876
  If the transcript provides dialogue or narration, incorporate key points but prioritize visual content.`;
7879
7877
  }
7880
- return dedent6`A summary that describes the audio content.
7878
+ return dedent7`A summary that describes the audio content.
7881
7879
  Never exceed ${wordCount} words, but shorter is perfectly fine. You may use multiple sentences.
7882
7880
  Cover the main topics, speakers, themes, and any notable progression in the discussion or narration.
7883
7881
  Write in present tense. Be specific about what is discussed or presented rather than making assumptions.
7884
7882
  Focus on the spoken content and any key insights, dialogue, or narrative elements.`;
7885
7883
  }
7886
- function buildSceneAwareDescriptionGuidance(wordCount) {
7884
+ function buildSceneAwareDescriptionGuidance(wordCount, hasStoryboard) {
7885
+ const storyboardGuidance = hasStoryboard ? "Use the storyboard as direct visual evidence and the scene context to preserve progression." : "Use the ordered scene context as grounded evidence of the content and its progression.";
7887
7886
  if (wordCount < DESCRIPTION_LENGTH_THRESHOLD_SMALL) {
7888
- return dedent6`A brief summary of the video in no more than ${wordCount} words. Shorter is fine.
7887
+ return dedent7`A brief summary of the video in no more than ${wordCount} words. Shorter is fine.
7889
7888
  Focus on the single most important subject or action across the ordered scenes.
7890
- Use the storyboard as direct visual evidence and the scene context to preserve progression.
7889
+ ${storyboardGuidance}
7891
7890
  Write in present tense.`;
7892
7891
  }
7893
7892
  if (wordCount > DESCRIPTION_LENGTH_THRESHOLD_LARGE) {
7894
- return dedent6`A detailed summary that describes what happens across the ordered scenes.
7893
+ return dedent7`A detailed summary that describes what happens across the ordered scenes.
7895
7894
  Never exceed ${wordCount} words, but shorter is perfectly fine. You may use multiple sentences.
7896
7895
  Be thorough: cover subjects, actions, setting, progression, and notable details supported across scenes.
7897
- Use the storyboard as direct visual evidence and the scene context to preserve progression.
7896
+ ${storyboardGuidance}
7898
7897
  Write in present tense. If the transcript provides dialogue or narration, incorporate key points while preserving scene progression.`;
7899
7898
  }
7900
- return dedent6`A summary that describes what happens across the ordered scenes.
7899
+ return dedent7`A summary that describes what happens across the ordered scenes.
7901
7900
  Never exceed ${wordCount} words, but shorter is perfectly fine. You may use multiple sentences.
7902
7901
  Cover the main subjects, actions, setting, and notable progression supported across scenes.
7903
- Use the storyboard as direct visual evidence and the scene context to preserve progression.
7902
+ ${storyboardGuidance}
7904
7903
  Write in present tense. If the transcript provides dialogue or narration, incorporate key points while preserving scene progression.`;
7905
7904
  }
7906
- function createSummarizationBuilder({ titleLength, descriptionLength, tagCount } = {}, { hasSceneContext = false } = {}) {
7905
+ function createSummarizationGuidance({
7906
+ mediaType = "video",
7907
+ titleLength,
7908
+ descriptionLength,
7909
+ tagCount,
7910
+ hasSceneContext = false,
7911
+ hasStoryboard = true
7912
+ } = {}) {
7907
7913
  const titleLimit = titleLength ?? DEFAULT_TITLE_LENGTH;
7914
+ const descriptionLimit = descriptionLength ?? DEFAULT_DESCRIPTION_LENGTH;
7908
7915
  const keywordLimit = tagCount ?? DEFAULT_SUMMARY_KEYWORD_LIMIT;
7909
- const task = hasSceneContext ? "Analyze the storyboard frames and ordered scene context together, then generate metadata that captures the full progression of the video content." : "Analyze the storyboard frames and generate metadata that captures the essence of the video content.";
7910
- const qualityGuidelines = hasSceneContext ? dedent6`
7911
- - Follow scene_index order to understand what begins, develops, and concludes
7912
- - Use scene narratives and concepts as grounded evidence, preserving consistent terminology across the output
7913
- - Use the storyboard as direct visual evidence for whole-asset details
7914
- - Balance brevity with informativeness` : dedent6`
7915
- - Examine all frames to understand the full context and progression
7916
- - Be precise: "golden retriever" is better than "dog" when identifiable
7917
- - Capture the narrative: what begins, develops, and concludes
7918
- - Balance brevity with informativeness`;
7919
- return createPromptBuilder({
7920
- template: {
7921
- task: {
7922
- tag: "task",
7923
- content: task
7924
- },
7925
- title: {
7926
- tag: "title_requirements",
7927
- content: dedent6`
7916
+ const isAudioOnly = mediaType === "audio";
7917
+ const sceneAware = !isAudioOnly && hasSceneContext;
7918
+ const qualityGuidelines = isAudioOnly ? dedent7`
7919
+ - Analyze the full transcript to understand context and themes
7920
+ - Be precise: use specific terminology when mentioned
7921
+ - Capture the narrative: what is introduced, discussed, and concluded
7922
+ - Balance brevity with informativeness` : sceneAware ? dedent7`
7923
+ - Follow scene_index order to understand what begins, develops, and concludes
7924
+ - Use scene narratives and concepts as grounded evidence, preserving consistent terminology across the output
7925
+ ${hasStoryboard ? "- Use the storyboard as direct visual evidence for whole-asset details" : "- Ground whole-asset details in the provided scene context and transcript when available"}
7926
+ - Balance brevity with informativeness` : dedent7`
7927
+ - Examine all frames to understand the full context and progression
7928
+ - Be precise: "golden retriever" is better than "dog" when identifiable
7929
+ - Capture the narrative: what begins, develops, and concludes
7930
+ - Balance brevity with informativeness`;
7931
+ return {
7932
+ title: {
7933
+ tag: "title_requirements",
7934
+ content: isAudioOnly ? dedent7`
7935
+ A concise, label-style title — not a sentence or description.
7936
+ Never exceed ${titleLimit} words, but shorter is better.
7937
+ Think of how a podcast episode title or playlist entry would read — e.g. "Weekly News Roundup" or "Interview with Dr. Smith".
7938
+ Start with the primary subject or topic. Never begin with "An audio of" or similar phrasing.
7939
+ Use specific nouns over lengthy descriptions. Avoid clauses, conjunctions, or narrative structure.` : dedent7`
7928
7940
  A concise, label-style title — not a sentence or description.
7929
7941
  Never exceed ${titleLimit} words, but shorter is better.
7930
7942
  Think of how a video card title, playlist entry, or file name would read — e.g. "Predator: Badlands Trailer" or "Chef Prepares Holiday Feast".
7931
7943
  Start with the primary subject or topic. Never begin with "A video of" or similar phrasing.
7932
7944
  Use specific nouns over lengthy descriptions. Avoid clauses, conjunctions, or narrative structure.`
7933
- },
7934
- description: {
7935
- tag: "description_requirements",
7936
- content: hasSceneContext ? buildSceneAwareDescriptionGuidance(descriptionLength ?? DEFAULT_DESCRIPTION_LENGTH) : buildDescriptionGuidance(descriptionLength ?? DEFAULT_DESCRIPTION_LENGTH, "video")
7937
- },
7938
- keywords: {
7939
- tag: "keywords_requirements",
7940
- content: dedent6`
7945
+ },
7946
+ description: {
7947
+ tag: "description_requirements",
7948
+ content: sceneAware ? buildSceneAwareDescriptionGuidance(descriptionLimit, hasStoryboard) : buildDescriptionGuidance(descriptionLimit, mediaType)
7949
+ },
7950
+ keywords: {
7951
+ tag: "keywords_requirements",
7952
+ content: isAudioOnly ? dedent7`
7953
+ Specific, searchable terms (up to ${keywordLimit}) that capture:
7954
+ - Primary topics and themes
7955
+ - Speakers or presenters (if named)
7956
+ - Key concepts and terminology
7957
+ - Content type (interview, lecture, music, etc.)
7958
+ - Genre or style (if applicable)
7959
+ Prefer concrete nouns and relevant terms over abstract concepts.
7960
+ Use lowercase. Avoid redundant or overly generic terms like "audio" or "content".` : dedent7`
7941
7961
  Specific, searchable terms (up to ${keywordLimit}) that capture:
7942
7962
  - Primary subjects (people, animals, objects)
7943
7963
  - Actions and activities being performed
@@ -7946,57 +7966,51 @@ function createSummarizationBuilder({ titleLength, descriptionLength, tagCount }
7946
7966
  - Style or genre (if applicable)
7947
7967
  Prefer concrete nouns and action verbs over abstract concepts.
7948
7968
  Use lowercase. Avoid redundant or overly generic terms like "video" or "content".`
7969
+ },
7970
+ qualityGuidelines: { tag: "quality_guidelines", content: qualityGuidelines }
7971
+ };
7972
+ }
7973
+
7974
+ // src/workflows/summarization.ts
7975
+ var summarySchema = z9.object({
7976
+ keywords: z9.array(z9.string().max(200)),
7977
+ title: z9.string().max(500),
7978
+ description: z9.string().max(1e4)
7979
+ });
7980
+ function buildSummarySchema(descriptionLength) {
7981
+ const descriptionMaxChars = Math.max(2e3, descriptionLength * 15);
7982
+ return z9.object({
7983
+ keywords: z9.array(z9.string().max(200)),
7984
+ title: z9.string().max(500),
7985
+ description: z9.string().max(descriptionMaxChars)
7986
+ });
7987
+ }
7988
+ var VALID_TONES = ["neutral", "playful", "professional"];
7989
+ var TONE_INSTRUCTIONS = {
7990
+ neutral: "Provide a clear, straightforward analysis.",
7991
+ playful: "Channel your inner diva! Answer with maximum sass, wit, and playful attitude. Don't hold back - be cheeky, clever, and delightfully snarky. Make it pop!",
7992
+ professional: "Provide a professional, executive-level analysis suitable for business reporting."
7993
+ };
7994
+ function createSummarizationBuilder(constraints = {}, { hasSceneContext = false } = {}) {
7995
+ return createPromptBuilder({
7996
+ template: {
7997
+ task: {
7998
+ tag: "task",
7999
+ content: hasSceneContext ? "Analyze the storyboard frames and ordered scene context together, then generate metadata that captures the full progression of the video content." : "Analyze the storyboard frames and generate metadata that captures the essence of the video content."
7949
8000
  },
7950
- qualityGuidelines: {
7951
- tag: "quality_guidelines",
7952
- content: qualityGuidelines
7953
- }
8001
+ ...createSummarizationGuidance({ ...constraints, hasSceneContext })
7954
8002
  },
7955
8003
  sectionOrder: ["task", "title", "description", "keywords", "qualityGuidelines"]
7956
8004
  });
7957
8005
  }
7958
- function createAudioOnlyBuilder({ titleLength, descriptionLength, tagCount } = {}) {
7959
- const titleLimit = titleLength ?? DEFAULT_TITLE_LENGTH;
7960
- const keywordLimit = tagCount ?? DEFAULT_SUMMARY_KEYWORD_LIMIT;
8006
+ function createAudioOnlyBuilder(constraints = {}) {
7961
8007
  return createPromptBuilder({
7962
8008
  template: {
7963
8009
  task: {
7964
8010
  tag: "task",
7965
8011
  content: "Analyze the transcript and generate metadata that captures the essence of the audio content."
7966
8012
  },
7967
- title: {
7968
- tag: "title_requirements",
7969
- content: dedent6`
7970
- A concise, label-style title — not a sentence or description.
7971
- Never exceed ${titleLimit} words, but shorter is better.
7972
- Think of how a podcast episode title or playlist entry would read — e.g. "Weekly News Roundup" or "Interview with Dr. Smith".
7973
- Start with the primary subject or topic. Never begin with "An audio of" or similar phrasing.
7974
- Use specific nouns over lengthy descriptions. Avoid clauses, conjunctions, or narrative structure.`
7975
- },
7976
- description: {
7977
- tag: "description_requirements",
7978
- content: buildDescriptionGuidance(descriptionLength ?? DEFAULT_DESCRIPTION_LENGTH, "audio")
7979
- },
7980
- keywords: {
7981
- tag: "keywords_requirements",
7982
- content: dedent6`
7983
- Specific, searchable terms (up to ${keywordLimit}) that capture:
7984
- - Primary topics and themes
7985
- - Speakers or presenters (if named)
7986
- - Key concepts and terminology
7987
- - Content type (interview, lecture, music, etc.)
7988
- - Genre or style (if applicable)
7989
- Prefer concrete nouns and relevant terms over abstract concepts.
7990
- Use lowercase. Avoid redundant or overly generic terms like "audio" or "content".`
7991
- },
7992
- qualityGuidelines: {
7993
- tag: "quality_guidelines",
7994
- content: dedent6`
7995
- - Analyze the full transcript to understand context and themes
7996
- - Be precise: use specific terminology when mentioned
7997
- - Capture the narrative: what is introduced, discussed, and concluded
7998
- - Balance brevity with informativeness`
7999
- }
8013
+ ...createSummarizationGuidance({ ...constraints, mediaType: "audio" })
8000
8014
  },
8001
8015
  sectionOrder: ["task", "title", "description", "keywords", "qualityGuidelines"]
8002
8016
  });