@vanillaskyai/video 0.4.0 → 0.5.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/PUBLIC-API.md +12 -5
  3. package/README.md +14 -17
  4. package/dist/{builtin-server-BRTZN4Q7.js → builtin-server-YHEZ2JRF.js} +2 -2
  5. package/dist/check-runtime.js +1 -1
  6. package/dist/{chunk-BKF3A357.js → chunk-34O5BY6X.js} +1 -1
  7. package/dist/{chunk-LHFADNWJ.js → chunk-3ROGEU5A.js} +179 -342
  8. package/dist/{chunk-XAMUOSX7.js → chunk-3RV4YKB3.js} +0 -1
  9. package/dist/{chunk-GHJEAP4O.js → chunk-66MNRUCR.js} +1 -1
  10. package/dist/{chunk-EE6PK6XC.js → chunk-AOWSXU2K.js} +1 -1
  11. package/dist/{chunk-GR4I3MN2.js → chunk-EFL34TXF.js} +3 -3
  12. package/dist/{chunk-I5YWVQ5R.js → chunk-FVTMYS6U.js} +1 -1
  13. package/dist/{chunk-STIFILQG.js → chunk-FZHMQFG3.js} +46 -38
  14. package/dist/{chunk-JW47XCRL.js → chunk-G66Z5CWR.js} +30 -72
  15. package/dist/{chunk-RBQN3VSY.js → chunk-HVCPEAQF.js} +83 -1265
  16. package/dist/{chunk-N3KUA7VP.js → chunk-K6YVQODK.js} +4 -1
  17. package/dist/{chunk-WHPZED7X.js → chunk-PNS52FL4.js} +2 -5
  18. package/dist/{chunk-S5ZU5WUU.js → chunk-ZQQQAAKP.js} +2 -2
  19. package/dist/cli.js +20 -14
  20. package/dist/compose-video-QJHKTOQ7.js +13 -0
  21. package/dist/{events-D_1F6gw5.d.ts → events-BBP30j3c.d.ts} +3 -14
  22. package/dist/index.d.ts +2 -2
  23. package/dist/index.js +2 -2
  24. package/dist/{kit-DLeCr3d0.d.ts → kit-DEG3fcaL.d.ts} +1 -1
  25. package/dist/react.d.ts +7 -6
  26. package/dist/react.js +1000 -349
  27. package/dist/server.d.ts +3 -3
  28. package/dist/server.js +18 -79
  29. package/dist/{system-prompt-NMYHLAMJ.js → system-prompt-4I6Z5HK3.js} +1 -1
  30. package/dist/template-catalog.js +1 -1
  31. package/dist/templates.d.ts +3 -3
  32. package/dist/templates.js +87 -4
  33. package/dist/test.d.ts +3 -27
  34. package/dist/test.js +3 -3
  35. package/dist/{text-stream-UPGUD2TD.js → text-stream-J6EDDJP4.js} +3 -3
  36. package/dist/{types-Cg0Onj7l.d.ts → types-BV9IqExh.d.ts} +1 -16
  37. package/docs/agent-integration.md +4 -3
  38. package/docs/concepts.md +4 -4
  39. package/docs/custom-templates.md +2 -2
  40. package/docs/getting-started.md +13 -18
  41. package/docs/integrate-nextjs.md +12 -8
  42. package/docs/live-channels.md +5 -2
  43. package/docs/media-and-audio.md +7 -0
  44. package/docs/persistence.md +1 -1
  45. package/docs/prompt-and-input.md +2 -2
  46. package/docs/reference/protocol.md +9 -12
  47. package/docs/reference/provider-adapters.md +5 -5
  48. package/docs/testing.md +1 -1
  49. package/examples/nextjs-quickstart/.env.example +2 -2
  50. package/examples/nextjs-quickstart/README.md +4 -1
  51. package/examples/nextjs-quickstart/package.json +4 -4
  52. package/examples/nextjs-quickstart/src/app/api/video/route.ts +4 -2
  53. package/package.json +8 -8
  54. package/dist/chunk-CR7FE7BW.js +0 -109
  55. package/dist/compose-video-6UQ33DOO.js +0 -13
