@vanillaskyai/video 0.10.23 → 0.11.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/CHANGELOG.md +69 -0
- package/PUBLIC-API.md +47 -438
- package/README.md +53 -97
- package/dist/builtin-metadata-OT6V7TB4.js +8 -0
- package/dist/{chapter-title-2JVDU62E.js → chapter-title-2RCXX7SN.js} +1 -2
- package/dist/{chunk-5BSJLT6H.js → chunk-2WIETEL7.js} +16 -29
- package/dist/{chunk-3O7OMMMF.js → chunk-35K6IKB2.js} +3 -3
- package/dist/{chunk-PDQFQIQW.js → chunk-3EQ6PVWL.js} +1 -1
- package/dist/chunk-4G4JBMCM.js +37 -0
- package/dist/{chunk-7AA2JWHZ.js → chunk-5DOQTIMD.js} +6 -6
- package/dist/chunk-666HGTVZ.js +41 -0
- package/dist/{chunk-7M56IUUX.js → chunk-6Z3ID54H.js} +0 -18
- package/dist/chunk-AUN4S3YW.js +50 -0
- package/dist/chunk-HIQM4J3U.js +30 -0
- package/dist/chunk-ISWQ6T5X.js +36 -0
- package/dist/{chunk-224QNWRA.js → chunk-K5J7ESRO.js} +1 -10
- package/dist/chunk-NM4CXXZY.js +25 -0
- package/dist/{chunk-44WND2VP.js → chunk-RFXHLLYU.js} +34 -62
- package/dist/{chunk-RXTN2CW6.js → chunk-Z3DLSLAJ.js} +1 -1
- package/dist/cinema-media-YZ2UANJG.js +365 -0
- package/dist/cli.js +154 -1748
- package/dist/{compose-video-BH5K6XWT.js → compose-video-RSLI4CVP.js} +4 -4
- package/dist/{events-B4YCc4vc.d.ts → events-BZAfl0Dm.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -6
- package/dist/preload-media-23JXUFCF.js +77 -0
- package/dist/react.d.ts +39 -15
- package/dist/react.js +1355 -740
- package/dist/scene-validation-SGLLLFY5.js +9 -0
- package/dist/server.d.ts +67 -117
- package/dist/server.js +296 -626
- package/dist/test.d.ts +2 -2
- package/dist/test.js +21 -21
- package/dist/{text-stream-LD364KBI.js → text-stream-SOVLYR2L.js} +2 -2
- package/dist/{types-BqB8zC9u.d.ts → types-CG-kPI81.d.ts} +3 -1
- package/dist/{types-DdZw4GRQ.d.ts → types-ht-Zw3Wv.d.ts} +1 -1
- package/docs/agent-integration.md +19 -64
- package/docs/architecture.md +80 -106
- package/docs/customization.md +49 -66
- package/docs/development.md +18 -17
- package/docs/errors.md +4 -4
- package/docs/getting-started.md +74 -93
- package/docs/media-and-audio.md +9 -7
- package/docs/performance.md +11 -6
- package/docs/persistence.md +3 -7
- package/docs/production.md +4 -15
- package/docs/prompt-and-input.md +1 -2
- package/docs/provider-integration.md +156 -181
- package/docs/reference/protocol.md +5 -14
- package/docs/reference/provider-adapters.md +21 -13
- package/docs/security.md +1 -14
- package/docs/testing.md +56 -123
- package/package.json +4 -25
- package/starters/video-chat/.env.example +12 -4
- package/starters/video-chat/.env.native.example +13 -0
- package/starters/video-chat/README.md +72 -11
- package/starters/video-chat/package.json +1 -1
- package/starters/video-chat/providers/text-native.ts +94 -0
- package/starters/video-chat/providers/text.ts +19 -0
- package/starters/video-chat/providers/transcription.ts +32 -0
- package/starters/video-chat/providers/video-custom.ts +45 -0
- package/starters/video-chat/providers/video-delivery.ts +57 -0
- package/starters/video-chat/providers/video-google.ts +48 -0
- package/starters/video-chat/providers/video-job.ts +103 -0
- package/starters/video-chat/providers/video-runway.ts +45 -0
- package/starters/video-chat/providers/video.ts +39 -63
- package/starters/video-chat/server.ts +3 -29
- package/starters/video-chat/vite.config.ts +2 -8
- package/styles/video-chat.css +8 -105
- package/dist/builtin-server-W4PLJUZ5.js +0 -8
- package/dist/catalog-types-WTbLP6Jh.d.ts +0 -78
- package/dist/check-runtime.d.ts +0 -15
- package/dist/check-runtime.js +0 -96
- package/dist/chunk-2E6T633S.js +0 -27
- package/dist/chunk-4YM2M62S.js +0 -13
- package/dist/chunk-4ZJLPHBV.js +0 -684
- package/dist/chunk-5JBMYQP6.js +0 -156
- package/dist/chunk-73NTSFFI.js +0 -81
- package/dist/chunk-EGVQODKU.js +0 -83
- package/dist/chunk-HFVNAPHZ.js +0 -35
- package/dist/chunk-IIN5M5HW.js +0 -697
- package/dist/chunk-IQMYK5DX.js +0 -133
- package/dist/chunk-IR44XKBI.js +0 -46
- package/dist/chunk-JKVOBTRO.js +0 -145
- package/dist/chunk-LVM5Q2DL.js +0 -68
- package/dist/chunk-M4QTEJTK.js +0 -709
- package/dist/chunk-QSBDB4J2.js +0 -16
- package/dist/chunk-R3XAOMKP.js +0 -29
- package/dist/chunk-SPVTJH3F.js +0 -24
- package/dist/chunk-YAHT3LST.js +0 -663
- package/dist/chunk-ZD2VTUYR.js +0 -28
- package/dist/cinema-media-HYCDG65Z.js +0 -11
- package/dist/comparison-XXAP4S4J.js +0 -36
- package/dist/editorial-timeline-VUQC6KPA.js +0 -42
- package/dist/key-figure-4TJK7HLT.js +0 -29
- package/dist/kit-DrRpdn0p.d.ts +0 -79
- package/dist/mobile-message-FIHAO6XC.js +0 -49
- package/dist/preload-media-LJXWKTWG.js +0 -57
- package/dist/quote-GRPIYKQJ.js +0 -32
- package/dist/system-prompt-AG26KJAA.js +0 -12
- package/dist/template-catalog.d.ts +0 -400
- package/dist/template-catalog.js +0 -6
- package/dist/templates.d.ts +0 -25
- package/dist/templates.js +0 -102
- package/dist/validate-4OUD2CLX.js +0 -10
- package/docs/concepts.md +0 -107
- package/docs/custom-templates.md +0 -346
- package/docs/immersive-interface.md +0 -86
- package/docs/motion-and-effects.md +0 -109
- package/docs/reference/design-system.html +0 -125
- package/docs/responsive-orientation.md +0 -37
- package/docs/streaming-protocol.md +0 -15
- package/examples/custom-template/README.md +0 -19
- package/examples/custom-template/minimal-text.tsx +0 -82
- package/examples/custom-template/structured-data.tsx +0 -104
- package/registry/items/backgrounds.json +0 -70
- package/registry/items/chapterTitle.json +0 -80
- package/registry/items/cinemaMedia.json +0 -136
- package/registry/items/comparison.json +0 -168
- package/registry/items/editorialTimeline.json +0 -172
- package/registry/items/keyFigure.json +0 -162
- package/registry/items/mobileMessage.json +0 -153
- package/registry/items/motion.json +0 -45
- package/registry/items/quote.json +0 -161
- package/registry/items/template-context.json +0 -31
- package/registry/items/theme.json +0 -47
- package/registry/items/typography.json +0 -47
package/dist/server.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { k as
|
|
2
|
-
import { a as VideoFinishReason, V as VideoWarning, b as VideoEvent } from './events-
|
|
3
|
-
export { c as VideoWarningCategory } from './events-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export { d as VideoChatCapabilities, g as VideoChatConversationTurn, h as VideoChatWelcomePrompt } from './types-BqB8zC9u.js';
|
|
1
|
+
import { k as VideoPlanner, l as VideoRequest, c as VideoCapabilities, j as VideoInput, d as VideoAudio, m as VideoSceneValidator, g as VideoTemplatePacing, n as VideoSnapshotRetention, o as VideoResumeCursor, p as VideoGenerationContext, V as VideoOrientation, e as VideoScene } from './types-ht-Zw3Wv.js';
|
|
2
|
+
import { a as VideoFinishReason, V as VideoWarning, b as VideoEvent } from './events-BZAfl0Dm.js';
|
|
3
|
+
export { c as VideoWarningCategory } from './events-BZAfl0Dm.js';
|
|
4
|
+
import { V as VideoChatConversationTurn, a as VideoChatMode, b as VideoChatWelcomeOptions } from './types-CG-kPI81.js';
|
|
5
|
+
export { c as VideoChatCapabilities, d as VideoChatWelcomePrompt } from './types-CG-kPI81.js';
|
|
7
6
|
|
|
8
7
|
interface VideoProviderUsage {
|
|
9
8
|
inputTokens?: number;
|
|
@@ -31,39 +30,6 @@ interface VideoGenerationSummary {
|
|
|
31
30
|
warnings: VideoWarning[];
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
interface TextDeltaVideoPlannerOptions {
|
|
35
|
-
/** Capture provider credentials in this server-only closure. */
|
|
36
|
-
streamText: (context: VideoGenerationContext) => AsyncIterable<string> | TextDeltaVideoSource;
|
|
37
|
-
/** Retain bounded provider-native usage and metadata on the server summary. */
|
|
38
|
-
includeRawProviderData?: boolean;
|
|
39
|
-
}
|
|
40
|
-
type Awaitable<T> = T | PromiseLike<T>;
|
|
41
|
-
type ProviderFinishReason = string | {
|
|
42
|
-
unified?: string;
|
|
43
|
-
raw?: string;
|
|
44
|
-
};
|
|
45
|
-
interface TextDeltaVideoSource {
|
|
46
|
-
textStream: AsyncIterable<string>;
|
|
47
|
-
/** The provider SDK's normalized finish reason, when available. */
|
|
48
|
-
finishReason?: Awaitable<ProviderFinishReason | undefined>;
|
|
49
|
-
/** The provider's original finish reason, when available. */
|
|
50
|
-
rawFinishReason?: Awaitable<string | undefined>;
|
|
51
|
-
/** Vercel AI SDK usage. Both current and prior structural shapes are accepted. */
|
|
52
|
-
usage?: Awaitable<unknown>;
|
|
53
|
-
totalUsage?: Awaitable<unknown>;
|
|
54
|
-
providerMetadata?: Awaitable<unknown>;
|
|
55
|
-
warnings?: Awaitable<unknown>;
|
|
56
|
-
response?: Awaitable<unknown>;
|
|
57
|
-
finalStep?: Awaitable<unknown>;
|
|
58
|
-
/** Compatibility with older structural adapters. Prefer finalStep. */
|
|
59
|
-
lastStep?: Awaitable<unknown>;
|
|
60
|
-
steps?: Awaitable<unknown>;
|
|
61
|
-
/** Optional provider-neutral model hints for native adapters. */
|
|
62
|
-
requestedModelId?: Awaitable<string | undefined>;
|
|
63
|
-
resolvedModelId?: Awaitable<string | undefined>;
|
|
64
|
-
modelId?: Awaitable<string | undefined>;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
33
|
interface VideoStreamHandlerOptions {
|
|
68
34
|
generate: VideoPlanner;
|
|
69
35
|
systemPrompt?: string | ((context: {
|
|
@@ -105,86 +71,48 @@ interface VideoStreamHandlerOptions {
|
|
|
105
71
|
}) => AsyncIterable<VideoEvent>;
|
|
106
72
|
}
|
|
107
73
|
|
|
108
|
-
interface
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
74
|
+
interface TextDeltaVideoPlannerOptions {
|
|
75
|
+
/** Capture provider credentials in this server-only closure. */
|
|
76
|
+
streamText: (context: VideoGenerationContext) => AsyncIterable<string> | TextDeltaVideoSource;
|
|
77
|
+
/** Retain bounded provider-native usage and metadata on the server summary. */
|
|
78
|
+
includeRawProviderData?: boolean;
|
|
79
|
+
}
|
|
80
|
+
type Awaitable<T> = T | PromiseLike<T>;
|
|
81
|
+
type ProviderFinishReason = string | {
|
|
82
|
+
unified?: string;
|
|
83
|
+
raw?: string;
|
|
84
|
+
};
|
|
85
|
+
interface TextDeltaVideoSource {
|
|
86
|
+
textStream: AsyncIterable<string>;
|
|
87
|
+
/** The provider SDK's normalized finish reason, when available. */
|
|
88
|
+
finishReason?: Awaitable<ProviderFinishReason | undefined>;
|
|
89
|
+
/** The provider's original finish reason, when available. */
|
|
90
|
+
rawFinishReason?: Awaitable<string | undefined>;
|
|
91
|
+
/** Vercel AI SDK usage. Both current and prior structural shapes are accepted. */
|
|
92
|
+
usage?: Awaitable<unknown>;
|
|
93
|
+
totalUsage?: Awaitable<unknown>;
|
|
94
|
+
providerMetadata?: Awaitable<unknown>;
|
|
95
|
+
warnings?: Awaitable<unknown>;
|
|
96
|
+
response?: Awaitable<unknown>;
|
|
97
|
+
finalStep?: Awaitable<unknown>;
|
|
98
|
+
/** Compatibility with older structural adapters. Prefer finalStep. */
|
|
99
|
+
lastStep?: Awaitable<unknown>;
|
|
100
|
+
steps?: Awaitable<unknown>;
|
|
101
|
+
/** Optional provider-neutral model hints for native adapters. */
|
|
102
|
+
requestedModelId?: Awaitable<string | undefined>;
|
|
103
|
+
resolvedModelId?: Awaitable<string | undefined>;
|
|
104
|
+
modelId?: Awaitable<string | undefined>;
|
|
112
105
|
}
|
|
113
|
-
declare function createServerTemplateRegistry(options: {
|
|
114
|
-
templates: readonly SceneTemplateMetadata[];
|
|
115
|
-
}): ServerTemplateRegistry;
|
|
116
|
-
|
|
117
|
-
declare function createTemplateSceneValidator(options: {
|
|
118
|
-
kit: ServerTemplateRegistry;
|
|
119
|
-
/** Authorize an app-approved URL in addition to URLs supplied with the request. */
|
|
120
|
-
allowMediaUrl?: (url: string, context: VideoSceneValidationContext & {
|
|
121
|
-
scene: VideoScene;
|
|
122
|
-
variable: string;
|
|
123
|
-
}) => boolean;
|
|
124
|
-
}): VideoSceneValidator;
|
|
125
106
|
|
|
126
107
|
interface ResolvedMedia {
|
|
127
108
|
url: string;
|
|
128
109
|
type: "image" | "video";
|
|
129
110
|
posterUrl?: string;
|
|
111
|
+
/** Actual footage duration when the provider or delivery pipeline knows it. */
|
|
112
|
+
durationSec?: number;
|
|
130
113
|
}
|
|
131
|
-
interface MediaResolverContext {
|
|
132
|
-
input: VideoInput;
|
|
133
|
-
requestId: string;
|
|
134
|
-
scene: Readonly<VideoScene>;
|
|
135
|
-
templateId: string;
|
|
136
|
-
preferredType: "image" | "video" | "any";
|
|
137
|
-
/**
|
|
138
|
-
* The visual language generated media must match, when the application set
|
|
139
|
-
* one. Append it to a provider prompt; a shot that ignores it is the
|
|
140
|
-
* mismatch this exists to prevent.
|
|
141
|
-
*/
|
|
142
|
-
generatedLook?: string;
|
|
143
|
-
signal: AbortSignal;
|
|
144
|
-
}
|
|
145
|
-
type MediaResolver = (query: string, context: MediaResolverContext) => ResolvedMedia | null | Promise<ResolvedMedia | null>;
|
|
146
114
|
|
|
147
|
-
|
|
148
|
-
/** Customer-owned templates that replace matching built-ins and add new IDs. */
|
|
149
|
-
templates?: ServerTemplateRegistry;
|
|
150
|
-
/** App-owned provider adapter. Choose any model per request and keep provider clients and credentials in this closure. */
|
|
151
|
-
streamText: TextDeltaVideoPlannerOptions["streamText"];
|
|
152
|
-
/** Opt in to bounded provider-native usage and metadata in onComplete. */
|
|
153
|
-
includeRawProviderData?: boolean;
|
|
154
|
-
/** Additional video-direction rules prepended to the generated trusted-template catalog. */
|
|
155
|
-
basePrompt?: string;
|
|
156
|
-
/** Authorize an app-approved media URL in addition to URLs supplied in the request. */
|
|
157
|
-
allowMediaUrl?: Parameters<typeof createTemplateSceneValidator>[0]["allowMediaUrl"];
|
|
158
|
-
/** Resolve bounded semantic media intent through an application-owned provider. */
|
|
159
|
-
resolveMedia?: MediaResolver;
|
|
160
|
-
/**
|
|
161
|
-
* How many scenes may resolve media at once. Defaults to one.
|
|
162
|
-
*
|
|
163
|
-
* Raise it when resolution is slow enough to be felt - generated video rather
|
|
164
|
-
* than a stock search. Scenes are still emitted in the order they were
|
|
165
|
-
* planned; only the waiting overlaps.
|
|
166
|
-
*/
|
|
167
|
-
mediaConcurrency?: number;
|
|
168
|
-
/**
|
|
169
|
-
* How many scenes in one request may resolve media at all.
|
|
170
|
-
*
|
|
171
|
-
* Unbounded by default, which is right when media is searched for and wrong
|
|
172
|
-
* when it is generated: the planner decides the scene count, and every scene
|
|
173
|
-
* is then a paid clip. Past the ceiling a scene uses its grounded text fallback, and a `media_budget_reached` warning says it happened.
|
|
174
|
-
*/
|
|
175
|
-
maxResolvedMedia?: number;
|
|
176
|
-
/**
|
|
177
|
-
* Ask the planner to write each scene's spoken line, on the scene itself.
|
|
178
|
-
*
|
|
179
|
-
* A narrated video otherwise costs a round trip per scene - handing a model
|
|
180
|
-
* the scene that was just planned and asking what to say over it - and those
|
|
181
|
-
* calls have to be chained, because a line is written knowing the ones
|
|
182
|
-
* before it. The planner already knows the scene and the ones around it.
|
|
183
|
-
*/
|
|
184
|
-
narrate?: boolean;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
type VideoChatTextTask = "narration" | "suggestions";
|
|
115
|
+
type VideoChatTextTask = "narration" | "narration-rewrite" | "suggestions";
|
|
188
116
|
interface VideoChatTextContext {
|
|
189
117
|
task: VideoChatTextTask;
|
|
190
118
|
systemPrompt: string;
|
|
@@ -221,7 +149,27 @@ interface VideoChatMediaContext {
|
|
|
221
149
|
fallbackQuery?: string;
|
|
222
150
|
}
|
|
223
151
|
type VideoChatMediaResolver = (query: string, context: VideoChatMediaContext) => ResolvedMedia | null | Promise<ResolvedMedia | null>;
|
|
224
|
-
interface
|
|
152
|
+
interface VideoChatVideoContext extends VideoChatMediaContext {
|
|
153
|
+
purpose: "response";
|
|
154
|
+
requestedDurationSec: number;
|
|
155
|
+
shotDirection: string;
|
|
156
|
+
/** Absolute epoch-millisecond deadline; never automatically resubmit a paid job. */
|
|
157
|
+
deadlineAt: number;
|
|
158
|
+
}
|
|
159
|
+
type VideoChatVideoGenerator = (query: string, context: VideoChatVideoContext) => ResolvedMedia | null | Promise<ResolvedMedia | null>;
|
|
160
|
+
interface VideoChatHandlerOptions extends Pick<VideoStreamHandlerOptions, "allowedOrigins" | "authorize" | "maxBodyBytes" | "heartbeatMs" | "onError" | "onWarning" | "onComplete" | "invalidPartBehavior" | "requireCloser" | "allowCredentials"> {
|
|
161
|
+
/** Use an existing assistant's completed answer as the sole factual source for the video. */
|
|
162
|
+
resolveAnswer?: (context: {
|
|
163
|
+
prompt: string;
|
|
164
|
+
conversation: readonly VideoChatConversationTurn[];
|
|
165
|
+
signal: AbortSignal;
|
|
166
|
+
}) => string | Promise<string>;
|
|
167
|
+
/** Application-owned text stream; accepts a native async iterable or an AI SDK-shaped result. */
|
|
168
|
+
streamText: TextDeltaVideoPlannerOptions["streamText"];
|
|
169
|
+
/** Opt in to bounded provider metadata in the server-only completion callback. */
|
|
170
|
+
includeRawProviderData?: boolean;
|
|
171
|
+
/** Concurrent media jobs, bounded to 1–5. Results play in narrative order. */
|
|
172
|
+
mediaConcurrency?: number;
|
|
225
173
|
/** Generate the small non-streaming text tasks around the visual plan. */
|
|
226
174
|
generateText: VideoChatTextGenerator;
|
|
227
175
|
/** Optional generated speech. Browsers can speak locally when absent. */
|
|
@@ -231,10 +179,10 @@ interface VideoChatHandlerOptions extends Pick<VideoHandlerOptions, "templates"
|
|
|
231
179
|
/** Optional stock or application-owned media search. */
|
|
232
180
|
searchMedia?: VideoChatMediaResolver;
|
|
233
181
|
/** Optional generated-video provider. Its presence enables paid visual modes. */
|
|
234
|
-
generateVideo?:
|
|
182
|
+
generateVideo?: VideoChatVideoGenerator;
|
|
235
183
|
/** Maximum generated-video attempts per response, including failures. Defaults to 5. */
|
|
236
184
|
maxGeneratedVideos?: number;
|
|
237
|
-
/** Generated media deadline in milliseconds, 1–
|
|
185
|
+
/** Generated media deadline in milliseconds, 1–600000. Defaults to 15000. Host providers must honor cancellation. */
|
|
238
186
|
generateVideoTimeoutMs?: number;
|
|
239
187
|
/** Provider-supported clip duration in seconds, 2–20. Defaults to 5; does not change provider billing configuration. */
|
|
240
188
|
generatedClipDurationSec?: number;
|
|
@@ -242,11 +190,13 @@ interface VideoChatHandlerOptions extends Pick<VideoHandlerOptions, "templates"
|
|
|
242
190
|
onDiagnostic?: (event: {
|
|
243
191
|
requestId: string;
|
|
244
192
|
mode: VideoChatMode;
|
|
245
|
-
phase: "request-accepted" | "opening-authored" | "shot-authored" | "media-start" | "media-end" | "media-skipped";
|
|
193
|
+
phase: "request-accepted" | "opening-authored" | "shot-authored" | "media-start" | "media-end" | "media-skipped" | "narration-fit" | "narration-rewrite";
|
|
246
194
|
elapsedMs: number;
|
|
247
195
|
sceneId?: string;
|
|
248
196
|
durationMs?: number;
|
|
249
|
-
|
|
197
|
+
estimatedSpeechSec?: number;
|
|
198
|
+
clipDurationSec?: number;
|
|
199
|
+
reason?: "ready" | "empty" | "provider-error" | "timeout" | "cancelled" | "allowance" | "deadline" | "not-configured" | "fit" | "rewritten" | "oversized";
|
|
250
200
|
}) => unknown;
|
|
251
201
|
/** Trusted application guidance appended to the general-purpose response brief. */
|
|
252
202
|
instructions?: string;
|
|
@@ -266,4 +216,4 @@ type VideoChatHandler = (request: Request) => Promise<Response>;
|
|
|
266
216
|
*/
|
|
267
217
|
declare function createVideoChatHandler(options: VideoChatHandlerOptions): VideoChatHandler;
|
|
268
218
|
|
|
269
|
-
export {
|
|
219
|
+
export { VideoChatConversationTurn, type VideoChatHandlerOptions, VideoChatMode, VideoChatWelcomeOptions, VideoFinishReason, type VideoGenerationSummary, type VideoProviderUsage, VideoWarning, createVideoChatHandler };
|