@mux/ai 0.5.2 → 0.7.2
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/README.md +28 -23
- package/dist/{index-DgCfxP4T.d.ts → index-BMqnP1RV.d.ts} +172 -25
- package/dist/{index-2oUwgWsE.d.ts → index-DZlygsvb.d.ts} +113 -3
- package/dist/index.d.ts +30 -6
- package/dist/index.js +1480 -28530
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +2 -2
- package/dist/primitives/index.js +247 -28075
- package/dist/primitives/index.js.map +1 -1
- package/dist/{types-BhVuLeSp.d.ts → types-BQVi_wnh.d.ts} +62 -18
- package/dist/workflows/index.d.ts +2 -2
- package/dist/workflows/index.js +1751 -28990
- package/dist/workflows/index.js.map +1 -1
- package/package.json +6 -5
|
@@ -18,8 +18,8 @@ declare const WORKFLOW_ENCRYPTION_ALGORITHM: "aes-256-gcm";
|
|
|
18
18
|
* - Keys should be invalidated/deleted after rotation, not kept indefinitely
|
|
19
19
|
*
|
|
20
20
|
* Security notes:
|
|
21
|
-
* - `kid` is stored in plaintext (not encrypted)
|
|
22
|
-
* - Tampering with `kid` doesn't weaken security
|
|
21
|
+
* - `kid` is stored in plaintext (not encrypted) - don't put sensitive data in it
|
|
22
|
+
* - Tampering with `kid` doesn't weaken security - wrong key = decryption fails
|
|
23
23
|
*/
|
|
24
24
|
interface EncryptedPayload {
|
|
25
25
|
v: typeof WORKFLOW_ENCRYPTION_VERSION;
|
|
@@ -40,13 +40,6 @@ type Encrypted<T> = EncryptedPayload & {
|
|
|
40
40
|
* @param key - 32-byte secret key (base64 string or Uint8Array)
|
|
41
41
|
* @param keyId - Optional key identifier for rotation support (stored in plaintext)
|
|
42
42
|
* @returns Encrypted payload with metadata, safe to pass through untrusted channels
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* // Without key ID
|
|
46
|
-
* const encrypted = await encryptForWorkflow(credentials, secretKey);
|
|
47
|
-
*
|
|
48
|
-
* // With key ID for rotation support
|
|
49
|
-
* const encrypted = await encryptForWorkflow(credentials, secretKey, "key-2024-01");
|
|
50
43
|
*/
|
|
51
44
|
declare function encryptForWorkflow<T>(value: T, key: Uint8Array | string, keyId?: string): Promise<Encrypted<T>>;
|
|
52
45
|
/**
|
|
@@ -56,15 +49,40 @@ declare function encryptForWorkflow<T>(value: T, key: Uint8Array | string, keyId
|
|
|
56
49
|
* @param key - Same 32-byte secret key used for encryption
|
|
57
50
|
* @returns The original decrypted value
|
|
58
51
|
* @throws If payload is invalid, tampered with, or key is wrong
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* // With key rotation: read kid to look up the correct key
|
|
62
|
-
* const keyId = payload.kid ?? "default";
|
|
63
|
-
* const key = keyStore.get(keyId);
|
|
64
|
-
* const credentials = await decryptFromWorkflow(payload, key);
|
|
65
52
|
*/
|
|
66
53
|
declare function decryptFromWorkflow<T>(payload: EncryptedPayload, key: Uint8Array | string): Promise<T>;
|
|
67
54
|
|
|
55
|
+
/** Input shape for uploading objects through a storage adapter. */
|
|
56
|
+
interface StoragePutObjectInput {
|
|
57
|
+
endpoint: string;
|
|
58
|
+
region: string;
|
|
59
|
+
bucket: string;
|
|
60
|
+
key: string;
|
|
61
|
+
body: string | Uint8Array;
|
|
62
|
+
contentType?: string;
|
|
63
|
+
accessKeyId?: string;
|
|
64
|
+
secretAccessKey?: string;
|
|
65
|
+
}
|
|
66
|
+
/** Input shape for presigning object download URLs through a storage adapter. */
|
|
67
|
+
interface StoragePresignGetObjectInput {
|
|
68
|
+
endpoint: string;
|
|
69
|
+
region: string;
|
|
70
|
+
bucket: string;
|
|
71
|
+
key: string;
|
|
72
|
+
expiresInSeconds: number;
|
|
73
|
+
accessKeyId?: string;
|
|
74
|
+
secretAccessKey?: string;
|
|
75
|
+
}
|
|
76
|
+
/** Optional pluggable storage backend for S3-compatible object operations. */
|
|
77
|
+
interface StorageAdapter {
|
|
78
|
+
putObject: (input: StoragePutObjectInput) => Promise<void>;
|
|
79
|
+
createPresignedGetUrl: (input: StoragePresignGetObjectInput) => Promise<string>;
|
|
80
|
+
}
|
|
81
|
+
interface WorkflowMuxClient {
|
|
82
|
+
createClient: () => Promise<Mux>;
|
|
83
|
+
getSigningKey: () => string | undefined;
|
|
84
|
+
getPrivateKey: () => string | undefined;
|
|
85
|
+
}
|
|
68
86
|
/**
|
|
69
87
|
* Base options mixed into every higher-level workflow configuration.
|
|
70
88
|
*/
|
|
@@ -76,20 +94,33 @@ interface MuxAIOptions {
|
|
|
76
94
|
* Use encryptForWorkflow when running in Workflow Dev Kit environments.
|
|
77
95
|
*/
|
|
78
96
|
credentials?: WorkflowCredentialsInput;
|
|
97
|
+
/** Optional storage adapter for upload and presigning operations. */
|
|
98
|
+
storageAdapter?: StorageAdapter;
|
|
79
99
|
}
|
|
80
100
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
101
|
+
* Workflow credentials.
|
|
102
|
+
*
|
|
103
|
+
* Supports plain credential objects and primitive credential fields for
|
|
104
|
+
* per-request multi-tenant workflows.
|
|
83
105
|
*/
|
|
84
106
|
interface WorkflowCredentials {
|
|
107
|
+
/** Direct Mux API token ID for per-request credential injection. */
|
|
85
108
|
muxTokenId?: string;
|
|
109
|
+
/** Direct Mux API token secret for per-request credential injection. */
|
|
86
110
|
muxTokenSecret?: string;
|
|
111
|
+
/** Optional direct Mux signing key ID for signed playback URL generation. */
|
|
87
112
|
muxSigningKey?: string;
|
|
113
|
+
/** Optional direct Mux private key for signed playback URL generation. */
|
|
88
114
|
muxPrivateKey?: string;
|
|
115
|
+
/** Optional direct OpenAI API key for per-request credential injection. */
|
|
89
116
|
openaiApiKey?: string;
|
|
117
|
+
/** Optional direct Anthropic API key for per-request credential injection. */
|
|
90
118
|
anthropicApiKey?: string;
|
|
119
|
+
/** Optional direct Google API key for per-request credential injection. */
|
|
91
120
|
googleApiKey?: string;
|
|
121
|
+
/** Optional direct Hive API key for per-request credential injection. */
|
|
92
122
|
hiveApiKey?: string;
|
|
123
|
+
/** Optional direct ElevenLabs API key for per-request credential injection. */
|
|
93
124
|
elevenLabsApiKey?: string;
|
|
94
125
|
}
|
|
95
126
|
/** Credentials that are safe to serialize across workflow boundaries. */
|
|
@@ -175,6 +206,17 @@ interface VideoEmbeddingsResult {
|
|
|
175
206
|
embeddingDimensions: number;
|
|
176
207
|
generatedAt: string;
|
|
177
208
|
};
|
|
209
|
+
/** Workflow usage metadata (asset duration, thumbnails, etc.). */
|
|
210
|
+
usage?: TokenUsage;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Metadata attached to usage objects for workflow context.
|
|
214
|
+
*/
|
|
215
|
+
interface UsageMetadata {
|
|
216
|
+
/** Total asset duration in seconds. */
|
|
217
|
+
assetDurationSeconds?: number;
|
|
218
|
+
/** Number of thumbnails sampled for workflows that use thumbnails. */
|
|
219
|
+
thumbnailCount?: number;
|
|
178
220
|
}
|
|
179
221
|
/**
|
|
180
222
|
* Token usage breakdown returned by AI SDK providers.
|
|
@@ -191,6 +233,8 @@ interface TokenUsage {
|
|
|
191
233
|
reasoningTokens?: number;
|
|
192
234
|
/** Input tokens served from cache (reduces cost). */
|
|
193
235
|
cachedInputTokens?: number;
|
|
236
|
+
/** Workflow metadata (asset duration, thumbnails, etc.). */
|
|
237
|
+
metadata?: UsageMetadata;
|
|
194
238
|
}
|
|
195
239
|
|
|
196
|
-
export { type AssetTextTrack as A, type
|
|
240
|
+
export { type AssetTextTrack as A, type ChunkEmbedding as C, type Encrypted as E, type ImageSubmissionMode as I, type MuxAIOptions as M, type PlaybackAsset as P, type StoragePutObjectInput as S, type TextChunk as T, type UsageMetadata as U, type VTTChunkingConfig as V, type WorkflowCredentials as W, type StoragePresignGetObjectInput as a, type ChunkingStrategy as b, type EncryptedPayload as c, type MuxAsset as d, type PlaybackPolicy as e, type StorageAdapter as f, type TokenChunkingConfig as g, type TokenUsage as h, type ToneType as i, type VideoEmbeddingsResult as j, type WorkflowCredentialsInput as k, type WorkflowMuxClient as l, decryptFromWorkflow as m, encryptForWorkflow as n };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { A as AskQuestionsOptions, a as AskQuestionsResult, b as AskQuestionsType, c as AudioTranslationOptions, d as AudioTranslationResult, B as BurnedInCaptionsAnalysis, e as BurnedInCaptionsOptions, f as BurnedInCaptionsPromptOverrides, g as BurnedInCaptionsPromptSections, h as BurnedInCaptionsResult, C as Chapter, j as ChapterSystemPromptSections, k as ChaptersOptions, l as ChaptersPromptOverrides, m as ChaptersPromptSections, n as ChaptersResult, o as ChaptersType, E as EmbeddingsOptions, p as EmbeddingsResult, H as HiveModerationOutput, q as HiveModerationSource, M as ModerationOptions, r as ModerationProvider, s as ModerationResult, Q as Question, t as QuestionAnswer, u as QuestionAnswerType, S as SUMMARY_KEYWORD_LIMIT, v as SummarizationOptions, w as SummarizationPromptOverrides, x as SummarizationPromptSections, y as SummaryAndTagsResult, z as SummaryType, T as ThumbnailModerationScore, D as TranslationOptions, F as TranslationPayload, G as TranslationResult, I as askQuestions, J as burnedInCaptionsSchema, K as chapterSchema, L as chaptersSchema, N as generateChapters, O as generateEmbeddings, P as generateVideoEmbeddings, R as getModerationScores, U as getSummaryAndTags, V as hasBurnedInCaptions, W as questionAnswerSchema, X as summarySchema, Y as translateAudio, Z as translateCaptions, _ as translationSchema } from '../index-BMqnP1RV.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '@ai-sdk/anthropic';
|
|
4
4
|
import '@ai-sdk/google';
|
|
5
5
|
import '@ai-sdk/openai';
|
|
6
|
-
import '../types-
|
|
6
|
+
import '../types-BQVi_wnh.js';
|
|
7
7
|
import '@mux/mux-node';
|