package/CHANGELOG.md CHANGED
@@ -4,6 +4,95 @@ VanillaSky follows semantic versioning. This changelog begins with the 0.1 beta.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.5.0
8
+
9
+ ### Breaking changes
10
+
11
+ - Simplifies streaming protocol `0.5` to complete immutable `scene.add` parts
12
+ followed by `plan.complete`. It removes `scene.patch`, `asset.patch`,
13
+ `plan.error`, and scene revision counters. Provider failures now use thrown
14
+ errors, while media resolution finishes before its scene is emitted.
15
+ - Raises the supported Node.js floor from 20 to 22. Node 20 reached end of life
16
+ and is no longer exercised by the SDK's tests, builds, or clean-room package
17
+ verification.
18
+ - Stops returning the merged built-in template catalog through
19
+ `useVideo().playerProps.templates`. `playerProps` now carries only the
20
+ customer registry passed to `useVideo`, while `VideoPlayer` supplies its
21
+ built-in renderers internally. Existing `<VideoPlayer {...playerProps} />`
22
+ usage is unchanged. This removes planner-only metadata from the initial
23
+ React graph, reducing it from 48,197 to 35,649 gzip bytes.
24
+
25
+ ### Adoption
26
+
27
+ Custom planners that previously emitted a scene and patched it later:
28
+
29
+ ```ts
30
+ yield { type: "scene.add", scene: draftScene };
31
+ yield { type: "asset.patch", sceneId: draftScene.id, variables: resolvedMedia };
32
+ ```
33
+
34
+ should emit one complete scene instead:
35
+
36
+ ```ts
37
+ yield {
38
+ type: "scene.add",
39
+ scene: { ...draftScene, variables: { ...draftScene.variables, ...resolvedMedia } },
40
+ };
41
+ ```
42
+
43
+ Throw planner failures instead of emitting `plan.error`. Protocol `0.4` replay
44
+ logs cannot be mixed into a `0.5` run; completed stored `Video` values remain on
45
+ the unchanged `0.1` storage schema.
46
+
47
+ Update applications that pin Node 20 before installing the next SDK release:
48
+
49
+ ```json
50
+ {
51
+ "engines": { "node": "20.x" }
52
+ }
53
+ ```
54
+
55
+ becomes:
56
+
57
+ ```json
58
+ {
59
+ "engines": { "node": "22.x" }
60
+ }
61
+ ```
62
+
63
+ Code that used the player binding to inspect built-in metadata:
64
+
65
+ ```ts
66
+ const templates = video.playerProps.templates.listTemplateMetadata();
67
+ ```
68
+
69
+ should import the explicit React-free catalog instead:
70
+
71
+ ```ts
72
+ import { builtinTemplates } from "@vanillaskyai/video/templates/catalog";
73
+ ```
74
+
75
+ Inspect a customer registry directly when the application created it; it is
76
+ still passed through `playerProps` unchanged.
77
+
78
+ ### Maintenance
79
+
80
+ - Makes React 19 the primary development and example runtime. CI continues to
81
+ verify React 18 with its own runtime and type packages, including typecheck,
82
+ focused component tests, and a production build.
83
+ - Shares the replay buffer and identical JSON-validation primitives across
84
+ their call sites, removing duplicate implementations without changing the
85
+ public API.
86
+ - Keeps the first install provider-neutral, removes stale version and model
87
+ defaults from public guides, and moves the quality-oriented Anthropic/Sonnet
88
+ choice into the later provider setup step.
89
+
90
+ ## 0.4.1
91
+
92
+ - Keeps soundtrack audio continuous when a saved `VideoPlayer` uses `loop`.
93
+ A track shorter than the visual timeline now repeats as soon as it ends,
94
+ instead of leaving silence until the video itself wraps.
95
+
7
96
  ## 0.4.0
8
97
 
9
98
  - Adds `loop` to `VideoPlayer` for saved videos. A completed video previously
