@mux/ai 0.63.0 → 0.63.1
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-eEZfpEP7.d.ts → index-CntSHp7Q.d.ts} +1 -1
- package/dist/{index-CA8sRSVJ.d.ts → index-DJ6j4-nM.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +2 -2
- package/dist/primitives/index.js +1 -1
- package/dist/primitives/index.js.map +1 -1
- package/dist/{transcripts-So1KIXSI.d.ts → transcripts-CFZM111v.d.ts} +1 -1
- package/dist/workflows/index.d.ts +2 -2
- package/dist/workflows/index.js +26 -3
- package/dist/workflows/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as WorkflowCredentialsInput, R as WorkflowScope, T as TextChunk, j as ChunkingStrategy, a5 as VTTCue, a6 as CompletedShotsResult, a7 as DeletedShotsResult, a8 as ErroredShotsResult, a9 as Hotspot, aa as HotspotOptions, ab as HotspotResponse, ac as LOW_CONFIDENCE_THRESHOLD, ad as MAX_CUE_TEXT_CHARS, ae as ParseVTTCuesOptions, af as PendingShotsResult, ag as Shot, ah as ShotRequestOptions, ai as ShotsResult, aj as SkippedShotsResult, ak as TranscriptEmptyReason, al as TranscriptFetchOptions, am as TranscriptFetchStepResult, an as TranscriptResult, ao as WaitForShotsOptions, ap as buildTranscriptUrl, aq as buildVttFromCueBlocks, ar as buildVttFromTranslatedCueBlocks, as as concatenateVttSegments, at as extractTextFromVTT, au as extractTimestampedTranscript, av as fetchTranscriptDataForUrl, aw as fetchTranscriptForAsset, ax as filterVttByScope, ay as findCaptionTrack, az as getHotspotsForAsset, aA as getHotspotsForPlaybackId, aB as getHotspotsForVideo, aC as getReadyTextTracks, aD as getReliableLanguageCode, aE as getShotsForAsset, aF as parseVTTCues, aG as replaceCueText, aH as requestShotsForAsset, aI as sanitizeUntrustedText, aJ as secondsToTimestamp, aK as splitVttPreambleAndCueBlocks, aL as stripVttMetadataBlocks, aM as vttTimestampToSeconds, aN as waitForShotsForAsset } from './transcripts-
|
|
1
|
+
import { O as WorkflowCredentialsInput, R as WorkflowScope, T as TextChunk, j as ChunkingStrategy, a5 as VTTCue, a6 as CompletedShotsResult, a7 as DeletedShotsResult, a8 as ErroredShotsResult, a9 as Hotspot, aa as HotspotOptions, ab as HotspotResponse, ac as LOW_CONFIDENCE_THRESHOLD, ad as MAX_CUE_TEXT_CHARS, ae as ParseVTTCuesOptions, af as PendingShotsResult, ag as Shot, ah as ShotRequestOptions, ai as ShotsResult, aj as SkippedShotsResult, ak as TranscriptEmptyReason, al as TranscriptFetchOptions, am as TranscriptFetchStepResult, an as TranscriptResult, ao as WaitForShotsOptions, ap as buildTranscriptUrl, aq as buildVttFromCueBlocks, ar as buildVttFromTranslatedCueBlocks, as as concatenateVttSegments, at as extractTextFromVTT, au as extractTimestampedTranscript, av as fetchTranscriptDataForUrl, aw as fetchTranscriptForAsset, ax as filterVttByScope, ay as findCaptionTrack, az as getHotspotsForAsset, aA as getHotspotsForPlaybackId, aB as getHotspotsForVideo, aC as getReadyTextTracks, aD as getReliableLanguageCode, aE as getShotsForAsset, aF as parseVTTCues, aG as replaceCueText, aH as requestShotsForAsset, aI as sanitizeUntrustedText, aJ as secondsToTimestamp, aK as splitVttPreambleAndCueBlocks, aL as stripVttMetadataBlocks, aM as vttTimestampToSeconds, aN as waitForShotsForAsset } from './transcripts-CFZM111v.js';
|
|
2
2
|
|
|
3
3
|
interface HeatmapOptions {
|
|
4
4
|
/** Time window for results, e.g., '7:days' (default: '7:days') */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LanguageModel, generateText as generateText$1 } from 'ai';
|
|
2
|
-
import { aO as ClassifiedErrorsOption, O as WorkflowCredentialsInput, d as MuxAiError, e as MuxAsset, A as AssetTextTrack, a as MuxAiErrorFacts, K as TokenUsage, D as ScopedMuxAIOptions, I as ImageSubmissionMode, y as MuxAIOptions, j as ChunkingStrategy, N as VideoEmbeddingsResult, a9 as Hotspot, ag as Shot, a5 as VTTCue, L as ToneType, H as StorageAdapter } from './transcripts-
|
|
2
|
+
import { aO as ClassifiedErrorsOption, O as WorkflowCredentialsInput, d as MuxAiError, e as MuxAsset, A as AssetTextTrack, a as MuxAiErrorFacts, K as TokenUsage, D as ScopedMuxAIOptions, I as ImageSubmissionMode, y as MuxAIOptions, j as ChunkingStrategy, N as VideoEmbeddingsResult, a9 as Hotspot, ag as Shot, a5 as VTTCue, L as ToneType, H as StorageAdapter } from './transcripts-CFZM111v.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';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { M as MuxAiErrorDependency, a as MuxAiErrorFacts, b as MuxAiErrorSource, c as MuxAiErrorType, d as MuxAiError, e as MuxAsset, f as MuxAiErrorFactValue, g as MuxAiErrorCode, C as ClassifiedError, W as WorkflowCredentials, S as StoragePutObjectInput, h as StoragePresignGetObjectInput } from './transcripts-
|
|
2
|
-
export { A as AssetTextTrack, i as ChunkEmbedding, j as ChunkingStrategy, k as ClassifiedErrorInit, l as CodedClassification, E as Encrypted, m as EncryptedPayload, n as ErrorCatalogEntry, o as ErrorCauseSummary, I as ImageSubmissionMode, p as MUX_AI_ERROR_CATALOG, q as MUX_AI_ERROR_CODES, r as MUX_AI_ERROR_CODE_VALUES, s as MUX_AI_ERROR_DEPENDENCIES, t as MUX_AI_ERROR_DEPENDENCY_VALUES, u as MUX_AI_ERROR_SOURCES, v as MUX_AI_ERROR_SOURCE_VALUES, w as MUX_AI_ERROR_TYPES, x as MUX_AI_ERROR_TYPE_VALUES, y as MuxAIOptions, z as MuxAiErrorInit, P as PlaybackAsset, B as PlaybackPolicy, D as ScopedMuxAIOptions, F as SerializedClassification, G as SourceAndDependency, H as StorageAdapter, T as TextChunk, J as TokenChunkingConfig, K as TokenUsage, L as ToneType, U as UsageMetadata, V as VTTChunkingConfig, N as VideoEmbeddingsResult, O as WorkflowCredentialsInput, Q as WorkflowMuxClient, R as WorkflowScope, X as assertNever, Y as classificationInit, Z as decryptFromWorkflow, _ as encryptForWorkflow, $ as errorDetailFact, a0 as internalError, a1 as isTransientStatus, a2 as restoreClassification, a3 as serializeClassification, a4 as wrapError } from './transcripts-
|
|
3
|
-
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 TrackReplacementBlocked, l as TrackReplacementBlockedReason, m as TrackSummary, n as TrackTarget, o as buildMuxAiTrackPassthrough, p as findNameCollisionTextTracks, q as findSameLanguageTextTracks, r as getLanguageCodePair, s as getLanguageName, t as isDuplicateTrackNameError, u as isMuxGeneratedTextTrack, v as isUndeterminedLanguageCode, w as isValidISO639_1, x as isValidISO639_3, y as normalizeTrackLanguageCode, z as normalizeTrackName, A as planSourceTrackReplacement, B as planTextTrackReplacement, C as replaceAndCreateTextTrack, D as replaceAndCreateTrack, E as replaceSourceTrack, F as summarizeTextTrack, G as toISO639_1, H as toISO639_3, J as trackReplacementBlockedError, K as trackTargetFacts, N as validateTrackPassthrough, O as workflows } from './index-
|
|
1
|
+
import { M as MuxAiErrorDependency, a as MuxAiErrorFacts, b as MuxAiErrorSource, c as MuxAiErrorType, d as MuxAiError, e as MuxAsset, f as MuxAiErrorFactValue, g as MuxAiErrorCode, C as ClassifiedError, W as WorkflowCredentials, S as StoragePutObjectInput, h as StoragePresignGetObjectInput } from './transcripts-CFZM111v.js';
|
|
2
|
+
export { A as AssetTextTrack, i as ChunkEmbedding, j as ChunkingStrategy, k as ClassifiedErrorInit, l as CodedClassification, E as Encrypted, m as EncryptedPayload, n as ErrorCatalogEntry, o as ErrorCauseSummary, I as ImageSubmissionMode, p as MUX_AI_ERROR_CATALOG, q as MUX_AI_ERROR_CODES, r as MUX_AI_ERROR_CODE_VALUES, s as MUX_AI_ERROR_DEPENDENCIES, t as MUX_AI_ERROR_DEPENDENCY_VALUES, u as MUX_AI_ERROR_SOURCES, v as MUX_AI_ERROR_SOURCE_VALUES, w as MUX_AI_ERROR_TYPES, x as MUX_AI_ERROR_TYPE_VALUES, y as MuxAIOptions, z as MuxAiErrorInit, P as PlaybackAsset, B as PlaybackPolicy, D as ScopedMuxAIOptions, F as SerializedClassification, G as SourceAndDependency, H as StorageAdapter, T as TextChunk, J as TokenChunkingConfig, K as TokenUsage, L as ToneType, U as UsageMetadata, V as VTTChunkingConfig, N as VideoEmbeddingsResult, O as WorkflowCredentialsInput, Q as WorkflowMuxClient, R as WorkflowScope, X as assertNever, Y as classificationInit, Z as decryptFromWorkflow, _ as encryptForWorkflow, $ as errorDetailFact, a0 as internalError, a1 as isTransientStatus, a2 as restoreClassification, a3 as serializeClassification, a4 as wrapError } from './transcripts-CFZM111v.js';
|
|
3
|
+
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 TrackReplacementBlocked, l as TrackReplacementBlockedReason, m as TrackSummary, n as TrackTarget, o as buildMuxAiTrackPassthrough, p as findNameCollisionTextTracks, q as findSameLanguageTextTracks, r as getLanguageCodePair, s as getLanguageName, t as isDuplicateTrackNameError, u as isMuxGeneratedTextTrack, v as isUndeterminedLanguageCode, w as isValidISO639_1, x as isValidISO639_3, y as normalizeTrackLanguageCode, z as normalizeTrackName, A as planSourceTrackReplacement, B as planTextTrackReplacement, C as replaceAndCreateTextTrack, D as replaceAndCreateTrack, E as replaceSourceTrack, F as summarizeTextTrack, G as toISO639_1, H as toISO639_3, J as trackReplacementBlockedError, K as trackTargetFacts, N as validateTrackPassthrough, O as workflows } from './index-DJ6j4-nM.js';
|
|
4
4
|
import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
|
|
5
|
-
export { i as primitives } from './index-
|
|
5
|
+
export { i as primitives } from './index-CntSHp7Q.js';
|
|
6
6
|
import '@mux/ts';
|
|
7
7
|
import 'ai';
|
|
8
8
|
import 'zod';
|
|
@@ -11,7 +11,7 @@ import '@ai-sdk/anthropic';
|
|
|
11
11
|
import '@ai-sdk/google';
|
|
12
12
|
import '@ai-sdk/openai';
|
|
13
13
|
|
|
14
|
-
var version = "0.63.
|
|
14
|
+
var version = "0.63.1";
|
|
15
15
|
|
|
16
16
|
interface DependencyErrorInit {
|
|
17
17
|
dependency: MuxAiErrorDependency;
|
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.63.
|
|
8
|
+
var version = "0.63.1";
|
|
9
9
|
|
|
10
10
|
// node_modules/@workflow/serde/dist/index.js
|
|
11
11
|
var WORKFLOW_SERIALIZE = /* @__PURE__ */ Symbol.for("workflow-serialize");
|
|
@@ -612,7 +612,7 @@ var MUX_AI_ERROR_CODES = {
|
|
|
612
612
|
ASSET_ID_MISMATCH: "asset_id_mismatch",
|
|
613
613
|
/** Translation needed to split a chunk of fewer than two cues: a bug in the SDK's chunking. Facts: `chunkId`, `cueCount`. */
|
|
614
614
|
TRANSLATION_CHUNK_UNSPLITTABLE: "translation_chunk_unsplittable",
|
|
615
|
-
/** The model provider refused the content. Facts: `reason` and `category`. */
|
|
615
|
+
/** The model provider refused the content. Facts: `reason` and `category`. `reason` `PROMPT_FLAGGED` is OpenAI's intermittent up-front prompt flag: step-retried, unlike every other reason. */
|
|
616
616
|
CONTENT_POLICY_BLOCKED: "content_policy_blocked",
|
|
617
617
|
/** The model returned no output, or a required field was empty. Facts: `call`, `provider`, `model`, and `assetId` when there is one. */
|
|
618
618
|
MODEL_OUTPUT_MISSING: "model_output_missing",
|
|
@@ -4664,6 +4664,8 @@ var OpenAIUsageResponseSchema = z4.object({
|
|
|
4664
4664
|
var OpenAIPolicyErrorSchema = z4.object({
|
|
4665
4665
|
error: z4.object({ code: z4.enum(["content_policy_violation", "content_filter"]) })
|
|
4666
4666
|
});
|
|
4667
|
+
var OPENAI_PROMPT_FLAG = /invalid prompt:.*flagged as potentially violating/i;
|
|
4668
|
+
var OPENAI_PROMPT_FLAGGED = "PROMPT_FLAGGED";
|
|
4667
4669
|
var CONTENT_POLICY_REASONS = /* @__PURE__ */ new Set([
|
|
4668
4670
|
"BLOCKLIST",
|
|
4669
4671
|
"ESCALATION",
|
|
@@ -4789,12 +4791,27 @@ function includeRetriedUsage(response, retriedUsage) {
|
|
|
4789
4791
|
return Object.create(Object.getPrototypeOf(response), descriptors);
|
|
4790
4792
|
}
|
|
4791
4793
|
function rethrowContentPolicyError(error, context) {
|
|
4794
|
+
if (context?.provider === "openai" && isOpenAIPromptFlag(error)) {
|
|
4795
|
+
throwContentPolicyError({ reason: OPENAI_PROMPT_FLAGGED }, getContentPolicyTokenUsage(error), context, { intermittent: true, cause: error });
|
|
4796
|
+
}
|
|
4792
4797
|
const block = extractContentPolicyBlock(error);
|
|
4793
4798
|
if (!block) {
|
|
4794
4799
|
throw error;
|
|
4795
4800
|
}
|
|
4796
4801
|
throwContentPolicyError(block, getContentPolicyTokenUsage(error), context);
|
|
4797
4802
|
}
|
|
4803
|
+
function isOpenAIPromptFlag(error) {
|
|
4804
|
+
const apiError = findProviderCallError(error);
|
|
4805
|
+
if (apiError?.statusCode !== 400) {
|
|
4806
|
+
return false;
|
|
4807
|
+
}
|
|
4808
|
+
let bodyMessage;
|
|
4809
|
+
try {
|
|
4810
|
+
bodyMessage = JSON.parse(apiError.responseBody ?? "").error?.message;
|
|
4811
|
+
} catch {
|
|
4812
|
+
}
|
|
4813
|
+
return [apiError.message, bodyMessage].some((message) => typeof message === "string" && OPENAI_PROMPT_FLAG.test(message));
|
|
4814
|
+
}
|
|
4798
4815
|
function findProviderCallError(error) {
|
|
4799
4816
|
let current = RetryError.isInstance(error) ? error.lastError : error;
|
|
4800
4817
|
for (let depth = 0; depth < 3 && current; depth++) {
|
|
@@ -4883,7 +4900,7 @@ function getGeneratedOutputWithContentPolicyHandling(response, context) {
|
|
|
4883
4900
|
}
|
|
4884
4901
|
return output;
|
|
4885
4902
|
}
|
|
4886
|
-
function throwContentPolicyError(block, usage, context) {
|
|
4903
|
+
function throwContentPolicyError(block, usage, context, options) {
|
|
4887
4904
|
const category = block.category ? `; category: ${block.category}` : "";
|
|
4888
4905
|
if (context) {
|
|
4889
4906
|
throw withUsage(new MuxAiError(`The supplied content was blocked by a content policy (reason: ${block.reason}${category}).`, {
|
|
@@ -4891,7 +4908,13 @@ function throwContentPolicyError(block, usage, context) {
|
|
|
4891
4908
|
type: MUX_AI_ERROR_TYPES.CONTENT_POLICY_ERROR,
|
|
4892
4909
|
source: MUX_AI_ERROR_SOURCES.ASSET,
|
|
4893
4910
|
dependency: MUX_AI_ERROR_DEPENDENCIES.AI_PROVIDER,
|
|
4894
|
-
facts: { ...modelCallFacts(context), reason: block.reason, ...block.category && { category: block.category } }
|
|
4911
|
+
facts: { ...modelCallFacts(context), reason: block.reason, ...block.category && { category: block.category } },
|
|
4912
|
+
// An intermittent block (OpenAI's prompt flag) usually passes on a later, identical attempt,
|
|
4913
|
+
// so the step runner retries it, as it did before classification; once those retries are
|
|
4914
|
+
// spent it fails as a content-policy block. Every other block is final.
|
|
4915
|
+
...options?.intermittent && { transient: true, retryable: true },
|
|
4916
|
+
// Kept so the provider's status and message survive in the error's `causes`.
|
|
4917
|
+
...options?.cause !== void 0 && { cause: options.cause }
|
|
4895
4918
|
}), usage);
|
|
4896
4919
|
}
|
|
4897
4920
|
const contentPolicyError = new LegacyMuxAiError(
|