@mux/ai 0.59.1-canary.90 → 0.59.1-canary.91
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-BPZEKSNp.d.ts → index-DO8jM8_5.d.ts} +38 -5
- package/dist/index.d.ts +16 -4
- package/dist/index.js +641 -206
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.js +15 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/workflows/index.d.ts +1 -1
- package/dist/workflows/index.js +731 -272
- package/dist/workflows/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -78,9 +78,20 @@ type MuxAiErrorFactValue = string | number | boolean | null | MuxAiErrorFactValu
|
|
|
78
78
|
* Details of one occurrence, JSON-safe so they survive step boundaries. Internal by
|
|
79
79
|
* default: a consumer chooses what, if anything, to show. Dependency errors always
|
|
80
80
|
* carry `call` (the outside call's snake_case name), plus `status` and `requestId`
|
|
81
|
-
* when there was a response.
|
|
81
|
+
* when there was a response. A failure blamed on an input the caller passed carries
|
|
82
|
+
* `inputs`: the input names involved (e.g. `credentials`), so a caller that set that
|
|
83
|
+
* input itself, rather than passing on its end user's, can re-attribute the failure.
|
|
82
84
|
*/
|
|
83
85
|
type MuxAiErrorFacts = Readonly<Record<string, MuxAiErrorFactValue>>;
|
|
86
|
+
/**
|
|
87
|
+
* Opts a shared helper into raising classified errors. A workflow passes it once it has
|
|
88
|
+
* moved onto the classified model; without it, the helper fails exactly as it did
|
|
89
|
+
* before, so workflows that haven't moved see no change. It goes away once every
|
|
90
|
+
* caller has moved and classified errors become the only behavior.
|
|
91
|
+
*/
|
|
92
|
+
interface ClassifiedErrorsOption {
|
|
93
|
+
classifiedErrors?: boolean;
|
|
94
|
+
}
|
|
84
95
|
/**
|
|
85
96
|
* What a code implies, in any catalog built on {@link ClassifiedError}: its type,
|
|
86
97
|
* source and dependency, and retry overrides that hold for every occurrence.
|
|
@@ -114,12 +125,16 @@ declare const MUX_AI_ERROR_CODES: {
|
|
|
114
125
|
readonly INVALID_SCOPE: "invalid_scope";
|
|
115
126
|
/** Existing tracks block writing the output track under the chosen replacement policy. Facts: `reason` (`policy_fail`, `not_generated`, `name_collision`, `primary_audio`), `conflictingTracks` and the target track. */
|
|
116
127
|
readonly TRACK_REPLACEMENT_BLOCKED: "track_replacement_blocked";
|
|
128
|
+
/** An option's value can't be used. Facts: `parameter` (the caller's option name), `reason` (`too_many`, `empty`, `too_long`, `disallowed_characters`, `not_normalized`) and the values the reason names: `count` and `max`, `index` (0-based entry), `length` and `maxLength`, `characters`. */
|
|
129
|
+
readonly INVALID_PARAMETER: "invalid_parameter";
|
|
117
130
|
/** A numeric option is outside its allowed range. Facts: `parameter` (the caller's option name), `value`, `min`, `max`, and `integer` when it must be a whole number. */
|
|
118
131
|
readonly PARAMETER_OUT_OF_RANGE: "parameter_out_of_range";
|
|
119
132
|
/** No ready caption track matches the requested track or language. Facts: `trackId` or `languageCode`, and what is available. */
|
|
120
133
|
readonly CAPTION_TRACK_NOT_FOUND: "caption_track_not_found";
|
|
121
134
|
/** The asset has no public or signed playback ID (DRM-only assets included). */
|
|
122
135
|
readonly PLAYBACK_ID_NOT_FOUND: "playback_id_not_found";
|
|
136
|
+
/** Mux has no asset with the requested ID in this environment. Facts: `assetId`. */
|
|
137
|
+
readonly ASSET_NOT_FOUND: "asset_not_found";
|
|
123
138
|
/** The transcript has no usable content. */
|
|
124
139
|
readonly TRANSCRIPT_EMPTY: "transcript_empty";
|
|
125
140
|
/** The asset has no valid duration, so work that depends on it can't run. Facts: `assetId`. */
|
|
@@ -163,10 +178,19 @@ declare const MUX_AI_ERROR_CATALOG: {
|
|
|
163
178
|
readonly type: "validation_error";
|
|
164
179
|
readonly source: "request";
|
|
165
180
|
};
|
|
181
|
+
readonly invalid_parameter: {
|
|
182
|
+
readonly type: "validation_error";
|
|
183
|
+
readonly source: "request";
|
|
184
|
+
};
|
|
166
185
|
readonly parameter_out_of_range: {
|
|
167
186
|
readonly type: "validation_error";
|
|
168
187
|
readonly source: "request";
|
|
169
188
|
};
|
|
189
|
+
readonly asset_not_found: {
|
|
190
|
+
readonly type: "validation_error";
|
|
191
|
+
readonly source: "request";
|
|
192
|
+
readonly dependency: "mux_video";
|
|
193
|
+
};
|
|
170
194
|
readonly caption_track_not_found: {
|
|
171
195
|
readonly type: "validation_error";
|
|
172
196
|
readonly source: "asset";
|
|
@@ -710,11 +734,20 @@ type ReplaceAndCreateTextTrackResult = {
|
|
|
710
734
|
deleted: TextTrackSummary[];
|
|
711
735
|
} | (TrackReplacementBlocked & {
|
|
712
736
|
deleted: TextTrackSummary[];
|
|
713
|
-
}) |
|
|
737
|
+
}) | TrackWriteFailed;
|
|
738
|
+
/** A Mux failure while writing a track. */
|
|
739
|
+
interface TrackWriteFailed {
|
|
714
740
|
kind: "create_failed";
|
|
741
|
+
/** The raw error's message. Internal detail, not end-user text. */
|
|
715
742
|
reason: string;
|
|
716
743
|
deleted: TextTrackSummary[];
|
|
717
|
-
|
|
744
|
+
/**
|
|
745
|
+
* With `classifiedErrors`, the failure classified inside the step, while the raw error
|
|
746
|
+
* was still in hand: it crosses the step boundary with its status, request id, Mux's
|
|
747
|
+
* error type and a scrubbed cause summary.
|
|
748
|
+
*/
|
|
749
|
+
error?: MuxAiError;
|
|
750
|
+
}
|
|
718
751
|
/** Mux caps track `passthrough` at 255 characters. */
|
|
719
752
|
declare const MUX_TRACK_PASSTHROUGH_MAX_CHARS = 255;
|
|
720
753
|
/**
|
|
@@ -761,8 +794,8 @@ declare function trackReplacementBlockedError(blocked: Pick<TrackReplacementBloc
|
|
|
761
794
|
}): MuxAiError;
|
|
762
795
|
/** Default audit tag written to `passthrough` on tracks created by `@mux/ai`. */
|
|
763
796
|
declare function buildMuxAiTrackPassthrough(workflow: string): string;
|
|
764
|
-
declare function validateTrackPassthrough(passthrough: string | undefined): string | undefined;
|
|
765
|
-
interface CreateTrackWriteInput {
|
|
797
|
+
declare function validateTrackPassthrough(passthrough: string | undefined, options?: ClassifiedErrorsOption): string | undefined;
|
|
798
|
+
interface CreateTrackWriteInput extends ClassifiedErrorsOption {
|
|
766
799
|
assetId: string;
|
|
767
800
|
target: TextTrackTarget;
|
|
768
801
|
presignedUrl: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MuxAiErrorDependency, a as MuxAiErrorFacts, b as MuxAiErrorSource, c as MuxAiErrorType, d as MuxAiError, e as MuxAiErrorFactValue, f as MuxAiErrorCode, C as ClassifiedError } from './index-
|
|
2
|
-
export { g as ClassifiedErrorInit, h as CodedClassification, E as ErrorCatalogEntry, i as ErrorCauseSummary, I as ISO639_1, j as ISO639_3, L as LanguageCodePair, k as MUX_AI_ERROR_CATALOG, l as MUX_AI_ERROR_CODES, m as MUX_AI_ERROR_CODE_VALUES, n as MUX_AI_ERROR_DEPENDENCIES, o as MUX_AI_ERROR_DEPENDENCY_VALUES, p as MUX_AI_ERROR_SOURCES, q as MUX_AI_ERROR_SOURCE_VALUES, r as MUX_AI_ERROR_TYPES, s as MUX_AI_ERROR_TYPE_VALUES, t as MUX_TRACK_PASSTHROUGH_MAX_CHARS, u as MuxAiErrorInit, R as ReplaceAndCreateTextTrackInput, v as ReplaceAndCreateTextTrackResult, w as ReplaceAndCreateTrackInput, x as ReplaceExistingTracksPolicy, y as ReplaceSourceTrackInput, z as ReplaceableTrackType, S as SerializedClassification, A as SourceAndDependency, B as SourceTrackReplacementPolicy, D as SupportedISO639_1, F as SupportedISO639_3, T as TextTrackReplacementPlan, G as TextTrackSummary, H as TextTrackTarget, J as TrackReplacementBlocked, K as TrackReplacementBlockedReason, N as TrackSummary, O as TrackTarget, P as assertNever, Q as buildMuxAiTrackPassthrough, U as classificationInit, V as errorDetailFact, W as findNameCollisionTextTracks, X as findSameLanguageTextTracks, Y as getLanguageCodePair, Z as getLanguageName, _ as internalError, $ as isDuplicateTrackNameError, a0 as isMuxGeneratedTextTrack, a1 as isTransientStatus, a2 as isUndeterminedLanguageCode, a3 as isValidISO639_1, a4 as isValidISO639_3, a5 as normalizeTrackLanguageCode, a6 as normalizeTrackName, a7 as planSourceTrackReplacement, a8 as planTextTrackReplacement, a9 as replaceAndCreateTextTrack, aa as replaceAndCreateTrack, ab as replaceSourceTrack, ac as restoreClassification, ad as serializeClassification, ae as summarizeTextTrack, af as toISO639_1, ag as toISO639_3, ah as trackReplacementBlockedError, ai as trackTargetFacts, aj as validateTrackPassthrough, ak as workflows, al as wrapError } from './index-
|
|
1
|
+
import { M as MuxAiErrorDependency, a as MuxAiErrorFacts, b as MuxAiErrorSource, c as MuxAiErrorType, d as MuxAiError, e as MuxAiErrorFactValue, f as MuxAiErrorCode, C as ClassifiedError } from './index-DO8jM8_5.js';
|
|
2
|
+
export { g as ClassifiedErrorInit, h as CodedClassification, E as ErrorCatalogEntry, i as ErrorCauseSummary, I as ISO639_1, j as ISO639_3, L as LanguageCodePair, k as MUX_AI_ERROR_CATALOG, l as MUX_AI_ERROR_CODES, m as MUX_AI_ERROR_CODE_VALUES, n as MUX_AI_ERROR_DEPENDENCIES, o as MUX_AI_ERROR_DEPENDENCY_VALUES, p as MUX_AI_ERROR_SOURCES, q as MUX_AI_ERROR_SOURCE_VALUES, r as MUX_AI_ERROR_TYPES, s as MUX_AI_ERROR_TYPE_VALUES, t as MUX_TRACK_PASSTHROUGH_MAX_CHARS, u as MuxAiErrorInit, R as ReplaceAndCreateTextTrackInput, v as ReplaceAndCreateTextTrackResult, w as ReplaceAndCreateTrackInput, x as ReplaceExistingTracksPolicy, y as ReplaceSourceTrackInput, z as ReplaceableTrackType, S as SerializedClassification, A as SourceAndDependency, B as SourceTrackReplacementPolicy, D as SupportedISO639_1, F as SupportedISO639_3, T as TextTrackReplacementPlan, G as TextTrackSummary, H as TextTrackTarget, J as TrackReplacementBlocked, K as TrackReplacementBlockedReason, N as TrackSummary, O as TrackTarget, P as assertNever, Q as buildMuxAiTrackPassthrough, U as classificationInit, V as errorDetailFact, W as findNameCollisionTextTracks, X as findSameLanguageTextTracks, Y as getLanguageCodePair, Z as getLanguageName, _ as internalError, $ as isDuplicateTrackNameError, a0 as isMuxGeneratedTextTrack, a1 as isTransientStatus, a2 as isUndeterminedLanguageCode, a3 as isValidISO639_1, a4 as isValidISO639_3, a5 as normalizeTrackLanguageCode, a6 as normalizeTrackName, a7 as planSourceTrackReplacement, a8 as planTextTrackReplacement, a9 as replaceAndCreateTextTrack, aa as replaceAndCreateTrack, ab as replaceSourceTrack, ac as restoreClassification, ad as serializeClassification, ae as summarizeTextTrack, af as toISO639_1, ag as toISO639_3, ah as trackReplacementBlockedError, ai as trackTargetFacts, aj as validateTrackPassthrough, ak as workflows, al as wrapError } from './index-DO8jM8_5.js';
|
|
3
3
|
import { M as MuxAsset, W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './transcripts-DuNI058z.js';
|
|
4
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, 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 './transcripts-DuNI058z.js';
|
|
5
5
|
import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
|
|
@@ -12,7 +12,7 @@ import '@ai-sdk/google';
|
|
|
12
12
|
import '@ai-sdk/openai';
|
|
13
13
|
import '@mux/ts';
|
|
14
14
|
|
|
15
|
-
var version = "0.59.1-canary.
|
|
15
|
+
var version = "0.59.1-canary.91";
|
|
16
16
|
|
|
17
17
|
interface DependencyErrorInit {
|
|
18
18
|
dependency: MuxAiErrorDependency;
|
|
@@ -27,6 +27,8 @@ interface DependencyErrorInit {
|
|
|
27
27
|
notFoundSource?: MuxAiErrorSource;
|
|
28
28
|
/** Source for a 401/403. Defaults to `internal` (our own credentials). */
|
|
29
29
|
authSource?: MuxAiErrorSource;
|
|
30
|
+
/** The caller's inputs a 401/403 is blamed on (e.g. `credentials`), recorded as the `inputs` fact. */
|
|
31
|
+
authInputs?: readonly string[];
|
|
30
32
|
/** The call timed out before a response arrived. */
|
|
31
33
|
timedOut?: boolean;
|
|
32
34
|
/**
|
|
@@ -49,7 +51,7 @@ interface DependencyErrorInit {
|
|
|
49
51
|
* by {@link dependencyError} and by consumers building their own errors on the same
|
|
50
52
|
* model, so remote failures are classified the same way everywhere.
|
|
51
53
|
*/
|
|
52
|
-
declare function classifyDependencyFailure(init: Pick<DependencyErrorInit, "call" | "status" | "requestId" | "facts" | "notFoundSource" | "authSource" | "timedOut" | "idempotent" | "transient" | "retryable">): {
|
|
54
|
+
declare function classifyDependencyFailure(init: Pick<DependencyErrorInit, "call" | "status" | "requestId" | "facts" | "notFoundSource" | "authSource" | "authInputs" | "timedOut" | "idempotent" | "transient" | "retryable">): {
|
|
53
55
|
type: MuxAiErrorType;
|
|
54
56
|
source: MuxAiErrorSource;
|
|
55
57
|
facts: MuxAiErrorFacts;
|
|
@@ -162,6 +164,8 @@ declare const MUX_AI_ERROR_GENERIC_MESSAGES: {
|
|
|
162
164
|
};
|
|
163
165
|
declare function blockedTrackMessage(facts: MuxAiErrorFacts): string;
|
|
164
166
|
declare function scopeMessage(facts: MuxAiErrorFacts): string;
|
|
167
|
+
/** An invalid option, worded by reason from its facts; the option is named as the caller passed it. */
|
|
168
|
+
declare function invalidParameterMessage(facts: MuxAiErrorFacts): string;
|
|
165
169
|
/**
|
|
166
170
|
* The codes end users may see, and how. A code absent here is internal: it renders
|
|
167
171
|
* through {@link MUX_AI_ERROR_GENERIC_MESSAGES} and its code and facts are dropped.
|
|
@@ -182,12 +186,20 @@ declare const MUX_AI_ERROR_PUBLIC_MAPPINGS: {
|
|
|
182
186
|
readonly facts: readonly ["trackId", "availableTrackIds", "languageCode", "availableLanguages"];
|
|
183
187
|
readonly message: (facts: Readonly<Record<string, MuxAiErrorFactValue>>) => string;
|
|
184
188
|
};
|
|
189
|
+
readonly asset_not_found: {
|
|
190
|
+
readonly facts: readonly ["assetId"];
|
|
191
|
+
readonly message: (facts: Readonly<Record<string, MuxAiErrorFactValue>>) => string;
|
|
192
|
+
};
|
|
185
193
|
readonly playback_id_not_found: {
|
|
186
194
|
readonly message: "The asset has no public or signed playback ID. DRM playback IDs aren't supported.";
|
|
187
195
|
};
|
|
188
196
|
readonly transcript_empty: {
|
|
189
197
|
readonly message: "The transcript has no usable content.";
|
|
190
198
|
};
|
|
199
|
+
readonly invalid_parameter: {
|
|
200
|
+
readonly facts: readonly ["parameter", "reason", "count", "max", "index", "length", "maxLength", "characters"];
|
|
201
|
+
readonly message: typeof invalidParameterMessage;
|
|
202
|
+
};
|
|
191
203
|
readonly parameter_out_of_range: {
|
|
192
204
|
readonly facts: readonly ["parameter", "value", "min", "max", "integer"];
|
|
193
205
|
readonly message: (facts: Readonly<Record<string, MuxAiErrorFactValue>>) => string;
|