package/PUBLIC-API.md CHANGED
@@ -1,6 +1,6 @@
1
- # VanillaSky Video 0.2 public API
1
+ # VanillaSky Video public API
2
2
 
3
- Status: frozen public beta contract for `0.3.0`.
3
+ Status: current public beta contract.
4
4
 
5
5
  This document defines the API that may enter the fresh
6
6
  `@vanillaskyai/video` package. An export not listed here is internal. Tests and
@@ -16,7 +16,7 @@ public API review.
16
16
 
17
17
  ## Compatibility promise
18
18
 
19
- - `0.1.x` patch releases do not make breaking changes to documented APIs or the
19
+ - Patch releases do not make breaking changes to documented APIs or the
20
20
  serialized `Video` schema.
21
21
  - A compatible later `0.x` minor needs no migration ceremony. A breaking
22
22
  pre-1.0 minor must document both `### Breaking changes` and `### Adoption` in
@@ -26,7 +26,7 @@ public API review.
26
26
  must pin an exact package version when they use one.
27
27
  - Deprecated APIs remain usable until the next minor release. The `0.1`
28
28
  package starts without undocumented compatibility aliases.
29
- - The package is ESM-only, targets ES2022, and supports Node.js 20 or newer.
29
+ - The package is ESM-only, targets ES2022, and supports Node.js 22 or newer.
30
30
  - React is an optional peer dependency. Only `/react` and renderer definitions
31
31
  under `/templates` may depend on React.
32
32
  - Framework adapters are examples, not separate public APIs. The release suite
@@ -178,6 +178,13 @@ interface UseVideoResult {
178
178
  <VideoPlayer video={savedVideo} />
179
179
  ```
180
180
 
181
+ Built-in renderers are always available, so a streaming `VideoPlayer` does not
182
+ require a template registry. `playerProps` is a spread-ready player binding; it
183
+ contains the customer registry supplied to `useVideo` when one exists, but it
184
+ does not expose the built-in planning catalog. Import `builtinTemplates` from
185
+ `@vanillaskyai/video/templates/catalog` for labels, schemas, selection guidance,
186
+ and other React-free metadata.
187
+
181
188
  Set `playbackMode="autoplay-after-interaction"` for chat feeds: the first
182
189
  soundtrack waits on a visible scene-one poster, and later streams on the same
183
190
  mounted player autoplay with sound after the first successful viewer start.
@@ -290,7 +297,7 @@ from `/server` without crossing a React type boundary.
290
297
 
291
298
  - A completed `Video` is JSON-serializable and may be stored by the host.
292
299
  - Every completed value carries the required storage field
293
- `schemaVersion: "0.1"`; it is independent from streaming protocol `0.4`.
300
+ `schemaVersion: "0.1"`; it is independent from streaming protocol `0.5`.
294
301
  - `parseVideo(value: unknown)` is the strict universal storage boundary. It
295
302
  validates the full document and returns a detached, deeply frozen `Video`.
296
303
  - JSON serialization remains platform-native; the SDK has no redundant public
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Give your AI a video output
2
2
 
3
- ![Version 0.4.0 beta](https://img.shields.io/badge/version-0.4.0_beta-7c3aed)
3
+ ![npm version](https://img.shields.io/npm/v/@vanillaskyai/video?label=version)
4
4
 
5
5
  **VanillaSky is the open-source video response layer.** Turn text, structured
6
6
  data, and live application context into personalized video responses that start
@@ -17,7 +17,7 @@ the planning prompt, trusted templates, validation, streaming, and player.
17
17
  For humans:
18
18
 
19
19
  ```bash
20
- npm install @vanillaskyai/video@0.4.0 ai @ai-sdk/openai
20
+ npm install @vanillaskyai/video
21
21
  ```
22
22
 
23
23
  For coding agents:
@@ -28,24 +28,20 @@ npx skills add VanillaSkyAi/video@vanillasky
28
28
 
29
29
  Then prompt: `Use $vanillasky to turn this application's data into a personalized video response.`
30
30
 
31
- Add your model key to an ignored `.env.local`:
32
-
33
- ```bash
34
- OPENAI_API_KEY=your-key
35
- OPENAI_MODEL=gpt-4.1
36
- ```
37
-
38
31
  ## Connect your LLM
39
32
 
33
+ VanillaSky never chooses a provider or model. Configure that separately on the
34
+ server, then connect the model your application already owns. The route below
35
+ assumes an AI SDK `LanguageModel` exported as `videoModel`; if you do not have
36
+ one yet, choose a provider and current model in [Provider integration](docs/provider-integration.md).
37
+
40
38
  Create one authenticated server route:
41
39
 
42
40
  ```ts
43
41
  // app/api/video/route.ts
44
- import { openai } from "@ai-sdk/openai";
45
42
  import { streamText } from "ai";
46
43
  import { createVideoHandler } from "@vanillaskyai/video/server";
47
-
48
- const model = openai(process.env.OPENAI_MODEL ?? "gpt-4.1");
44
+ import { videoModel } from "@/lib/video-model";
49
45
 
50
46
  const handle = createVideoHandler({
51
47
  // Local development only. Replace with your session check before deploying.
@@ -55,7 +51,7 @@ const handle = createVideoHandler({
55
51
  return hostname === "localhost" || hostname === "127.0.0.1";
56
52
  },
57
53
  streamText: ({ systemPrompt, userPrompt, signal }) => streamText({
58
- model,
54
+ model: videoModel,
59
55
  system: systemPrompt,
60
56
  prompt: userPrompt,
61
57
  abortSignal: signal,
@@ -68,8 +64,10 @@ export const OPTIONS = handle;
68
64
 
69
65
  The packaged development command supplies the local marker only to `next dev`,
70
66
  so production builds and `next start` deny every request. Replace it before
71
- deploying. The model can come from OpenAI, Anthropic, an AI SDK registry or
72
- gateway, or any compatible streaming adapter.
67
+ deploying. The model can come from Anthropic, OpenAI, an AI SDK registry or
68
+ gateway, or any compatible streaming adapter. The
69
+ [Next.js quickstart](examples/nextjs-quickstart) shows the later, explicit
70
+ provider-selection step with a quality-oriented Claude Sonnet model.
73
71
 
74
72
  For planner-selected image and video backgrounds, configure the optional
75
73
  server-only `resolveMedia` callback described in
@@ -105,8 +103,7 @@ That is the complete path. Built-in templates require no setup. VanillaSky
105
103
  shows each complete, validated scene as soon as it is ready and returns a
106
104
  deterministic `Video` object when generation finishes.
107
105
 
108
- A copy-and-run app is in
109
- [`examples/nextjs-quickstart`](https://github.com/VanillaSkyAi/video/tree/v0.4.0/examples/nextjs-quickstart).
106
+ A copy-and-run app is in [`examples/nextjs-quickstart`](examples/nextjs-quickstart).
110
107
 
111
108
  ## Shape the response
112
109
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BUILTIN_SERVER_TEMPLATE_KIT
3
- } from "./chunk-I5YWVQ5R.js";
4
- import "./chunk-XAMUOSX7.js";
3
+ } from "./chunk-FVTMYS6U.js";
4
+ import "./chunk-3RV4YKB3.js";
5
5
  import "./chunk-2E6T633S.js";
6
6
  export {
7
7
  BUILTIN_SERVER_TEMPLATE_KIT
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VideoFrame
3
- } from "./chunk-N3KUA7VP.js";
3
+ } from "./chunk-K6YVQODK.js";
4
4
  import "./chunk-XWWLKRNU.js";
5
5
  import "./chunk-SPVTJH3F.js";
6
6
  import {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-E7CL7UPB.js";
7
7
  import {
8
8
  parseVideoPlanPart
9
- } from "./chunk-JW47XCRL.js";
9
+ } from "./chunk-G66Z5CWR.js";
10
10
 
11
11
  // src/server/model/truncated-json.ts
12
12
  function isConfidentlyTruncatedJson(source) {